text stringlengths 1 1.11k | source dict |
|---|---|
newtonian-gravity, earth
With curvy lines, it's a little harder. In calculus you learn(ed) that we can compute the slope at a point by getting the slope of a line near the point, then taking the limit as we make the horizontal change arbitrarily close to zero (this is called the derivative):
We can do the same thing in two or three dimensions, but it's more complicated. This is the subject of multivariable calculus. Basically, we take different slices to get the slope in different directions (these are called partial derivatives, with one partial derivative per dimension). Using some more calculus, we can find the gradient of the function, which basically tells us the slope in the most "uphill" direction, and which direction that is. | {
"domain": "physics.stackexchange",
"id": 27834,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "newtonian-gravity, earth",
"url": null
} |
$$\lambda > 0, \tag 7$$
$$\lambda \langle \vec x, \vec x \rangle > 0; \tag 8$$
since
$$\langle X \vec x, X \vec x \rangle \ge 0 \tag 9$$
for every vector $$\vec x$$, it follows from (4) that
$$\langle \vec x, (X^TX + \lambda I) \vec x \rangle = \langle X \vec x, X \vec x \rangle + \lambda \langle \vec x, \vec x \rangle > 0; \tag{10}$$
from this we conclude that $$\vec x \ne 0$$ implies
$$(X^TX + \lambda I) \vec x \ne 0; \tag{11}$$
and hence that
$$\ker (X^TX + \lambda I) = \{0\}, \tag{12}$$
and thus $$X^TX + \lambda I$$ is non-singular, and therefore invertible. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9835969641180277,
"lm_q1q2_score": 0.8300526589758974,
"lm_q2_score": 0.8438951005915208,
"openwebmath_perplexity": 131.82915425592267,
"openwebmath_score": 0.9675235152244568,
"tags": null,
"url": "https://math.stackexchange.com/questions/3685867/why-does-adding-lambda-boldsymboli-to-boldsymbolxt-boldsymbolx-for"
} |
special-relativity, reference-frames, inertial-frames
It is the fact that the planes of constant time in the two frames are tilted that allows the speed of light to be constant relative to both frames.
Suppose the origins of O and O' coincide at t=0 when a light is flashed from the common origin to the left and right, and that O' is moving to the right at around 0.5c. After a second has passed in O, the light will be about 300,000km away in either direction. At the same times that light is at those positions in O, it is about 150,000km ahead of O' to the right and about 450,000km away to the left. Since the speed of light in O' is constant in both directions, that means the time in the O' frame where the light is 150,000km away must be around 0.5s, while the time where the light is 450,000km away to the left must be around 1.5s. | {
"domain": "physics.stackexchange",
"id": 85200,
"lm_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, reference-frames, inertial-frames",
"url": null
} |
Play video: Introduction to differential equations, that is the. Side is a proper vector equation variable with respect to another a set of notes used by Paul Dawkins teach. Driver at UCSD appeared in mimeographed form and has attracted highly favorable attention made possible by the d'Arbeloff for. We do n't offer credit or certification for using OCW linear differential equations equally exceptional personality one of over courses. Function with one or more of its derivatives laws of nature are expressed 34 and. Be understood in the final week, partial differential equations » video lectures from my equations! Uploaded 26/09/20, 23:40 my lecture notes on Analysis and PDEs by considering specific examples and studying them.... 1 linear equation 7 lectures on differential equations 7 1 linear equation 7 lectures on differential equations on... Which can often be thought of as time ( 1/10/2020 ) PDF File document. | {
"domain": "roszak.eu",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9802808736209154,
"lm_q1q2_score": 0.8585172372784825,
"lm_q2_score": 0.8757869916479466,
"openwebmath_perplexity": 1542.8762189377894,
"openwebmath_score": 0.2998172640800476,
"tags": null,
"url": "http://roszak.eu/fcjo6keq/f34428-differential-equations-lectures"
} |
Hopefully, based on examples above it's clear which steps have to be implemented (we move from right to left):
• Find the rightmost digit that can be decremented. So, 0 cannot be such a digit as it's minimal already. If such digit doesn't exist then there's no solution. Decrement it.
• Find the closest digit to the left of the digit from step 1 that can be incremented. So, 9 cannot be such a digit as it's maximum already. If there's no such digit then just prepend 0 to the start of the current number. Increment the digit.
• Now, sort all the digits after the digit from step 2 in ascending order.
• You have a solution now!
UPDATE
As a bonus, a quick implementation of the approach in Python. I'll leave it up to you to improve this solution (if possible :) )
def solve(n):
size = len(n)
trailing_zeros = list()
first_nines = list()
i = size - 1
while i >= 0:
if int(n[i]) != 0:
break
trailing_zeros.append(n[i])
i -= 1
if i < 0:
print ("No solution!")
return | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9304582497090321,
"lm_q1q2_score": 0.8016253377125482,
"lm_q2_score": 0.8615382129861583,
"openwebmath_perplexity": 1374.215149934853,
"openwebmath_score": 0.45820656418800354,
"tags": null,
"url": "https://codereview.stackexchange.com/questions/234312/find-the-smallest-number-greater-than-n-with-the-same-digit-sum-as-n"
} |
odometry, sensor-fusion, diff-drive-controller, ros2-control, ros2-controllers
rqt_graph
UPDATE : add ekf.yaml
### ekf config file ###
ekf_filter_node:
ros__parameters:
use_sim_time: true
# The frequency, in Hz, at which the filter will output a position estimate. Note that the filter will not begin
# computation until it receives at least one message from one of the inputs. It will then run continuously at the
# frequency specified here, regardless of whether it receives more measurements. Defaults to 30 if unspecified.
frequency: 30.0
# The period, in seconds, after which we consider a sensor to have timed out. In this event, we carry out a predict
# cycle on the EKF without correcting it. This parameter can be thought of as the minimum frequency with which the
# filter will generate new output. Defaults to 1 / frequency if not specified.
sensor_timeout: 0.1 | {
"domain": "robotics.stackexchange",
"id": 38523,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "odometry, sensor-fusion, diff-drive-controller, ros2-control, ros2-controllers",
"url": null
} |
c++
Unfortunately this can still fail (and your code will not notice). You need to check the amount read is the amount requeted:
if (fread(sig, 1, BYTES_TO_READ, fp) == BYTES_TO_READ)
Alternatively you can set the number of objects to one then the not test will work as you expect:
if (!fread(sig, BYTES_TO_READ, 1, fp))
/// ^^^^^^^^^^^^^ Notice the size comes first
// ^^ We only want one so the result is 0 or 1
OK there is something wrong when you start setting long jumps:
if (setjmp(png_jmpbuf(m_pPNG)))
This implies you have not set your object up correctly. Some exceptions should help you cover this in a much more readable and maintainable fashion.
All over the code you are repeating the same error handling:
fclose(fp);
return errorCode. | {
"domain": "codereview.stackexchange",
"id": 1560,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++",
"url": null
} |
ros, catkin-make, package.xml, dependencies
Title: How do I make catkin_make check for required python modules?
I would like for catkin_make to fail if a fellow developer does not have all of the required python modules installed. I thought that I could do this using the package.xml manifest, but I may just be doing something wrong.
I would like to make sure that another developer has the python "requests" module installed on their system, but it could be any other non-standard python module from apt-get or pip.
Am I on the right track? Should I try to add something to CMakeLists.txt to get this behavior?
Here's a snippet of my package.xml file:
<?xml version="1.0"?>
<package>
<name>awesome</name>
<buildtool_depend>catkin</buildtool_depend>
<build_depend>rospy</build_depend>
<build_depend>std_msgs</build_depend>
<build_depend>actionlib</build_depend>
<run_depend>rospy</run_depend>
<run_depend>std_msgs</run_depend>
<run_depend>actionlib</run_depend>
<run_depend>roslib</run_depend> | {
"domain": "robotics.stackexchange",
"id": 25540,
"lm_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, catkin-make, package.xml, dependencies",
"url": null
} |
reference-request
Title: "Encyclopedic" / semi-exhaustive reference work on Chemistry I'm buying my brother a present—It's the holiday season after all. He's about to start his academic career in chemistry. I would like to give him a book on chemistry, but not something that is considered "chem 101", "popular", or too specialized and probably off-topic. I am a mathematician myself, and in my field we have the beautiful "Princeton companion to mathematics". It is edited by a Field's medallist, has contributions of many high-profile mathematicians, and is both incredibly varied and in-depth. It contains many, many beautiful phenomena, but is by no means a "popular book" or an easy read. I was wondering if anything like this exists in Chemistry. So to clarify: the book would ideally introduce an advanced reader to several concepts in other branches of chemistry than the person's speciality, in a way that is appealing to a serious academic. Many thanks! Or consider the Merck Index, which lists the | {
"domain": "chemistry.stackexchange",
"id": 14759,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "reference-request",
"url": null
} |
c#, beginner, object-oriented, programming-challenge
private const int RowIncreasment = 3;
private const int CollumnIncreasment = 60;
private static void Main()
{
int[] maxSum = new int[3];
int sumOfDiagonals = 0;
int sumOfRows = 0;
int sumOfCollumns = 0;
bool stopDiagonals = false;
bool stopRows = false;
bool stopCollumns = false;
Stopwatch sw = new Stopwatch();
sw.Start(); | {
"domain": "codereview.stackexchange",
"id": 19586,
"lm_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, programming-challenge",
"url": null
} |
ruby, cyclomatic-complexity
Title: Case of Cyclomatic Complexity I'm trying to recreate the method inject (Works like Reduce) from ruby Enumerable Module.
Using Rubocop (A Linter) I got the error:
Cyclomatic complexity for my_inject is too high. [7/6]
The code is:
module Enumerable
def my_inject(*args)
list = to_a if Range
reduce = args[0] if args[0].is_a?(Integer)
operator = args[0].is_a?(Symbol) ? args[0] : args[1]
if operator
list.each { |item| reduce = reduce ? reduce.send(operator, item) : item }
return reduce
end
list.each { |item| reduce = reduce ? yield(reduce, item) : item }
reduce
end
end
I already did my best to reduce the Cyclomatic complexity,
but still have 1 above (7/6), now I stuck, any directions will be appreciate.
The code can be run on reply:
https://repl.it/@ThiagoMiranda2/INJECT Before I answer your question I should point out that:
list = to_a if Range | {
"domain": "codereview.stackexchange",
"id": 37801,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ruby, cyclomatic-complexity",
"url": null
} |
newtonian-mechanics, newtonian-gravity, rotational-dynamics, acceleration
Title: Rolling ball accelerating down an incline Why rolling ball down an incline or ramp, stops on different spot everytime? I know about friction, gravitational and angular acceleration, but what makes the ball to stop on different place? Where the ball stops depends on the initial conditions for your problem, as well as different characteristics associated to your system. Can we assume that the ball rolls down the ramp without friction? Where it lands will change depending on wether or not there is a coefficient of friction associated with the ramp. Also, initial conditions such as $v_0$ are important in determining where the ball will stop/land. Does the ball start off at rest and begin moving due to gravitational attraction? Or does it have an initial velocity when it starts rolling down the plane? Hopefully this was useful. | {
"domain": "physics.stackexchange",
"id": 53004,
"lm_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, newtonian-gravity, rotational-dynamics, acceleration",
"url": null
} |
# Using the Epsilon-Delta definition of a limit
Use the definition of a limit to show that:
$$\lim_{(x,y)\to (0,0)} (x+y)\sin\left(\frac{1}{x}\right)\cos\left(\frac{1}{x}\right) = 0$$
Id appreciate the thought process behind the solution, the epsilon-delta definition never makes sense in my head.
• Hint: Recall that $\sin$ and $\cos$ are bounded by $1$, so you should squeeze this. – Michael Burr Mar 2 '17 at 14:29
• The "squeeze" technique is shown in the A by Menchun Zhang. Find a (simpler) upper bound $g(x,y)$ for $|f(x,y)|$ and show that $g(x,y)\to 0$. That implies |$f(x,y)|\to 0$. – DanielWainfleet Mar 2 '17 at 16:38
Here is the thought process of how to work out a $\,\delta\,$
$\left.\right.$
For all $\,\varepsilon>0$, we need to find a $\,\delta\,$ such that for all $\,(x,y)\,$ with
$$\sqrt{x^2+y^2}<\delta$$
we have
$$\left|\,(x+y)\sin\left(\frac1x\right)\cos\left(\frac1x\right)\,\right|<\varepsilon$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9901401449874105,
"lm_q1q2_score": 0.8251081294759649,
"lm_q2_score": 0.8333245891029456,
"openwebmath_perplexity": 370.2396259693642,
"openwebmath_score": 0.950503408908844,
"tags": null,
"url": "https://math.stackexchange.com/questions/2168647/using-the-epsilon-delta-definition-of-a-limit"
} |
reinforcement-learning, deep-rl, on-policy-methods, exploration-strategies
Title: Is it possible to apply a particular exploration policy for the on-policy RL agents? Is it possible to use any particular strategy to explore (e.g. metaheuristics) in on-policy algorithms (e.g. in PPO) or is it only possible to define particular policies to explore in off-policy algorithms (e.g. TD3)? In part it depends on the on-policy method you are using. In general you are not free to change the policy arbitrarily for on-policy policy gradient methods such as PPO or A3C.
However, if you are willing to consider the added exploration strategy as part of the current target policy, and can express it mathematically, you should be able to add an exploration term to on-policy approaches: | {
"domain": "ai.stackexchange",
"id": 3025,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "reinforcement-learning, deep-rl, on-policy-methods, exploration-strategies",
"url": null
} |
ros
tcp_server.start({
'waypoints': RosSubscriber('waypoints', Float64MultiArray, tcp_server),
})
rospy.spin()
if __name__ == "__main__":
main()
Originally posted by panserzap on ROS Answers with karma: 3 on 2021-06-23
Post score: 0
You try to assign a list of lists to my_msg.data. my_msg.data is, however, a list of floats only.
How you order the single values needs to be specified in the MultiArrayLayout part my_msg.layout. | {
"domain": "robotics.stackexchange",
"id": 36562,
"lm_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",
"url": null
} |
# The expected value of random variable on tosses of a coin
Came across an interesting problem today. You are given a coin and x money, you double money if you get heads and lose half if tails on any toss.
1. What is the expected value of your money in n tries
2. What is the probability of getting more than expected value in (1)
This is how I approached it. The probability of heads and tails is same (1/2). Expected value after first toss = $1/2(2*x) + 1/2(1/2*x) = 5x/4$ So expected value is $5x/4$ after first toss. Similarly repeating second toss expectation on 5x/4, Expected value after second toss = $1/2(2*5x/4) + 1/2(1/2*5x/4) = 25x/16$
So you get a sequence of expected values: $5x/4$, $25x/16$, $125x/64$, ...
After $n$ tries, your expected value should be $(5^n/4^n) * x$.
If $n$ is large enough, your expected value should approach the mean of the distribution. So probability that value is greater than expected value should be $0.5$. I am not sure about this one. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9648551546097941,
"lm_q1q2_score": 0.8276219758054977,
"lm_q2_score": 0.8577681031721325,
"openwebmath_perplexity": 414.0952166605482,
"openwebmath_score": 0.8946875929832458,
"tags": null,
"url": "https://stats.stackexchange.com/questions/1520/the-expected-value-of-random-variable-on-tosses-of-a-coin/2540#2540"
} |
used in converting spatial data into frequency data. Pytorch Image Augmentation using Transforms. Discrete Fourier Transform (DFT) Short-Time Fourier Transform (STFT) Fourier Series Fourier transform Examples Example (4): Gaussian (cont’d) I The Fourier transform of a Gaussian is still a Gaussian I f(t) = e t2 2 is an eigenfunction of the Fourier transform I We also have lim T!1F(!) = (!) and lim T!0 f(t) = (t). 3 Periodicity 237 4. For the input signal, use a chirp sampled at 50 Hz for 10 seconds and embedded in white Gaussian noise. Secondarily, depending on where you put the factor of $2 \pi$ involved in the Fourier transform, you may need to account for it in your noise spectrum. Fast Fourier Transform v9. The phase of the Fourier Transform is given by the imaginary part of the argument of the complex exponential divided by the imaginary unit, it contains the information about the position µ of the pulse given as the slope of the line describing the phase as function of ω : Sample | {
"domain": "programex.pl",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9902915232319999,
"lm_q1q2_score": 0.8252342807886346,
"lm_q2_score": 0.8333245932423309,
"openwebmath_perplexity": 676.1897974223843,
"openwebmath_score": 0.7972910404205322,
"tags": null,
"url": "http://jrat.programex.pl/discrete-fourier-transform-of-gaussian.html"
} |
string-theory, string
Title: Flux compactification How flux compactification solves the moduli space problem in string theory? Please provide some details and, if posible, an example. Nonzero fluxes are required because of some equations of motion linking them to a nonzero Euler character. Once they're there, they induce a superpotential that stabilizes some moduli, usually the complex structure moduli (the very "stabilizes" means that the allowed values of these moduli at which the total potential has a local minimum is discrete, assuming fixed values of other moduli).
The dilaton-axion field is stabilized by the Gukov-Vafa-Witten superpotential while nonperturbative effects are typically needed to stabilize the Kähler moduli.
See
http://motls.blogspot.com/2006/04/flux-compactifications-of-m-theory-and.html | {
"domain": "physics.stackexchange",
"id": 1210,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "string-theory, string",
"url": null
} |
This is just a beautiful way of writing 3.
• Last line should have $\sqrt{41+8}$ not $\sqrt {41+7}.$ – Mohammad Zuhair Khan Jan 20 at 4:32
This is a slightly more rigorous form of @Pablo_'s excellent insight. @Sangchul Lee covers the full, analytic answer.
Set $$a_n = n^2 + 5n + 5$$ for $$n \geq 0$$. This sequence gives the coefficients of the "infinite radical." Rather than consider the full infinite radical, consider the "partial radicals," defined as $$r_n = \sqrt{a_0 + \sqrt{a_1 + \cdots + \sqrt{a_n + (4 + n)}}}.$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9828232889752295,
"lm_q1q2_score": 0.8080666254192675,
"lm_q2_score": 0.8221891305219504,
"openwebmath_perplexity": 294.9393067661037,
"openwebmath_score": 1.000002145767212,
"tags": null,
"url": "https://math.stackexchange.com/questions/3080127/find-the-sum-sqrt5-sqrt11-sqrt19-sqrt29-sqrt41-cdots/3080205"
} |
c++, c++11
auto burst_times = std::vector<int>{};
burst_times.reserve(num);
for (int i = 0; i < n; i++)
{
std::cout << "Enter Burst time for process " << i+1 << " : ";
int val;
std::cin >> val;
// Again, error checking!
burst_time.push_back(val);
}
auto batch1 = Scheduling{std::move(burst_times)};
batch1.print_table();
auto batch2 = batch1;
batch2.print_table();
Anyway, the rest of the code is cool (though you should probably do some error checking when you read num in main().)
Summary | {
"domain": "codereview.stackexchange",
"id": 30834,
"lm_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
} |
2. Oct 12, 2014
### TSny
That looks good. Think about the limits of integration for finding the time for the wave pulse to go from the bottom to the top. The lower limit on the time integral will be 0 and the upper limit will be the time, $t_1$, when the pulse reaches the top. The two limits on the $\small z$-integral should be values of $\small z$ that correspond to the time limits. Eventually, you want to find the time for the pulse to travel up and back down.
This is not the correct result for the integration. One way to see that it cannot be right is to note that the units for the expression on the right do not reduce to a unit of time.
3. Oct 12, 2014
### Temp0
Yup, I noticed that but I couldn't find the edit button anymore. Currently I have:
$t = 2 \frac {\sqrt {z} } {\sqrt {g} }$
I'm guessing that that's only the amount of time it takes to go up, so I need to multiply that by 2?
4. Oct 12, 2014
### TSny
No guessing allowed :) | {
"domain": "physicsforums.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.952574129515172,
"lm_q1q2_score": 0.8058228771393482,
"lm_q2_score": 0.8459424334245618,
"openwebmath_perplexity": 609.9740924504795,
"openwebmath_score": 0.8038395047187805,
"tags": null,
"url": "https://www.physicsforums.com/threads/wave-in-a-dangling-rope.775609/"
} |
organic-chemistry, reaction-mechanism, hydrocarbons, c-c-addition
The activated hydrogen is in the form of $\ce{Pt-H}$ or $\ce{Pd-H}$ bonds on the surface of metal particles, and hindered alkenes can't approach the $\ce{M-H}$ bonds easily.
Source
Epoxidation on the other hand is free from any such need for to attach to the surface. So we simply consider nucleophilicity. | {
"domain": "chemistry.stackexchange",
"id": 9811,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "organic-chemistry, reaction-mechanism, hydrocarbons, c-c-addition",
"url": null
} |
astrophysics, stars, fusion, supernova, stellar-evolution
Title: Could you know in advance specifically when a star will go supernova? I've been thinking about star trek 2009 and star trek Picard in which they happen to talk about a sun inside a fictional solar system which goes supernova destroying a particularly important planet to a militaristic alien species. This got thinking, could you know in advance whether it be in days/weeks/months/years/decades when a star is most definitely going to go supernova? Or is it rather indeterminate or chaotically random when such event will take place? At the moment, our understanding of the final, pre-supernova stages of stellar evolution are not good enough to give precise warnings based on the outward appearance of a star. Typically, you might be able to say that a star might explode sometime in the next 100,000 years. | {
"domain": "physics.stackexchange",
"id": 69969,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "astrophysics, stars, fusion, supernova, stellar-evolution",
"url": null
} |
java, tree, collision
for (QuadTree child : getChildren())
{
results.addAll(child.getAllColliders());
}
return results;
}
Quadrant getQuadrant(Point p)
{
if (p.x > center.x)
{
if (p.y > center.y)
{
return Quadrant.NORTHEAST;
// return northEast;
}
else
{
return Quadrant.NORTHWEST;
// return northWest;
}
}
else
{
if (p.y > center.y)
{
return Quadrant.SOUTHEAST;
// return southEast;
}
else
{
return Quadrant.SOUTHEAST;
// return southWest;
}
}
} | {
"domain": "codereview.stackexchange",
"id": 8751,
"lm_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, tree, collision",
"url": null
} |
Av is the product of A and v. It is a 3x1 matrix where the entry in each row is the product of the corresponding row of A dot multiplied with the column on v. The first row is (0)(1)+(0)(3)+(2)(0)=0. The second row is (-3)(1)+(1)(3)+(6)(0)=0. The third row is (0)(1)+(0)(3)+(1)(0)=0. Therefore Av= | 0 0 0 | Because Av=0v, v is an eigenvector of A with eigenvalue 0 by the definitions of eigenvector and eigenvalue The characteristic polynomial of A is the determinant of the matrix (A-MI) I will be using M in place of the commonly used lambda. This matrix is | -M 0 2 | | -3 1-M 6 | | 0 0 1-M | The determinant is found by taking (-1)^(1+row#)*(the first entry in the row)*det(matrix obtained by deleting that row and the first column) for each row and adding these values. So the determinant is -M*det |1-M 6 | + 0 + 2*det |-3 1-M | | 0 1-M | | 0 0 | =-M *((1-M)*(1-M)) = -M (1-2M+M^2) = -M+2M^2-M^3 = -M*(1-M)^2 Any of these are proper expressions of the characteristic polynomial. The | {
"domain": "tutorme.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9859363729567546,
"lm_q1q2_score": 0.8380174961721429,
"lm_q2_score": 0.8499711737573762,
"openwebmath_perplexity": 1356.2915660156805,
"openwebmath_score": 0.8986777067184448,
"tags": null,
"url": "https://tutorme.com/tutors/4671/interview/"
} |
homework-and-exercises, general-relativity, differential-geometry, metric-tensor
Your mistake is that $\theta^1{}_0 = 0$ does not follow from $d\omega^1 = 0$. What does follow is that $\theta^1{}_0 = A\omega^0$ for some function $A$, which is, as you can see, precisely what you get from your expression for $d\omega^0$. In effect, you neglect the fact that the wedge product between two parallell one-forms vanishes. | {
"domain": "physics.stackexchange",
"id": 47720,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises, general-relativity, differential-geometry, metric-tensor",
"url": null
} |
bond, theoretical-chemistry, orbitals, reference-request
A $\sigma$ orbital is an orbital, that has no nodal plane between the bonding partners. It is $C_\infty$ symmetric with respect to the bonding axis (in first approximation - of course $d_{xy}$ orbitals can align in a $\sigma$ fashion, too, but for the sake of the argument, let's not consider this.) The point group of this orbital can further be assumed as $D_\mathrm{\infty h}$. It shares therefore most features of an $s$ orbital, hence $s$igma, $\sigma$.
The most prominent example for this is probably the dihydrogen, $\ce{H2}$, molecule.
A $\pi$ orbital has one nodal plane and the bonding axis of the involved atoms is part of this plane. It is therefore asymmetric, $C_1$, with respect to this plane. However, it is $C_\mathrm{s}$ symmetric with respect to the plane that is perpendicular, also sharing the bonding axis. The orbital has further the point group $C_\mathrm{2v}$. It has therefore most features of a $p$ orbital, hence $p$i, $\pi$. | {
"domain": "chemistry.stackexchange",
"id": 3492,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "bond, theoretical-chemistry, orbitals, reference-request",
"url": null
} |
and that the diagonals are equal in length. Children learn to classify triangles as equilateral, isosceles, scalene or right-angled in KS2 geometry. The sides can measure anything as long as they are all the same. Topic: Isosceles Triangle Theorems - Worksheet 4 1. In the above triangle sides AC and BC are equal and therefore angles A and B are also equal. First of all, let’s review the definition of the orthocenter of a triangle. Every equilateral triangle is also an isosceles triangle, but not every isosceles triangle is an equilateral triangle. An isosceles trapezoid is a trapezoid whose legs are congruent. “The orthocenter of a triangle is the point at which the three altitudes of the triangle meet. Therefore, an equilateral triangle is also an equiangular triangle. When all angles are congruent, it is called equiangular. As a vertex is dragged, the others move automatically to keep the triangle isosceles. In an isosceles triangle, the base is usually taken to be the unequal side. | {
"domain": "edugeetha.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9852713861502773,
"lm_q1q2_score": 0.8354783668149235,
"lm_q2_score": 0.8479677564567912,
"openwebmath_perplexity": 394.92703066291256,
"openwebmath_score": 0.6327841281890869,
"tags": null,
"url": "http://edugeetha.com/jcx/properties-of-isosceles-triangle.php"
} |
functions, you can refer this: Classes (Injective, surjective, Bijective) of Functions. Cardinality is the number of elements in a set. A function f : A -> B is called one – one function if distinct elements of A have distinct images in B. p(12)-q(12). fk :Sk→Sn−kfk(X)=S−X.\begin{aligned} For example, q(3)=3q(3) = 3 q(3)=3 because acknowledge that you have read and understood our, GATE CS Original Papers and Official Keys, ISRO CS Original Papers and Official Keys, ISRO CS Syllabus for Scientist/Engineer Exam, Mathematics | Introduction to Propositional Logic | Set 2, Mathematics | Predicates and Quantifiers | Set 2, Mathematics | Some theorems on Nested Quantifiers, Mathematics | Set Operations (Set theory), Inclusion-Exclusion and its various Applications, Mathematics | Power Set and its Properties, Mathematics | Partial Orders and Lattices, Discrete Mathematics | Representing Relations, Mathematics | Representations of Matrices and Graphs in Relations, Mathematics | Closure of | {
"domain": "elespiadigital.org",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9783846716491915,
"lm_q1q2_score": 0.8482944921199215,
"lm_q2_score": 0.8670357546485407,
"openwebmath_perplexity": 684.3939895842474,
"openwebmath_score": 0.8127384185791016,
"tags": null,
"url": "http://elespiadigital.org/libs/qd9zstny/6y18e.php?tag=number-of-bijective-functions-from-a-to-b-4d2c0c"
} |
thermodynamics, thermal-conductivity
Internal energy balance equation. We can write the time derivative of the thermal internal energy as the total heat flux and production (if some production, like chemical reactions, exists in the system)
$\dfrac{d U}{d t} = Q$.
For a 3D continuous system we can write it in integral form as
$\dfrac{d}{dt} \displaystyle \int_V \rho u = - \oint_{\partial V} \mathbf{q} \cdot \mathbf{\hat{n}}$,
being $\rho$ the density, $u$ the internal thermal energy per unit mass, $\mathbf{q}$ the (vector) heat flux per unit surface, transferring energy from the system to the external environment and $\mathbf{\hat{n}}$ the unit normal vector pointing outwards.
Differential form of this equation reads
$\dfrac{\partial }{\partial t} (\rho u) = -\nabla \cdot \mathbf{q}$
Fourier's law. Fourier's law states that the heat flux per unit surface is linear with the temperature gradient $\nabla T$.
Fourier's law in 3D. General form of Fourier's law in 3D physical space reads | {
"domain": "physics.stackexchange",
"id": 90822,
"lm_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, thermal-conductivity",
"url": null
} |
python, performance, algorithm, natural-language-processing
def n_grams_stat(input_file, encoding, n_filter, n):
output_file = []
if n == 2:
for i in two_gram_count(input_file, encoding, n_filter, n):
output_file.append(i)
elif n == 3:
for i in three_gram_count(input_file, encoding, n_filter, n):
output_file.append(i)
elif n == 4:
for i in four_grams_count(input_file, encoding, n_filter, n):
output_file.append(i)
return output_file
start_time = datetime.now()
for a, b, c, d, e in n_grams_stat("/home/yan/PycharmProjects/vk/piidsluhano/men_pidsluhano.txt",'utf-8', n_filter=3, n=4):
print(a, b, c, d, e)
with open("/home/yan/PycharmProjects/vk/piidsluhano/men_4grams", 'dwwaa') as f:
f.write(str(a) +", "+ str(b) + ', '+ str(c) + ", " + str(d) + ", " + str(e) + '\n ')
end_time = datetime.now()
print('Duration: {}'.format(end_time - start_time)) | {
"domain": "codereview.stackexchange",
"id": 19260,
"lm_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, algorithm, natural-language-processing",
"url": null
} |
quantum-mechanics, momentum, heisenberg-uncertainty-principle, measurement-problem, wavefunction-collapse
Title: After measuring momentum, it seems like the particle's position could be literally anywhere? Once measuring momentum, the wavefunction "collapses" into something that looks like this | {
"domain": "physics.stackexchange",
"id": 36352,
"lm_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, momentum, heisenberg-uncertainty-principle, measurement-problem, wavefunction-collapse",
"url": null
} |
# Is there anything special with a 3x3 matrix where the 3rd row is 0 0 1?
I'm coding using p5.js and I'm looking at this method https://p5js.org/reference/#/p5/applyMatrix
Using that method, I can multiply my current matrix with any matrix of the form:
$$\begin{pmatrix} a & c & e \\ b & d & f \\ 0 & 0 & 1 \\ \end{pmatrix}$$
by calling applyMatrix(a, b, c, d, e, f)
There is no method for multiplying any arbitrary matrix like: $$\begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \\ \end{pmatrix}$$
Is there anything special with a matrix of that form? Is it possible to convert any arbitrary matrix (like the bottom matrix) into a matrix of that form? | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.985718065235777,
"lm_q1q2_score": 0.8436279403425884,
"lm_q2_score": 0.8558511506439708,
"openwebmath_perplexity": 372.1562377630775,
"openwebmath_score": 0.6525617241859436,
"tags": null,
"url": "https://math.stackexchange.com/questions/3077803/is-there-anything-special-with-a-3x3-matrix-where-the-3rd-row-is-0-0-1/3077807"
} |
fourier-transform
Title: Centered Fourier transform What is the difference between the non-centered and centered Fourier transforms? In other words, when should you use one instead of the other?
Non-Centered: $\quad \displaystyle X_1(f)=\sum\limits_{n=0}^{N-1} x[n] \, e^{-i 2 \pi f n}$
Centered: $\quad\displaystyle X_2(f)=\sum\limits_{n=0}^{N-1} x[n] \, e^{-i 2 \pi f\left(n-\frac{N-1}{2}\right)}$ | {
"domain": "dsp.stackexchange",
"id": 4986,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fourier-transform",
"url": null
} |
polynomial function is denoted by P(x) where x represents the variable. Also, register now to access numerous video lessons for different math concepts to learn in a more effective and engaging way. The degree of a polynomial is defined as the highest degree of a monomial within a polynomial. Name Space Year Rating. Example: Find the degree of the polynomial 6s4+ 3x2+ 5x +19. It has just one term, which is a constant. The division of polynomials is an algorithm to solve a rational number which represents a polynomial divided by a monomial or another polynomial. Instead of saying "the degree of (whatever) is 3" we write it like this: When Expression is a Fraction. Two or more polynomial when multiplied always result in a polynomial of higher degree (unless one of them is a constant polynomial). We can work out the degree of a rational expression (one that is in the form of a fraction) by taking the degree of the top (numerator) and subtracting the degree of the bottom (denominator). | {
"domain": "aspel.net",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9390248225478306,
"lm_q1q2_score": 0.8036654731345496,
"lm_q2_score": 0.8558511488056151,
"openwebmath_perplexity": 717.2666921475745,
"openwebmath_score": 0.629920244216919,
"tags": null,
"url": "http://aspel.net/ql2yvic/archive.php?11846b=list-of-polynomials"
} |
sql, database, join
, COALESCE(ED.TOTAL_EXPENSES, 0) AS TOTAL_EXPENSES
, COALESCE(ED.CASH_PAST_YEARS, 0) AS CASH_PAST_YEARS
, COALESCE(ED.CASH_PAST_MONTHS, 0) AS CASH_PAST_MONTHS
, COALESCE(ED.CASH_CURRENT_MONTH, 0) AS CASH_CURRENT_MONTH
, COALESCE(ED.CASH_CURRENT_YEAR, 0) AS CASH_CURRENT_YEAR
, COALESCE(ED.CASH_TOTAL_EXPENSES, 0) AS CASH_TOTAL_EXPENSES
, COALESCE(ED.TOTAL_EXPENSES_CASH, 0) AS TOTAL_EXPENSES_CASH
, ((COALESCE(P.COST, 0) + COALESCE(CO.ADDED_COSTS, 0)) - COALESCE(ED.TOTAL_EXPENSES, 0)) AS REMAINING
, P.DURATION
, COALESCE(DU.ADDED_DURATIONS, 0) AS ADDED_DURATIONS
, (COALESCE(P.DURATION, 0) + COALESCE(DU.ADDED_DURATIONS, 0)) AS TOTAL_DURATION
, P.START_DATE
, P.FINISH_DATE
, P.GOVERNORATE_ID
, G.GOVERNORATE_NAME
, P.PROVINCE_ID
, PR.PROVINCE_NAME
, P.DISTRICT_ID
, D.DISTRICT_NAME
, P.TOWN_ID
, T.TOWN_NAME | {
"domain": "codereview.stackexchange",
"id": 31688,
"lm_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, database, join",
"url": null
} |
ros
I tried it but this is not working. The create base is connected to ttyACM0 port as the serial to USB connector definition.
Originally posted by lifelonglearner on ROS Answers with karma: 205 on 2013-07-22
Post score: 0
Hey If you are using Kinect with turtlebot then you have to move the bot to start kinect. If you move it couple of inches then you'll start receiving data from kinect.
Originally posted by ayush_dewan with karma: 1610 on 2013-07-30
This answer was ACCEPTED on the original site
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 15005,
"lm_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",
"url": null
} |
at most one solution for every number b. If both f and g are injective functions, then the composition of both is injective. In question R -> R, where R belongs to Non-Zero Real Number, which means that the domain and codomain of the function are non zero real number. Using math symbols, we can say that a function f: A → B is surjective if the range of f is B. Why it's surjective: The entirety of set B is matched because every non-negative real number has a real number which squares to it (namely, its square root). When applied to vector spaces, the identity map is a linear operator. Cantor was able to show which infinite sets were strictly smaller than others by demonstrating how any possible injective function existing between them still left unmatched numbers in the second set. Suppose f is a function over the domain X. Let me add some more elements to y. The function f(x) = 2x + 1 over the reals (f: ℝ -> ℝ ) is surjective because for any real number y you can always find an x that | {
"domain": "ridhvi.in",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9648551505674444,
"lm_q1q2_score": 0.8081819319292013,
"lm_q2_score": 0.8376199592797929,
"openwebmath_perplexity": 333.2937498503684,
"openwebmath_score": 0.7874745726585388,
"tags": null,
"url": "http://ridhvi.in/6xe1zav/dadc84-example-of-non-surjective-function"
} |
evolution, life, death
To wrap this up, I suppose the answer to your question is that the brain is finding meaning in meaninglessness, simply because that is what the brain does. We look for patterns to make sense out of our environment, which sometimes leads to spurious conclusions. There is no reason that the brain hallucinates when dying, but there IS a reason that this trait appears to be a built-in mechanism.
I hope I was able to shed some light on the issue. Or at the very least, not confuse you further :D | {
"domain": "biology.stackexchange",
"id": 12206,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "evolution, life, death",
"url": null
} |
algorithms, hash, hash-tables
But I dont get it. If we move another element to the deleted place, it will again leave a hole in its probe sequence. How is it logically correct?
PS: This is another question somewhat related to the first one, so I dont know if I should make it a separate question or not.
I came up with and algorithm of moving the last non-Null element of the probe sequence to the place of the deleted element to make the probe sequence contiguous. But this would make it impossible to retrieve the moved element if its hash index value was greater than that of the removed element.
So is there any correct algorithm for this?
Yes. There is a "shift deletion" scheme, that is described, for example, in this answer.
BTW, in the state of the art open-addressing hash table implementations, SwissTable and F14 "dummy" elements rather than "shift deletion" are used, but insertion of "dummy" elements (or "tombstone" or "deleted", as they are also called) is avoided very often in practice. | {
"domain": "cs.stackexchange",
"id": 13206,
"lm_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, hash, hash-tables",
"url": null
} |
in terms of tan(x) and sec(x). Note that the triangle below is only a representation of a triangle. ©K 12 p0W1y29 yK qu BtaE ZSMoyf0t swNaxr 0eF 2L 7LiCR. ♦ Half-Angle Theorem Derivation of Basic Identities; Derivation of Cosine Law; Derivation of Pythagorean Identities; Derivation of Pythagorean Theorem; Derivation of Sine Law; Derivation of Sum and Difference of Two Angles; Derivation of the Double Angle Formulas; Derivation of the Half Angle Formulas; Formulas in Solid Geometry Practical problems • When using Pythagoras’ theorem to solve practical problems, draw a right-angled triangle to represent the problem. Unlike a proof without words, a droodle may suggest a statement, not just a proof. Let’s start by working on the left side of the equation…. Also you should know the Pythagorean Theorem Definition. Learn exactly what happened in this chapter, scene, or section of Trigonometric Identities and what it means. So, replace sin . Questions* to toss out to the class might be: How do | {
"domain": "hhdy87.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9901401441145626,
"lm_q1q2_score": 0.837601566789277,
"lm_q2_score": 0.8459424373085146,
"openwebmath_perplexity": 945.3422094831918,
"openwebmath_score": 0.7557592391967773,
"tags": null,
"url": "http://www.hhdy87.com/ore2/pythagorean-identities-proof-problems.html"
} |
c#, wpf
public Files(string value, bool selected = false)
{
Value = value;
Selected = selected;
}
}
Huh? Files? Plural? There's no collection here. Just File is good. And this confirms it.
OpenFiles = new ObservableCollection<Files>();
What does Value represent? Is it a name? Full file path? What is it man?! =;)-
Seriously though. I've no idea. A better property name is in order.
var handler = FilesSelected;
if (handler != null && !_eventFired) // only fire once
{
_eventFired = true;
handler(this, selectedFiles);
}
Potentially useless comment, but I don't suppose it's causing any active harm at the moment. What I'm more concerned about is setting _eventFired to true before the event has actually fired. The chances of it not firing after setting the boolean variable are slim to none, but it's still odd enough that it caught my eye.
_window.Closed += (s, e) =>
{
OnRemoveFiles(new List<string>());
}; | {
"domain": "codereview.stackexchange",
"id": 14317,
"lm_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#, wpf",
"url": null
} |
c#, game, community-challenge, tic-tac-toe
public class SmallBoard : BoardBase<BoardCell>
{
public SmallBoard(BoardEvaluator evaluator, BoardCellFactory cellFactory)
: base(evaluator, cellFactory)
{ }
}
...which essentially gives a meaningful alias to the generic class. Not sure it's really needed.
Cell Factories
I like abstract factories. This allows me to generate the entire board, simply by enumerating the BoardPosition values:
public interface ICellFactory<TCell> where TCell : IBoardCell
{
TCell Create(BoardPosition position);
}
public class BoardFactory : ICellFactory<SmallBoard>
{
private readonly BoardEvaluator _evaluator;
private readonly BoardCellFactory _cellFactory;
public BoardFactory(BoardEvaluator evaluator, BoardCellFactory cellFactory)
{
_evaluator = evaluator;
_cellFactory = cellFactory;
}
public SmallBoard Create(BoardPosition position)
{
return new SmallBoard(position, _evaluator, _cellFactory);
}
} | {
"domain": "codereview.stackexchange",
"id": 5986,
"lm_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, community-challenge, tic-tac-toe",
"url": null
} |
general-relativity, differential-geometry, metric-tensor, gauge-theory, kaluza-klein
Let us now go back to (1).
The LHS is invariant under our scaling. So the RHS must be invariant as well. Recall that $a,b,c,d,e$ and $f$ are still allowed to be functions of $\sigma$, but as $R$ is invariant and $a(\sigma) R$ must also be invariant we need to have that $a$ is independent of $\sigma$. Similarly as $F_{\mu\nu} F^{\mu\nu}$ scales as $\lambda^2$, we must have that $b$ scales as $\lambda^{-2}$ and so $b\propto e^{2\sigma}$. Finally $\nabla \sigma$ is invariant, so $c,d$ and $e$ must be independent of $\sigma$. We have thus established that
\begin{align}
\tilde R = \alpha R + \beta e^{2\sigma} F_{\mu\nu}F^{\mu\nu} + \gamma (\nabla \sigma)^2 + \delta \sigma \nabla^2 \sigma + \varepsilon \nabla^2 \sigma + f \tag{2}
\end{align}
for some constants $\alpha, \beta,\gamma, \delta$ and $\varepsilon$. We can still have $f$ to be a function of $\sigma$. | {
"domain": "physics.stackexchange",
"id": 68260,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "general-relativity, differential-geometry, metric-tensor, gauge-theory, kaluza-klein",
"url": null
} |
c++, c++11, template, template-meta-programming
template <typename T, typename T1, typename T2>
struct bar_impl<T, std::true_type, T1, T2>
{
static void bar(const T& input)
{
(void)input;
std::cout << "Specialization for std::string" << std::endl;
}
};
struct Foo
{
template <typename T>
void bar(const T& input);
};
template <typename T>
void Foo::bar(const T& input)
{
bar_impl<
T,
typename std::is_same<T, std::string>::type,
typename std::is_integral<T>::type,
typename std::is_same<T, bool>::type
>::bar(input);
}
#endif // A_HPP
// b.cpp
#include "a.hpp"
int main()
{
Foo foo;
foo.bar(Foo());
foo.bar(std::string());
foo.bar(bool());
foo.bar(int());
return 0;
} What you've written does work, and you seem to understand all the concepts (e.g., "you can't partially specialize function templates"), and your coding style (indentation and whatnot) seems fine. | {
"domain": "codereview.stackexchange",
"id": 18993,
"lm_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, template, template-meta-programming",
"url": null
} |
java, linked-list, collections
Title: Java Singly Linked List Here is a naive version of a singly linked list in Java. It implements only Collection and Iterable interfaces. Any comments and suggestions are welcome.
SinglyLinkedList.java:
package com.ciaoshen.thinkinjava.newchapter17;
import java.util.*; | {
"domain": "codereview.stackexchange",
"id": 23931,
"lm_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, linked-list, collections",
"url": null
} |
fourier-transform, power-spectral-density, scipy, coherence
$$
where $\overline{\cdot}$ indicates a mean value, $|\cdot|$ the magnitude of a complex number, ${S}_{XX}$ and ${S}_{YY}$ are the energy spectral density for $X$ and $Y$ respectively and ${S}_{XY}$ is the cross spectral denisty between $X$ and $Y$. And $X(j\omega)$ being the Fourier Transform of a time series $X(t)$ and $X(-j\omega)$ being its complex conjugate. Let's define those as:
$$
X(j\omega) = x_1+ix_2, \quad X(-j\omega) = x_1 -ix_2, \quad Y(j\omega) = y_1+iy_2.
$$
Now, assuming I do not have several signals, but only a single input signal $X$ and single output signal $Y$, I drop the mean $\overline{\cdot}$ and end up with the following:
$$
\gamma^2 = \frac{|{S}_{XY}|^2}{{S}_{XX}{S}_{YY}} = \frac{|X(-j\omega)Y(j\omega)|^2}{|X(j\omega)|^2|Y(j\omega)|^2} = \frac{\left(|X(-j\omega)||Y(j\omega)|\right)^2}{|X(j\omega)|^2|Y(j\omega)|^2}= \frac{\left(\sqrt{x^2_1+x^2_2}\sqrt{y^2_1+y^2_2}\right)^2}{\left(x^2_1+x^2_2\right)\left(y^2_1+y^2_2\right)}=1.
$$ | {
"domain": "dsp.stackexchange",
"id": 6282,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fourier-transform, power-spectral-density, scipy, coherence",
"url": null
} |
angular-momentum, torque, rigid-body-dynamics
Title: Angular Momentum of asymmetric physical pendulum (Rigid Body) The angular momentum of a rigid body respect to a pole $O$ located on its axis of rotation $z$ is uniquely determined if we know its angular velocity:
$\vec{L}_O = I_z\vec{\omega} - \omega\iiint_V r_zr_y \hat{u}_y \,dm - \omega\iiint_V r_z r_x \hat{u}_x \,dm$
where the first term is the component of the angular momentum parallel to the axis of rotation, that is indipendent from the pole that we chose as long as it lays on the axis of rotation, and the other two terms are the components perpendicular to the axis of rotation, and dipendent from the pole that we choose. Furthermore, we know that if a rigid body is symmetric to its axis of rotation the latter integrals result to zero, so that whichever pole we choose on the rotation axis the angular momentum will be uniquely determined and will be parallel to angular velocity. | {
"domain": "physics.stackexchange",
"id": 88069,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "angular-momentum, torque, rigid-body-dynamics",
"url": null
} |
fluid-dynamics, integration
Title: Help on integrating differential dynamic pressure (kinetic energy per unit volume) for 1D radial flow towards a line sink A quick introduction to my question and then the question asked at the end. For this problem the cross-sectional area normal to flow is the surface of a cylinder, $A=2\pi r L$, where $r =$ radial distance from the axis of the cylinder (line sink). The dynamic pressure (kinetic energy per unit volume) for a parcel of fluid is
$$\tag{1} 0.5 \rho v^2$$where $\rho =$ volumetric-mass density and $v=$ velocity.
The derivative of the dynamic pressure with respect to radial position is
$$\tag{2} \frac{d}{dr}(0.5 \rho v^2)=\rho v \frac{dv}{dr}$$
I want to find the integral of the change in dynamic pressure with respect to $r$ (the change in dynamic pressure as the fluid moves towards or away from the line sink). In doing so I make the following steps,
$$\tag{3} \int_{r_1}^{r_2} \rho v \frac{dv}{dr} dr$$
Since $v = w/(\rho A)$, where $w=$ mass flow rate, then, | {
"domain": "physics.stackexchange",
"id": 84591,
"lm_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, integration",
"url": null
} |
computability, semi-decidability
Is there an alternative construction that produces an infinite decidable set from an infinite Turing-recognizable language that is less dependent on the particulars of how a specific enumerator runs? Let $\Sigma$ be an alphabet, let $\mathcal{R}$ be the collection of all recognizable subsets (languages) of $\Sigma^{*}$ and let $\mathcal{D}$ be the collection of all decidable subsets of $\Sigma^{*}$.
Say that $n \in \mathbb{N}$ is a code for $L \in \mathcal{R}$ if the Turing machine encoded by the number $n$ (via some Gödel encoding of Turing machines) recognizes $L$. Let us write $L_n$ for the set that is recognized by the $n$-th Turing machine.
Similarly, say that $n$ is a code of $D \in \mathcal{D}$ if the $n$-th Turing machine is the decider for $D$. If $n$ is the code of a decider (not every number is!) then we write $D_n$ for the set it decides.
Consider the statement: "For every infinite $L \in \mathcal{R}$ there is an infinite $D \in \mathcal{D}$ such that $D \subseteq L$." | {
"domain": "cs.stackexchange",
"id": 5762,
"lm_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, semi-decidability",
"url": null
} |
javascript, performance, algorithm, tic-tac-toe
Title: Algorithm for Tic Tac Toe Currently, I am using an algorithm that finds the best move based on the existing states of the board. Is there a better way to do it? Is there a data structure that I can use?
I have also considered the MinMax algorithm, but did not want to use it as it checks for every possibility on every turn.
var playerSym;
var computerSym;
var turnCount=0;
var playerWin=0;
var compWin=0;
var whoseTurn;
var grid=[];
var winFlag=false;
function initialiseGrid(){
var k=0;
for(var i=0;i<9;i++){
grid[i]=document.getElementById(k);
k++;
}
}
function enterPlayerChoice(eventSrc){
if(!(document.getElementById("x").checked||document.getElementById("o").checked)){
alert("Choose Your Symbol");
return;
}
var target=eventSrc.target;
if(target.innerText!=="")
return;
turnCount++;
var txtNode=document.createTextNode(playerSym);
target.appendChild(txtNode);
//playerMoves.push(Number(target.id));
whoseTurn="Player"; | {
"domain": "codereview.stackexchange",
"id": 20141,
"lm_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, algorithm, tic-tac-toe",
"url": null
} |
python, graphics, macos
def radius(self):
return self._r
def circumference(self):
return self._r * math.tau
print(Circle(radius=10).circumference(1))
Why is that useful ? Because you can add methods and data and it scales.
Why should you care ? Because it relates to how your code is constructed. Your code is like the first example, and you don't want to be in the second example. And the third example has too little use to be in a class, but consider the following:
class Color(tuple): # an example of an immutable object
def __new__(cls, r, g, b, a=1):
return (r, g, b, a)
r = property(lambda self: self[0])
g = property(lambda self: self[1])
b = property(lambda self: self[2])
a = property(lambda self: self[3])
def darker(self, v=10):
return Color(*[max(i-v, 0) for i in self[:3]], self.a)
def with_alpha(self, a):
return Color(*self[:3], a)
# Imagine all the great methods you could add | {
"domain": "codereview.stackexchange",
"id": 33629,
"lm_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, graphics, macos",
"url": null
} |
python, parsing, hash-map, child-process
It works fine for my needs but I'm at the point where I don't want my code to just work but want it optimized and well structured/programmed. How can I improve this snippet?
EDIT: Note that I do not want the address (ie 0xbxxxxxx) in my dictionary This kind of parsing by pattern matching is much better done using a regular expression.
import re
libraries = {}
for line in ldd_out.splitlines():
match = re.match(r'\t(.*) => (.*) \(0x', line)
if match:
libraries[match.group(1)] = match.group(2) | {
"domain": "codereview.stackexchange",
"id": 7361,
"lm_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, parsing, hash-map, child-process",
"url": null
} |
python, number-guessing-game
Print a message hinting at the player's progress towards guessing the target number.
Delegate, don't micromanage.
promptGuess() could be smarter. It already knows what the valid range is, so why can't it perform the validation for you too? That would relieve main() from having to call validGuess(), and would eliminate one level of indentation from main().
Part of not micromanaging is to let each function figure out what information it needs. Instead of passing three parameters newDistance, oldDistance, and firstGuess, consider passing the entire history of guesses instead, as a list. The called function can infer whether it's the first guess based on the length of the array. It can easily extract the last two elements, as needed. (Drawbacks are that you end up storing more state than is strictly necessary, and that you have to trust the called function not to mutate the list. But I think it's a worthwhile tradeoff for simplicity.) | {
"domain": "codereview.stackexchange",
"id": 26059,
"lm_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, number-guessing-game",
"url": null
} |
quantum-mechanics, terminology, harmonic-oscillator
Title: What do you call the quantum number $n$ in the wavefunctions of the 1D quantum harmonic oscillator? Is it the principal quantum number? You could call it like that, conventionally, you would call it the occupation number, since when filling the energy levels, you will start at $n=0$ and work your way up, hence $n$ counts the number of energy modes that are occupied.
It is the eigenvalue of the number operator $\hat n={\hat a}^\dagger \hat a$. | {
"domain": "physics.stackexchange",
"id": 35574,
"lm_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, terminology, harmonic-oscillator",
"url": null
} |
algorithms, graphs, combinatorics
Here, $V = \left\{ 0, 1, 2, 3, 4, 5, 6 \right\}$ and $E = \left\{ (0,1),(0,2),\cdots,(5,6) \right\}$ and creating the initial graph is of the order $O(n^2)$. $E$ readily contains all possible pairs of numbers chosen from the list.
I was wondering if the same strategy could be used to enumerate any $n \choose k$ where $0 \leq k \leq n$, or if there are more efficient algorithms for this purpose. To generalize your approach to $k$-subsets of an $n$-set, you would need to build a hypergraph. Ordinary graph edges are relations between pairs of vertices. Hypergraphs allow relations between arbitrary sets of vertices. They are extremely general objects, essentially representing families of sets. | {
"domain": "cs.stackexchange",
"id": 18023,
"lm_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, combinatorics",
"url": null
} |
particle-physics, pair-production
The answer is that the second photon is usually a virtual photon, a mathematical tool used to describe one of the produced charges' interaction with some other nearby charge. Pair production cannot occur spontaneously in a complete vacuum. There has to be some other charged object somewhere in the universe that can carry off the difference in momentum between the initial photon and the electron-positron pair. An example diagram of this process is below: | {
"domain": "physics.stackexchange",
"id": 78215,
"lm_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, pair-production",
"url": null
} |
information-theory, data-compression, entropy
Edit (updated calculations up top as well): Also I think its possible to have a savings of precisely $l-s$ without having to pay for a delimiter. This is because it is known that substring $s$ did not exist prior to insertion - therefore the pair can be arranged with $sl$ contiguously written in memory and either the length of $s$ is known ahead of time (by estimating the shortest substring) or the next byte following $s$ in the file does not collide with the first byte of $l$ with at least probability $255/256$ (this gets better actually by having a choice which non-occuring $s$ to substitute for which recurring $l$). Here's the Kolmogorov complexity argument that @YuvalFilmus mentions in his answer.
Your input here is a sed script of some size plus an input file of some size. Say the total size of the sed script plus the file is $n$ bits. | {
"domain": "cs.stackexchange",
"id": 12098,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "information-theory, data-compression, entropy",
"url": null
} |
##### Well-known member
Re: Latex help
Thanks evryone for the answer! I will try memorize this method
Regards,
#### Evgeny.Makarov
##### Well-known member
MHB Math Scholar
Re: Latex help
\left[ and \right] will set the size automatically: $$\displaystyle \left[3xy+\frac{3x}{3y}\ln(2)\right]_{\frac{x^2}{3}}^x$$.
To add to this, there is also \middle:
$P\left(A=2\middle|\frac{A^2}{B}>4\right)$
and "If a delimiter on only one side of an expression is required, then an invisible delimiter on the other side may be denoted using a period (.)":
$\left.\frac{x^3}{3}\right|_0^1$
(Wikibooks).
#### MarkFL
Staff member
Re: Latex help
...
and "If a delimiter on only one side of an expression is required, then an invisible delimiter on the other side may be denoted using a period (.)":
$\left.\frac{x^3}{3}\right|_0^1$...
Thank you tremendously...I had encountered this problem for example with:
$$\displaystyle \frac{dy}{dx}|_{x=1}$$ | {
"domain": "mathhelpboards.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9381240108164656,
"lm_q1q2_score": 0.8183700288551011,
"lm_q2_score": 0.8723473862936942,
"openwebmath_perplexity": 4497.76671534505,
"openwebmath_score": 0.955292284488678,
"tags": null,
"url": "https://mathhelpboards.com/threads/latex-help-larger-bracketing-symbols.4302/"
} |
java, multithreading, networking, socket, location-services
private ServerSocket mReceiverSocket = null;
private DataInputStream in = null;
boolean shutDownServer = false;
boolean stopLoop = false;
public MessageReceiver()
{
try
{
if(mReceiverSocket == null) { mReceiverSocket = new ServerSocket(12346); }
System.out.println("mReceiverSocket initialized");
}
catch (IOException ex) {ex.printStackTrace();}
}
/**
* Listens for clients...
*/
private void initConnection()
{
clientSocketListener = new Thread(new Runnable()
{
private boolean loopStatus = true;
@Override
public void run()
{
while(loopStatus)
{
try {Thread.sleep(200);}
catch (InterruptedException ex) {ex.printStackTrace();} | {
"domain": "codereview.stackexchange",
"id": 6463,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, multithreading, networking, socket, location-services",
"url": null
} |
homework-and-exercises, special-relativity, group-theory, lie-algebra, lorentz-symmetry
II. Note that the formula you quoted in the title (V1),
$$ \tag 5 \Lambda^a_{\,\,b} = \left[ \exp\left(-\frac{i}{2} \omega_{\mu\nu} J^{\mu\nu} \right) \right]^a_{\,\,b}
\approx \delta^a_{\,\,b} - \frac{i}{2} \omega_{\mu\nu} (J^{\mu\nu})^a_{\,\,b}, $$
holds on more general grounds (for a generic, modulo mathematical subtleties, representation of the Lorentz group). To obtain the vector representation you are considering here you have to use the appropriate generators $J^{\mu\nu}$, which are in this case
$$ \tag 6 (J^{\mu\nu})^{\rho\sigma} =
i ( \eta^{\mu\rho} \eta^{\nu\sigma}
- \eta^{\mu\sigma} \eta^{\nu\rho} ). $$
To see that this is consistent with (2) consider the following computation:
$$ \tag 7 \Lambda^\rho_{\,\,\sigma} =
\delta^\rho_{\,\,\sigma}
- \frac{i}{2} \omega_{\mu\nu} (J^{\mu\nu})^\rho_{\,\,\sigma}
= \delta^\rho_{\,\,\sigma}
+ \frac{1}{2} \omega_{\mu\nu} (\eta^{\mu\rho} \delta^\nu_{\,\,\sigma} - \eta^{\mu\sigma} \delta^\nu_{\,\,\rho}) | {
"domain": "physics.stackexchange",
"id": 19583,
"lm_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, special-relativity, group-theory, lie-algebra, lorentz-symmetry",
"url": null
} |
nomenclature, ions
No reason is given, but you'll find a historical account of sign conventions for charge and a defense of IUPAC's choice in this article. He says,
[IUPAC's convention] avoids confusion with the conventional symbolism for inherently positive and negative numbers and maintains consistency in how we count physical entities. Thus, in counting apples, we say two apples, three apples, etc., not apples two, apples three – that is, the number always precedes the name of the entity being counted. Likewise, when counting charges, we should say two positive charges or three negative charges, not positive charges two or negative charges three. The IUPAC ruling was intended to make the charge number symbolism consistent with this verbal convention. | {
"domain": "chemistry.stackexchange",
"id": 17654,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "nomenclature, ions",
"url": null
} |
python, algorithm, python-3.x, unit-testing, checksum
Note: There is a thematically related question of mine on optimizing the Luhn check digit algorithm. Your tests look ok. I have three concerns:
If I read correctly, your "single digit modifications" test cycle is going to have over 1000000000000000000000 cycles. That's... not practical. pick a compromise.
The positive tests are checking calculate and validate. I see no reason not to check both in your negative tests too.
You're only checking syntactically valid input. This ties into your question about what the type signature should be.
You have a few options for your type signature. Without going over the compromises in detail, I would suggest that the first line in calculate and validate should be an isdigit() check, and raise an exception if it fails.
Whatever you do for types, your tests should check that it's handling edge cases as intended, whatever it is you decide you intend. | {
"domain": "codereview.stackexchange",
"id": 34944,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, algorithm, python-3.x, unit-testing, checksum",
"url": null
} |
10. freckles
|dw:1438814521770:dw| now find sec(theta) using the right triangle
11. anonymous
The whole negative thing kinda threw me off. Thanks
12. anonymous
What I tried to do initially was rewrite the identity sin^2+Cos^2=1 and go from there
13. freckles
you can use that too
14. freckles
$\sin^2(\theta)+\cos^2(\theta)=1 \\ \text{ we are given } \sin(\theta)=x \text{ so } \sin^2(\theta)=x^2 \\ x^2+\cos^2(\theta)=1 \\ \\ \text{ subtract} x^2 \text{ on both sides } \\ \cos^2(\theta)=1-x^2 \\ \text{ take square root of both sides } \\ \cos(\theta)=\pm \sqrt{1-x^2}$ then just flip both sides to find sec(theta)
15. freckles
its the same thing really
16. anonymous
Ooh, I tried to use the recirpocals first, hence why I had (1/x)^2 Thanks a bunch mate (:
17. freckles
np
18. freckles
well csc^2(x) would actually be (1/x)^2
19. anonymous
Yeah, I figured if the identity works with sin and cos, it'd work with their reciprocals. I see the error
20. anonymous | {
"domain": "openstudy.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9828232894783426,
"lm_q1q2_score": 0.8103003740529928,
"lm_q2_score": 0.8244619177503205,
"openwebmath_perplexity": 2200.6326410645033,
"openwebmath_score": 0.773875892162323,
"tags": null,
"url": "http://openstudy.com/updates/55c27305e4b06d80932e4414"
} |
solid-state-physics, metals, electronic-band-theory
$$
n=\frac{8\sqrt{2}\pi m^{3/2}}{h^{3}} \int\limits_{0}^{\infty}\frac{\sqrt{E}}{1+\exp(\frac{E-E_{F}}{k_{B}T})} dE .
$$
Can you help me with a link where this problem is solved? Or simply a term which describes (approximates) the electron density for higher temperatures. Is there some "rule of thumb" for the metals - e.g. some sort of exponential dependence. Does the derivation need more precise approach? Thank you :) The thing you are looking for is called the Sommerfeld Expansion. The integral you specify can be approximated quite well to calculate the chemical potential (different to $E_F$ when the electrons are not completely degenerate) and expressions for the number density and energy density of the electrons when the chemical potential (or $E_F$) is larger than $kT$, but the gas is not completely degenerate. | {
"domain": "physics.stackexchange",
"id": 16467,
"lm_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, metals, electronic-band-theory",
"url": null
} |
organic-chemistry, stereochemistry, terminology, cis-trans-isomerism
In the example given for structural isomers, 2-fluoropropane has the fluorine atom bonded to the 2nd carbon on the parent chain, while 1-fluoropropane has it bound to the 1st. Neither of these compounds have stereoisomers, because they do not have special properties such as chiral centers or double bonds that can create 2 or more forms of the same compound that have differing chemical properties. The examples that you gave in your question all have cis- and trans-isomerism, because the double bond present prevents it from rotating freely, and thus the full accurate model of the compound cannot be fully explained without including a "cis" or "trans" that indicates whether not the groups on either side of the double bond are on the same side or opposing sides.
Hope this clears things up a bit. | {
"domain": "chemistry.stackexchange",
"id": 14376,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "organic-chemistry, stereochemistry, terminology, cis-trans-isomerism",
"url": null
} |
ros, moveit, ros-control, ur-driver
You can use UR's python interface, like this (bypassing ros_control). The downside is, there won't be any collision checking. We used a 50Hz loop rate.
// Compose a string that contains URScript velocity command
sprintf(cmd_, "speedl([%1.5f, %1.5f, %1.5f, %1.5f, %1.5f, %1.5f], 0.2, 0.1)\n", delta.getX(), delta.getY(), delta.getZ(), 0., 0., 0.);
ROS_INFO_STREAM(cmd_);
// Copy command string to ROS message string
urscriptString_.data = cmd_;
// Send the compliant motion command to the UR5
velPub_.publish(urscriptString_); | {
"domain": "robotics.stackexchange",
"id": 25944,
"lm_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, ros-control, ur-driver",
"url": null
} |
scattering-cross-section
The classical description includes particles that are scattered through a vanishingly small angle, but no real experiment need worry about those for two reasons:
The equipment include both beam-pipe and detector elements has finite size. As does the prepared beam. There is always an lower limit on the angle at which scattered and un-scattered particles can be distinguished. The result is that the integration of the cross-section should not be taken to cover $4\pi$.
The target generally does not consist of a single scattering center, but of a macroscopic quantity of matter meaning that the beam particles are in principle scattered by many centers. In most cases the measured scattering is dominated by a single hard (or at least harder) scattering event. In any case, scattering at impact parameters above about half the inter-center distance is mostly averaged out (lookup "multiple scattering" for the statistical properties of this process). | {
"domain": "physics.stackexchange",
"id": 26642,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "scattering-cross-section",
"url": null
} |
acid-base, metal
After drying out such a mixture, it turns brown, because the iron(II) and chromium (II) hydroxides quickly react with oxygen from air and produce iron(III) and chromium(III) hydroxides, according to the reactions :
$$\ce{4 Fe(OH)2 + O2 + 2 H2O -> 4 Fe(OH)3}$$ $$\ce{4 Cr(OH)2 + O2 + 2 H2O -> 4 Cr(OH)3}$$ As $\ce{Fe(OH)3}$ is dark brown, and $\ce{Cr(OH)3}$ is green, the mixture takes the color of the most abondant product, namely $\ce{Fe(OH)3}$. The green nickel(II) hydroxide is not modified by air. It does exist in the mixture. But as it is not very abundant, it does not modify the brown color of the final mixture. | {
"domain": "chemistry.stackexchange",
"id": 17433,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "acid-base, metal",
"url": null
} |
c#, unit-testing, event-handling, nunit, moq
[Test]
public async Task Publish_OnMessageSent_MessageIgnoredByOtherSubscribers()
{
var messenger = new Messenger();
var listener1 = Mock.Of<IListener<MessageA>>();
var listener2 = Mock.Of<IListener<MessageB>>();
messenger.Subscribe(listener1);
messenger.Subscribe(listener2);
await messenger.PublishAsync(new MessageA());
Mock.Get(listener1).Verify(l => l.Handle(It.IsAny<MessageA>()), Times.Once);
Mock.Get(listener2).Verify(l => l.Handle(It.IsAny<MessageB>()), Times.Never);
} | {
"domain": "codereview.stackexchange",
"id": 25664,
"lm_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#, unit-testing, event-handling, nunit, moq",
"url": null
} |
python, algorithm, numpy, opencv
Relevant steps (citing the article):
1) Input image for which a set of, for example, k = 20 strong, well-distributed keypoints is sought.
2) Keypoints found by detector.
3) The first (strongest) keypoint is selected and all cells within the approximated radius r are covered.
4) Strongest uncovered point is selected, surrounding cells covered.
5) Finally, with this radius, five keypoints have been selected. This is below the desired k, so a new iteration (6)) is started with a smaller r.
7) More than k points are selected and still uncovered points left:
r is too small, the iteration can be aborted and the next iteration (8)) started.
9) Finally, with this r , exactly k keypoints have been selected and are returned as result
What I want reviewed: | {
"domain": "codereview.stackexchange",
"id": 35479,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, algorithm, numpy, opencv",
"url": null
} |
ros, rosbag, openni-node, openni-camera
[ INFO] [1330246494.419197515]: Subscribing to /camera/rgb/image_raw/theora
[ INFO] [1330246494.425615758]: Subscribing to /camera/rgb/image_raw/theora/parameter_updates
[ INFO] [1330246494.432190793]: Subscribing to /camera/depth/image_raw/compressed/parameter_updates
[ INFO] [1330246494.455170068]: Subscribing to /camera/rgb/image_mono/theora
[ INFO] [1330246494.466239857]: Subscribing to /camera/rgb/image_raw/theora/parameter_descriptions
[ INFO] [1330246494.478321710]: Subscribing to /camera/depth/image/compressed/parameter_updates
[ INFO] [1330246494.484514087]: Subscribing to /openni_node1/parameter_descriptions
[ INFO] [1330246494.494957891]: Subscribing to /camera/depth/image/compressed/parameter_descriptions
^C | {
"domain": "robotics.stackexchange",
"id": 8390,
"lm_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, rosbag, openni-node, openni-camera",
"url": null
} |
telescope
Unlike a traditional interferometer, which consists of individual telescopes that focus light (or radio waves) to a point before ultimately combining their images, the antennas don't have a dish that focuses the radio waves from a certain point in the sky. Instead it's just an array of antennas that images the entire sky at once:
The results above also show that the FFTT can be thought of as a cheap
maximally compact interferometer with a full-sky primary beam. To
convert a state-of- the-art interferometers such as MWA 1, LOFAR
[2], 12 PAPER[4], 21CMA [3] into an FFTT, one would need to do three
things: | {
"domain": "astronomy.stackexchange",
"id": 3746,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "telescope",
"url": null
} |
ros, messages, ros-kinetic, multiple-machines
Title: Is there a possibility in ROS to check that the other machine messages publish in the topic without direct transfer of messages between the machines?
Hi,
Is there a possibility in ROS to check that in the other machine messages publish in the topic without direct transfer of messages between the machines?
I would like to transfer between machines only the information that the message was published in topic without transferring the exact things in it.
I tried to use the «Message Event», but according to traffic of the router, the messages were transmitted completely.
Originally posted by baltic on ROS Answers with karma: 35 on 2018-01-29
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 29896,
"lm_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, messages, ros-kinetic, multiple-machines",
"url": null
} |
Here is an example for $$C=40\implies 10c=4$$ where $$c$$ is the one shown in the OP equation.
$$C=40\implies \bigg\lfloor\frac{ 1+\sqrt{80-1}}{2}\bigg\rfloor=4 \le m \le \lfloor\sqrt{40-1}\rfloor=6\\ \land \quad m\in\{6\}\Rightarrow k\in\{2\}\\$$ $$F(6,2)=(32,24,40)\implies (32,24,10\times 4)$$
This method will not find all Pythagorean triples that match the criteria but it will find an infinite number of triples that do such as:
$$c=1\longrightarrow (8,6,10\times 1)\\ c=2\longrightarrow (12,16,10\times 2)\\ c=4\longrightarrow (32,24,10\times 4)\\ c=9\longrightarrow (72,54,10\times 9)\\$$
Note that any multiple of a triple found also yields a valid triple so $$3\times (8,6,10)\longrightarrow (24,18,10\times3)$$ and provides the "missing" $$c=3$$ triple in the list above. The combination of the two will find all Pythagorean triples where the $$c$$ in $$10c$$ is an integer except for the most unusual case like $$(3,1,10\times 1)$$ mentioned in another post. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9732407175907054,
"lm_q1q2_score": 0.8348148513349588,
"lm_q2_score": 0.8577681104440172,
"openwebmath_perplexity": 175.56489909221884,
"openwebmath_score": 0.8545144200325012,
"tags": null,
"url": "https://math.stackexchange.com/questions/4180314/number-of-integer-solutions-of-a2b2-10c2/4180345#4180345"
} |
c++, algorithm, object-oriented, c++20, number-systems
constexpr Money::Money(const long double pounds)
/* Converts the quantity in GBP to the internal representation, or throws a
* std::invalid_argument exception. Rounds to the nearest mill.
*/
{
/* Refactored so that a NaN value will fall through this test and correctly
* raise an exception, rather than, as before, be spuriously converted.
* On an implementation where the precision of long double is less than that
* of long long int, such as MSVC, the bounds tests below could spuriously
* reject some values between the bounds and the next representable value
* closer to zero, but it will only convert values that are in range.
*/
if ( mills_per_GBP * pounds < static_cast<long double>(money_max) &&
mills_per_GBP * pounds > static_cast<long double>(money_min) ) {
// We unfortunately cannot use llroundl in a constexpr function.
mills = static_cast<decltype(mills)>( mills_per_GBP * pounds );
} else {
throw std::invalid_argument(invalid_arg_msg); | {
"domain": "codereview.stackexchange",
"id": 42736,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, algorithm, object-oriented, c++20, number-systems",
"url": null
} |
keras, cnn
=================================================================
Total params: 113,267,056
Trainable params: 94,142,960
Non-trainable params: 19,124,096
_________________________________________________________________
None | {
"domain": "datascience.stackexchange",
"id": 6382,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "keras, cnn",
"url": null
} |
javascript, jquery, node.js, ecmascript-6, socket.io
/**
* Clean-up after a user disconnects.
* @param {Object} socket - the user's client connection
*/
const handleClientDisconnection = socket => {
socket.on('disconnect', () => {
const nickName = nickNames[socket.id]
const nameIndex = namesUsed.indexOf(nickName)
delete namesUsed[nameIndex]
delete nickNames[socket.id]
socket.broadcast.to(currentRoom[socket.id]).emit('message', {
text: nickName + ' has disconnected.'
})
})
} | {
"domain": "codereview.stackexchange",
"id": 25015,
"lm_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, node.js, ecmascript-6, socket.io",
"url": null
} |
quantum-mechanics, density-operator
Title: Square of the density operator for a mixed state Consider a density operator $\hat{\rho}$ for a mixed state defined by
$$\hat{\rho} = \sum_k p_k |\psi_k\rangle \langle\psi_k|$$
Here $p_k$ is the probability of finding the $k$th system of the ensemble in the normalised state $|\psi_k \rangle$.
I wish to show for the mixed state that $\hat{\rho}^2 \neq \hat{\rho}$. Please note that in this question I am not trying to show that $\operatorname{tr}(\hat{\rho}^2) < \operatorname{tr}(\hat{\rho}) = 1$.
For the square of the density operator, I have:
\begin{align}
\hat{\rho}^2 &= \left (\sum_k p_k |\psi_k\rangle \langle\psi_k| \right ) \left (\sum_n p_n |\psi_n\rangle \langle\psi_n| \right )\\
&= \sum_{k,n} p_k p_n |\psi_k\rangle \langle\psi_k| \psi_n\rangle \langle\psi_n|
\end{align} | {
"domain": "physics.stackexchange",
"id": 99797,
"lm_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, density-operator",
"url": null
} |
As to the original question, primes of the form $n!\pm 1$ are known as factorial primes and not all are known. It is in general a complicated question to determine if a number is prime or not, and only partial results are known. For example, if $n+1$ is prime then $n!+1$ is not.
As for the exercise which prompted this question, proving that there exists some $n$ such that $n,n+1,n+2,\dots,n+200$ are all composite consider the following:
Suppose we want to force each $n+i$ to be composite. If we want to force $2\mid n$ and $3\mid (n+1)$ and $5\mid (n+2)$, etc... that would correspond to the system of congruencies:
$\begin{cases} n\equiv 0\pmod{2}\\ n+1\equiv 0\pmod{3}\\ n+2\equiv 0\pmod{5}\\ \vdots\\ n+200\equiv 0\pmod{p_{201}}\end{cases}$
Consider then the Chinese Remainder Theorem.
The Chinese remainder theorem states that we can find such an $n$ that satisfies all of those congruencies since each of what we are modding out by are relatively prime to one another in every case. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.977022627413796,
"lm_q1q2_score": 0.8605586784015001,
"lm_q2_score": 0.8807970811069351,
"openwebmath_perplexity": 136.67351527536294,
"openwebmath_score": 0.7182556390762329,
"tags": null,
"url": "https://math.stackexchange.com/questions/1488451/checking-whether-a-number-is-prime-or-composite"
} |
python, beginner, object-oriented, python-2.x, inheritance
# Usage examples:
class A(object):
__metaclass__ = Meta
def meth(self):
print 'A.meth(%s)' % self
@classmethod
def clsmeth(cls):
print 'A.clsmeth(%s)' % cls
class B(A):
def meth(self):
self.__sup.meth() # super().meth()
print 'B.meth(%s)' % self
@classmethod
def clsmeth(cls):
cls.__sup.clsmeth() # super().clsmeth()
print 'B.clsmeth(%s)' % cls
class C(A):
def meth(self):
self.__sup.meth()
print 'C.meth(%s)' % self
@classmethod
def clsmeth(cls):
cls.__sup.clsmeth()
print 'C.clsmeth(%s)' % cls
class D(B, C):
def meth(self):
self.__sup.meth()
print 'D.meth(%s)' % self
@classmethod
def clsmeth(cls):
cls.__sup.clsmeth()
print 'D.clsmeth(%s)' % cls
d = D()
d.meth()
d.clsmeth() | {
"domain": "codereview.stackexchange",
"id": 21252,
"lm_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, object-oriented, python-2.x, inheritance",
"url": null
} |
c++, c++17, circular-list
But your implementation of size() doesn’t actually tell me how many objects are in an instance… it just tells me the number of objects you care about, and you ignore the rest. That’s bad form.
A static buffer may be impossible
And, as I said, it gets worse. Much worse.
Because, first of all, the number of active objects may not be irrelevant at all. This may not be a simple matter of mismatched counts (bad as that would be). Suppose I use your ring buffer in a low-level kernel routine (where ring buffers are very common) to keep track of processes, with the logic being that there can only be 32 processes open at a time, so: ContiguousRingBuffer<process_t, 32>. Unbeknownst to me, because it’s a hidden detail in the internals of your class, there are actually 63 processes created… and they’re all created at once… right at the start. Then I’m scratching my head about why my kernel is so slow, using so much memory, and crashing randomly. | {
"domain": "codereview.stackexchange",
"id": 43024,
"lm_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++17, circular-list",
"url": null
} |
javascript, css, animation
while ( f.length && d ) {
d = d[f.shift()];
}
return d || '';
});
}
To implement this into your code you would rewrite your bubble_css to something like this:
var bubble_css = "".concat(
".bubble {",
"-webkit-animation: ",
"bubble-effect-in {{bubble_in_ms}}ms forwards,",
"bubble-effect-out {{opacity_out_ms}}ms {{bubble_in_ms}}ms forwards",
";",
"animation: ",
"bubble-effect-in {{bubble_in_ms}}ms forwards,",
"bubble-effect-out {{opacity_out_ms}}ms {{bubble_in_ms}}ms forwards",
";",
"background: rgba({{bubble_color_rgb.r}}, {{bubble_color_rgb.g}}, {{bubble_color_rgb.b}}, {{args.bubble_opacity}})",
"}",
".bubble-wrap:after {",
"-webkit-transition: opacity {{text_in_ms}}ms;",
"transition: opacity {{text_in_ms}}ms;",
"}"
);
Also note how i changed bubble_css += '' to bubble_css.concat('', '') | {
"domain": "codereview.stackexchange",
"id": 13798,
"lm_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, css, animation",
"url": null
} |
c#, object-oriented, .net, stackexchange, polymorphism
/// <summary>
/// Gets the formatted endpoint for the <see cref="IRequest{T}"/>. This should <b>NOT</b> contain the Stack Exchange API base URL or key.
/// </summary>
string FormattedEndpoint { get; }
/// <summary>
/// This should verify that all the provided parameters required for the <see cref="IRequest{T}"/> are present.
/// </summary>
/// <returns>True if the required parameters pass verification, false otherwise.</returns>
bool VerifyRequiredParameters();
/// <summary>
/// This should return a message to be used to indicate to the user what the verification should be.
/// </summary>
string VerificationError { get; }
}
This interface allows us to interact more generically with an API request. It provides a few features we need to guarantee that we are at least attempting to submit a valid API request. | {
"domain": "codereview.stackexchange",
"id": 19464,
"lm_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, stackexchange, polymorphism",
"url": null
} |
java, simulation
if(isOutOfToner(numberToPrint) && (tonerLevel != 0)) {
double difference = tonerLevel * 2;
numberToPrint = difference;
ammountOfPaper -= numberToPrint;
System.out.println("Will run out of toner after this print, able to print " + (int) numberToPrint +
" pages");
tonerLevel = 0;
}
if(isOutOfPaper(numberToPrint) && (ammountOfPaper != 0)) {
double different = ammountOfPaper - numberToPrint;
numberToPrint = numberToPrint + different;
System.out.println("Will run out of paper after this print, printing " + (int) numberToPrint + " pages");
ammountOfPaper = 0;
}
else if(!isOutOfToner(numberToPrint) && (!isOutOfPaper(numberToPrint))) {
ammountOfPaper -= numberToPrint;
tonerLevel = tonerLevel - (numberToPrint / 2);
showPages(numberToPrint);
}
// ...
} | {
"domain": "codereview.stackexchange",
"id": 21517,
"lm_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, simulation",
"url": null
} |
php, object-oriented, api
break;
case 'console':
foreach( $arrReturn as $k => $v ){
$v = ( is_array( $v ) ? $v : array( $k => $v ) );
foreach( $v as $n => $m ){
$debugStr .= sprintf(
'<script type="text/javascript"
console.log("[Debug] %s - %s -> %s ");
</script>',
$func,
$n,
$m
);
}
}
return $debugStr;
break;
}
} | {
"domain": "codereview.stackexchange",
"id": 1418,
"lm_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, object-oriented, api",
"url": null
} |
java
As a side note, in Java you are not guaranteed the order of the array that is produced to by toArray so the so the 0 index may be different each time you run this. There are ordered sets in Java like TreeSet which can give you better predictability here.
Overall this was a nice simple class and I liked it, your methods are nice and short, and so this class is fairly testable.
You may consider whether or not it is worth passing the possible values into the constructor so as to avoid hardcoding them if you decide to change the range.
Also, in the inform_groups method you are passing two pieces of state to the group, including the cell itself, which begs the question: why not just pass the cell and have a method called getSolvedValue which will return the solved value perhaps then you could get away with implementing a simpler interface? | {
"domain": "codereview.stackexchange",
"id": 1510,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java",
"url": null
} |
considered as asymmetric relation. Hint: write the definition of what it means to be asymmetric… A relation can be both symmetric and antisymmetric (in this case, it must be coreflexive), and there are relations which are neither symmetric nor antisymmetric (e.g., the "preys on" relation on biological species). Also, i'm curious to know since relations can both be neither symmetric and anti-symmetric, would R = {(1,2),(2,1),(2,3)} be an example of such a relation? We call antisymmetric … Specifically, the definition of antisymmetry permits a relation element of the form $(a, a)$, whereas asymmetry forbids that. A relation becomes an antisymmetric relation for a binary relation R on a set A. It can be reflexive, but it can't be symmetric for two distinct elements. Examples: equality is a symmetric relation: if a = b then b = a "less than" is not a symmetric relation, it is anti-symmetric. Symmetric relation; Asymmetric relation; Symmetry in mathematics; References. For each of these | {
"domain": "multifisio.es",
"id": null,
"lm_label": "1. Yes\n2. Yes\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9637799441350253,
"lm_q1q2_score": 0.8229839799613926,
"lm_q2_score": 0.853912747375134,
"openwebmath_perplexity": 775.7287487590885,
"openwebmath_score": 0.8121563792228699,
"tags": null,
"url": "http://multifisio.es/ecological-study-bplz/a7a798-every-asymmetric-relation-is-antisymmetric"
} |
• Exactly the little hint I needed. Simple but extremely helpful. Thanks ! – endlessend2525 Dec 17 '16 at 15:46
• @endlessend2525 you're welcome! – Joe Dec 17 '16 at 18:42
Another way
Set $Y=|X|$ we have \begin{align*} G_Y(y)&=\mathbb{P}(Y\le y)\\ &=\mathbb{P}(\,|X|\le y\,)\\ &=\mathbb{P}(-y\le X\le y)\\ &=F_X(y)-F_X(-y) \end{align*}
Therefore
$$g_Y(y)=f_X(y)+f_X(-y)$$ In other words \begin{align*} g_Y(y)=\begin{cases} \frac{2}{\sqrt{2\pi}}e^{-\frac 12 y^2}\, &,\,y>0\\ 0 &,\text{o.w} \end{cases} \end{align*} thus
$$\mathbb{E}[|X|]=\mathbb{E}[Y]=\frac{2}{\sqrt{2\pi}}\int_{0}^{\infty}ye^{-\frac 12 y^2}dy$$
• Why stop without computing the last integral? – Did Dec 21 '16 at 18:08
• Set $y^2=u$ . we have $2ydy=du$ – Behrouz Maleki Dec 21 '16 at 18:11
• I know, thanks, the mistake not included (you forgot a factor 2)... The point is that this should be in the answer. – Did Dec 21 '16 at 18:25 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9669140225647108,
"lm_q1q2_score": 0.8139730286377131,
"lm_q2_score": 0.8418256532040707,
"openwebmath_perplexity": 745.136013561799,
"openwebmath_score": 0.9473779797554016,
"tags": null,
"url": "https://math.stackexchange.com/questions/2062378/ex-for-a-normal-r-v"
} |
java, android
});
}
}
//change to handler
private void checkFire() {
if (System.currentTimeMillis() - lastTurn4 >= 118500) { // it means how often the alien fires
lastTurn4 = System.currentTimeMillis();
missileOffSetY = 0;
}
}
private void draw() {
if (moonRover.getRetardation() > 0.5) {
moonRover.setDistanceDelta(0);
}
if (moonRover.getDistanceDelta() > 0) //why?
moonRover.setRetardation(0.5);
if (ourHolder.getSurface().isValid()) {
//First we lock the area of memory we will be drawing to
canvas = ourHolder.lockCanvas();
if (checkpointComplete) { | {
"domain": "codereview.stackexchange",
"id": 31261,
"lm_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, android",
"url": null
} |
game-ai, evolutionary-algorithms, search, heuristics, alpha-beta-pruning
If you're using a transposition table (TT), it is also common to store the "best move" found for every state in your TT. If, later on, you run into a state that already exists in your TT (which will be very often if you're using iterative deepening), and if you cannot directly take the stored value but have to actually do a search (for instance, because your depth limit increased due to iterative deepening), you can search the "best move" stored in the TT first. This is very light move ordering in that you only put one move at the front and don't order the rest, but it can still be effective. | {
"domain": "ai.stackexchange",
"id": 1578,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "game-ai, evolutionary-algorithms, search, heuristics, alpha-beta-pruning",
"url": null
} |
quantum-mechanics, angular-momentum, quantum-spin, group-representations, lie-algebra
\begin{equation}
k(\textbf{S}^2+\cdots),
\end{equation}
where:
\begin{equation}
\textbf{S}=\textbf{S}_1+\textbf{S}_2+\textbf{S}_3.
\end{equation}
I read somewhere on the internet that the Clebsch-Gordan coefficients were the thing to use to figure out the value of $\textbf{S}^2$, but I'm not seeing it. Could someone explain to me how to use the Clebsch-Gordan coefficients for this case? - In particular, I understand (more or less) Clebsch-Gordan coefficients for adding two angular momenta, but here, I have 3 particles. Is there an equivalent of Clebsch-Gordan coefficients for three angular momenta $j_1,j_2,j_3$? Clebsch-Gordan coefficients let you treat n spins (or generaly - any n particles with arbitrary angular momentum) as a single composite system. The coefficients are simply the matrix element of basis transformation from seperated to composite system. | {
"domain": "physics.stackexchange",
"id": 35715,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, angular-momentum, quantum-spin, group-representations, lie-algebra",
"url": null
} |
zoology
Title: Why do frogs and toads only appear when it is dark outside? I noticed outdoors how frogs and toads only appear when it is dark or cloudy. Such as only after it rains or during night time. Why is this? I see them,( or their ripples after they jump into the water ) during the day; I have 2 small ponds in the yard. I see tree frogs in my patio plants during the day but they are sleeping. The frogs/toads certainly make more noise when it rains ,has rained, or is going to rain. even during the day. They are certainly more active at night . I expect more bugs around then . I only see the geckos at night ,near the lights. | {
"domain": "biology.stackexchange",
"id": 8974,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "zoology",
"url": null
} |
string-theory, topology
What also would make no sense is define
$$X: \mathbb{R} \times S^1 \longrightarrow \mathbb{R}^{1,D-1} \tag2,
$$
since the elements of $S^1$ are sets, not numbers.
So, how do I define correctly the worldsheet and parametrization of a closed string? All the things you claim make no sense do, in fact, make sense.
The following are equivalent: | {
"domain": "physics.stackexchange",
"id": 85801,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "string-theory, topology",
"url": null
} |
homework-and-exercises, electric-circuits, electrical-resistance, capacitance, electrical-engineering
Title: Charging current of capacitor In one of my books there is a figure | {
"domain": "physics.stackexchange",
"id": 40873,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises, electric-circuits, electrical-resistance, capacitance, electrical-engineering",
"url": null
} |
python, csv, beautifulsoup, matplotlib
response = requests.get(text).text # get the url into text format
winds= bs4.BeautifulSoup(response, "xml")
# uses BeautifulSoup to make an xml file
wind_all = winds.find_all("windSpeed") # finds the "windSpeed" element
speeds = wind_all[0].get("mps") # finds the first "mps" attribute
wind_dir = winds.find_all("windDirection") # finds the "windDirection" element
wind_dirs = wind_dir[0].get("deg") # finds the "deg" attribute
rows.append(speeds) # append speed value
rows.append(wind_dirs) # append wind value
writer.writerow(rows) | {
"domain": "codereview.stackexchange",
"id": 23676,
"lm_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, csv, beautifulsoup, matplotlib",
"url": null
} |
This is what I've tried so far:
Suppose there are at least two distinct minimum spanning trees $A_1$ and $A_2$ of $G$. Then there exists $e_2 \in \text{edges}(A_2 \setminus A_1)$. Then the graph $T = A_1 + e_2$ has a unique cycle $C$ that contains $e_2$. If there is an edge $e \in C$ with weight greater than the weight of $e_2$, then $T' = T - e$ is a tree with total weight less than $A_1$, which is absurd by definition of minimum spanning tree. Now, suppose $e_2$ is the edge with maximum weight on this cycle, take $e' \in C$ such that $e' \not \in A_2$ (note that there must be such an edge since otherwise $A_2$ would contain the cycle $C$). Then $\text{weight}(e') < \text{weight}(e_2)$ (here I am using the hypothesis that all edges of $G$ have different weights) and if we define the graph $T'' = (A_2 - e_2) + e'$, then $T''$ is a spanning tree with total weight less than the total weight of $A_2$, which is absurd since $A_2$ was a minimum spanning tree of $G$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9808759638081521,
"lm_q1q2_score": 0.8019391588612442,
"lm_q2_score": 0.8175744828610095,
"openwebmath_perplexity": 78.79906339421291,
"openwebmath_score": 0.84333735704422,
"tags": null,
"url": "https://math.stackexchange.com/questions/2843968/graph-g-with-different-weights-on-edges-has-unique-minimum-spanning-tree"
} |
temperature, economic-geology, diamond
Update: I watched the BBC special on synthetic diamonds (https://www.youtube.com/watch?v=5d2WebdMpBQ) and De Beers shows you can tell the difference between synthetic and real diamonds by their reaction to UV radiation. I am still interested in how I can make a DIY diamond if anyone has details on that. And to make this more on topic, how best I can simulate the Earth's formation of diamond? Why is the Earth's formation of diamond different from these HPHT and CVD diamonds?
what is stopping someone from building a high-pressure, high-temperature system and dumping graphite in and making millions of diamonds?
What is stopping someone from making these HPHT machines and making tons of money? | {
"domain": "earthscience.stackexchange",
"id": 783,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "temperature, economic-geology, diamond",
"url": null
} |
ios, swift, gui
private func getNearestPosition() -> CGFloat {
let currentPosition = frame.origin.y + (barView.frame.size.height / 2)
let positions = [contentFrame.origin.y, minPosition, maxPosition, contentFrame.maxY]
var nearestPosition: CGFloat!
var distance: CGFloat!
for position in positions {
if (distance == nil || distance > abs(currentPosition - position)) {
distance = abs(currentPosition - position)
nearestPosition = position
}
}
return nearestPosition
}
private func getSwipePosition(velocity: CGPoint) -> CGFloat? {
if (velocity.y > swipeSensibility) {
return maxPosition
}
if (velocity.y < -swipeSensibility) {
if (frame.origin.y < minPosition) {
return contentFrame.origin.y
} else {
return minPosition
}
}
return nil
} | {
"domain": "codereview.stackexchange",
"id": 18118,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ios, swift, gui",
"url": null
} |
thermodynamics, bond, enthalpy, mass-spectrometry, ionization-energy
The amount of energy transferred during this process depends upon how fast the electron (from ion source) is traveling and how close it passes to the molecule (analyte). In most $\pu{70 eV}$ EI experiments, approximately $\pu{1400 kJ/mol}$ ($\pu{15 eV}$) of energy is transferred during the ionization process. There is, however, a distribution of energy and as much as $\pu{2800 kJ/mol}$ ($\pu{30 eV}$) is transferred to some molecules. Since approximately $\pu{960 kJ/mol}$ ($\pu{10 eV}$) is required to ionize most organic compounds and a typical chemical bond energy is $\pu{290 kJ/mol}$ ($\pu{3 eV}$), extensive fragmentation is often observed in $\pu{70 eV}$ EI mass spectra. The distribution of energy transferred during ionization and the large number of fragmentation pathways results in a variety of products for a given molecule. Other electron voltages may be used to vary the amount of fragmentation produced during ionization. For most organic compounds the threshold energy for EI is | {
"domain": "chemistry.stackexchange",
"id": 13168,
"lm_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, bond, enthalpy, mass-spectrometry, ionization-energy",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.