text stringlengths 1 1.11k | source dict |
|---|---|
evolution, natural-selection, ornithology
Another user cited the "Spandrels" in comparison to the above debate, could someone explain what could have been the meaning of the comparison? | {
"domain": "biology.stackexchange",
"id": 2769,
"lm_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, natural-selection, ornithology",
"url": null
} |
• "The best I got was near 30 when I took the geometric mean but obviously it's incorrect. " Could you show us *how * you took the geometric mean of? You do need to apply a geometric mean but I wonder if you applied it to the wrong numbers. – Silverfish Oct 5 '16 at 18:15
• I presume this a question from a course or textbook? If the latter, you should probably give credit with a reference/citation. Either way, please add the [self-study] tag & read its wiki to see how we handle self-study questions (slightly differently to how we handle most other questions). – Silverfish Oct 5 '16 at 18:18
• well i applied GM on the percentages ((20)(30)(45))^1/3 – With A SpiRIT Oct 6 '16 at 2:50
• I don't know whether the question is from a textbook or not because this is one of the question from within the other questions that our professor has uploaded for our self assessment. – With A SpiRIT Oct 6 '16 at 2:53 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.982823294006359,
"lm_q1q2_score": 0.8232324174645145,
"lm_q2_score": 0.8376199694135332,
"openwebmath_perplexity": 422.23331632377653,
"openwebmath_score": 0.7288872003555298,
"tags": null,
"url": "https://stats.stackexchange.com/questions/238644/calculate-the-average-rate-of-population-increase-per-decade-of-a-country"
} |
ros-kinetic
# Create grid board object we're using in our stream
board = aruco.GridBoard_create(
markersX=2,
markersY=2,
markerLength=0.09,
markerSeparation=0.01,
dictionary=ARUCO_DICT)
# Create vectors we'll be using for rotations and translations for postures
rvecs, tvecs = None, None
cam = cv2.VideoCapture(0)
while(cam.isOpened()):
# Capturing each frame of our video stream
ret, QueryImg = cam.read()
if ret == True:
# grayscale image
gray = cv2.cvtColor(QueryImg, cv2.COLOR_BGR2GRAY)
# Detect Aruco markers
corners, ids, rejectedImgPoints = aruco.detectMarkers(gray, ARUCO_DICT, parameters=ARUCO_PARAMETERS) | {
"domain": "robotics.stackexchange",
"id": 34269,
"lm_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-kinetic",
"url": null
} |
• $2^{n^2}$ grows faster than $n!$ – Jeremy Oct 3 at 17:58
• OP, l’Hopital on each factor as you have written it in your post (as it is indeterminate) shows that they identically tend to 0. For terms with a finite numerator it is automatically 0. Perhaps try to flesh this out. – Certainly not a dog Oct 3 at 18:13
• It seems incorrect. I edited my first post. I checked on Wolfram. – Jeremy Oct 3 at 18:15
It is easy to see that $$n/2^n \leq 1/2$$ for each integer $$n \geq 1$$.
So we can limit $$a_n = \frac{n!}{2^{n^2}}$$ (from above) with a geometric progression, I think.
How? Prove the above inequality by induction.
Then using that inequality we have:
$$\frac{n!}{2^{n^2}} \leq \frac{n^n}{2^{n^2}} = (\frac{n}{2^n})^n \leq (1/2)^n$$
Then we can find that the limit is zero using the squeeze theorem.
• A very concise and clear answer! – NotAMathematician Oct 4 at 20:08
$$n! \leq n^n=2^{n\log_2 n}$$ This should give you your squeeze theorem argument. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9822877012965886,
"lm_q1q2_score": 0.807626266771693,
"lm_q2_score": 0.8221891261650247,
"openwebmath_perplexity": 273.0999888447267,
"openwebmath_score": 0.9518929123878479,
"tags": null,
"url": "https://math.stackexchange.com/questions/3379578/limit-of-fracn2n2"
} |
$\int (superscript 4/5, subscript 0) (sin^-1 ((5/4)x))/(sqrt(16-25x^2))$
$\int_0^{\frac{4}{5}} \frac{\arcsin \left(\frac{5}{4}x\right)}{\sqrt{16-25x^2}}\,\mathrm{d}x$
Remember that $\arcsin'x=\frac{1}{\sqrt{1-x^2}}$
3. Originally Posted by Pikeman85
I'm supposed to find several indefinite integrals, but I am not sure exactly how to do each, especially as they involve natural logs and trigonmetric functions.
The three are:
$\int ln(x^4)/x$ dx
$\int$((e^t^x) cos (e^t))/(3+5 sin (e^t))
and lastly
$\int (superscript 4/5, subscript 0) (sin^-1 ((5/4)x))/(sqrt(16-25x^2))$
for the frist one
$\int \frac{\ln(x^4)}{x}dx=4\int\frac{\ln(x)}{x}dx$
Let $u=\ln(x) \implies du=\frac{1}{x}dx$
$4\int udu=2u^2+C=2\left( \ln(x)\right)^2+C$
For number 2 you have both x's and t's but no dx or dt what variable are integrating with respect to?
For the last one
$\int_{0}^{4/5}\frac{\sin^{-1\left( \frac{5}{4}x\right)}}{\sqrt{16-25x^2}}dx$
let $x=\frac{4}{5}\sin(t) \implies dx=\frac{4}{5}\cos(t)dt$ | {
"domain": "mathhelpforum.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9637799451753697,
"lm_q1q2_score": 0.8052222756104829,
"lm_q2_score": 0.8354835350552603,
"openwebmath_perplexity": 1749.1477419547125,
"openwebmath_score": 0.9773095846176147,
"tags": null,
"url": "http://mathhelpforum.com/calculus/41982-find-indicated-integrals.html"
} |
acceleration, velocity, rotation, speed
Title: Increasing speed of a car using more motors? I am making a robot car with four wheels. Every wheel will be attached to a motor. If I use four motors and four wheels , will I get more speed then using two motors?(If all the motors rotate at same speed)
According to my thought, The speed should be increased after using four motors as more motors are rotating. But practically, I am seeing same speed whether I use four wheel or two. For balancing,I am using a ball caster at front. It depends on whether you are limited by the torque that each motor can generate.
If the friction is low, then the motor may end up running at its maximum speed (as a motor goes faster, it generates more back EMF until it equals the voltage applied).
When you add more motors, there is a risk that you draw more current from your power source, which drops the voltage available, and gives you lower speed. | {
"domain": "physics.stackexchange",
"id": 49099,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "acceleration, velocity, rotation, speed",
"url": null
} |
ros, moveit, robot-state-publisher
Originally posted by lucasw on ROS Answers with karma: 8729 on 2022-07-24
Post score: 0
https://github.com/lucasw/robot_state_publisher/tree/robot_state_function has code cut-and-paste out of robot_state_publisher into a standalone RobotState class, and https://github.com/lucasw/robot_state_publisher/blob/robot_state_function/test/test_robot_state.cpp shows basic usage.
#include <robot_state_publisher/robot_state.h>
...
robot_state_publisher::RobotState rs;
const auto stamp = ros::Time::now();
sensor_msgs::JointState js;
js.header.stamp = stamp;
js.name.push_back("joint1");
double angle = 0.538;
js.position.push_back(angle);
rs.setJointState(js);
const tf2_msgs::TFMessage tfm = rs.getTransforms(stamp);
Originally posted by lucasw with karma: 8729 on 2022-07-24
This answer was ACCEPTED on the original site
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 37873,
"lm_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, robot-state-publisher",
"url": null
} |
proof-techniques
You can read the details in the paper or in the repo for the software we developed, but I computed the unique 3 991 680 instances and their solutions, solving IcoSoKu I guess :) | {
"domain": "cs.stackexchange",
"id": 20340,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "proof-techniques",
"url": null
} |
Total amt of gold = 2x/5 + 3(8-x)/10 = (4x+24-3x)/10 = (x+24)/10 kg
Total amt of silver = 3x/5 + 7(8-x)/10 = (6x+56-7x)/10 = (56-x)/10 kg
Ratio of gold/silver = 5/11 = (x+24)/10 * 10/(56-x)
5/11 = (x+24)/(56-x)
5(56-x) = (x+24)(11)
x = 1kg
Director
Joined: 18 Jul 2006
Posts: 530
Followers: 1
Kudos [?]: 38 [8] , given: 0
8
KUDOS
3
This post was
BOOKMARKED
X is weight of first bar and (8-x) is weight of second bar.
(2/5)x + (3/10)(8-x) = (5/16)*8
=>x = 1
Manager
Joined: 18 Feb 2010
Posts: 174
Schools: ISB
Followers: 8
Kudos [?]: 158 [2] , given: 0
Re: PS: Melted Gold-Silver [#permalink] 20 Mar 2010, 23:02
2
KUDOS
First bar has 40% gold and second bar has 30% gold by weight.
The resulting 8 kg bar has 31.25% of gold by weight.
So by obviously we know that maximum percent of second bar would go to make the final bar because 31.25 % is close to 30%. Working with options we get 1 kg of bar one as the answer. (we can use interpolation) | {
"domain": "gmatclub.com",
"id": null,
"lm_label": "1. Yes\n2. Yes\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9492946380711991,
"lm_q1q2_score": 0.8106147942284639,
"lm_q2_score": 0.8539127492339909,
"openwebmath_perplexity": 8001.672308103997,
"openwebmath_score": 0.4890669584274292,
"tags": null,
"url": "http://gmatclub.com/forum/there-are-2-bars-of-gold-silver-alloy-one-piece-has-2-parts-48285.html"
} |
reads, quality-control, trimming, qc, cutadapt
It could replace low quality bases in the middle of a read by an N, for example. Or is it that the low quality base is still most probably correct and hence one does not want to lose the base information for mapping?
With a low-quality base, you might have an error/mismatch, but with an N, you always have a mismatch. Masking low-quality bases to N is not as good.
EDIT: responding to the following comment from OP:
What if the base is low-quality and then it matches the reference by mistake? Wouldn't it be better if it did not match and was penalized? I guess this should be modeled mathematically. | {
"domain": "bioinformatics.stackexchange",
"id": 459,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "reads, quality-control, trimming, qc, cutadapt",
"url": null
} |
particle-physics, earth, neutrinos, weak-interaction
$$\pi^+ \rightarrow \mu^+ + \nu_{\mu}$$
$$\pi^- \rightarrow \mu^- + \nu_{\mu}$$
The charged particles can be removed easily by surrounding the beam with a magnetic field. The charged particles will deflect in a curved path and hence can be separated. Neutrinos being uncharged are not affected by the magnetic field. The heavy particles can also be removed easily by using a thick steal-cement slab. Neutrinos feebly interact with matter and hence will easily make its way through the slab. Ultimately, you will be left with a beam consisting of neutrinos in majority. | {
"domain": "physics.stackexchange",
"id": 37810,
"lm_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, earth, neutrinos, weak-interaction",
"url": null
} |
quantum-mechanics, laser, quantum-optics, coherent-states
$$
\hat{\mathbf E}(\mathbf r) = \sum_n\bigg[\hat{a}_n\mathbf f_n(\mathbf r)+\hat {a}_n^\dagger\mathbf f_n^*(\mathbf r)\bigg],
$$
where the classical mode amplitudes $a_n(t)$ get replaced by bosonic annihilation operators $\hat a_n$. (A previous appearance of this description on answer to a question of yours is here.)
Generically speaking, moreover, saying that the radiation is described by a coherent state $|\alpha\rangle$ implicitly implies that it is one of those modes that carries the coherent state in question, and that all the other modes are in the QED vacuum state.
Thus, | {
"domain": "physics.stackexchange",
"id": 50016,
"lm_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, laser, quantum-optics, coherent-states",
"url": null
} |
electromagnetism, capacitance, gauss-law
$$\implies V = \frac{\sigma d \left( \epsilon_1 + \epsilon_2 \right)}{2\epsilon_1\epsilon_2} + \frac{\sigma' d \left( \epsilon_1 - \epsilon_2 \right)}{2\epsilon_1\epsilon_2}.$$
The idea is that this new interface charge density is a free parameter. Its value depends on the current equilibrium state since this is our other boundary condition, or in other words, the system's equilibrium state can only be fully described by both charge and current boundary conditions. Your professor simplifies this by first finding the current equations and seeing that they do not depend on the charge boundary conditions (thus fully explain the, say, voltage and electric fields fully). | {
"domain": "physics.stackexchange",
"id": 63741,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electromagnetism, capacitance, gauss-law",
"url": null
} |
gnuradio
transmit something you know – for example, a preamble, or a known data packet – that is as white as you get with the given scheme (in this case: transmit pseudorandom white data through your GFSK transmitter)
Correlate with that at the receiver
Since that correlation will be mathematically equivalent to (noisy) convolution of your transmit signal's autocorrelation function and the channel impulse response: It's your channel estimate. You don't need it any better than that, because it excites exactly the frequencies present in your signal.
The first step – transmission of something you know – is in many systems done via a decision feedback equalizer, where "something you know" is what you received and decided for, but that means block-wise operation in an FSK case, since your system is not linear in modulation pulses, but has memory.
TL;DR: Don't. Your system design implies the channel is flat, and hence you don't need a channel estimate. Spend your time on something else! | {
"domain": "dsp.stackexchange",
"id": 8846,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gnuradio",
"url": null
} |
search-algorithms, big-data, search
Parallel computation. If you split the indices across multiple SSDs (say, using RAID or striping), you can increase the read bandwidth. If you use a cluster of machines, each with their own SSD, you can parallelize both data transfer and computation. The intersection task is trivially parallelizable, so you can achieve excellent speeds this way. For instance, if you're using magnetic hard disks with read bandwidth of 200MB/s, striping the indices and computation across 8 machines is enough to finish this task in under a second.
Caching. You only need to do this work once. Once you've computed the size of the intersection once, you can store it in a table and cache it for some time period (a month or more), as it's unlikely to change much in the future, and then once someone else asks the same cache, you can return the number of results instantaneously. | {
"domain": "cs.stackexchange",
"id": 6782,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "search-algorithms, big-data, search",
"url": null
} |
Miscellaneous pointset topology and measure theory
1. Apr 6, 2004
marcus
In a quantum gravity discussion ("Chunkymorphism" thread) some issues of basic topology and measure theory came up. Might be fun to have a thread for such discussions.
for instance the statement was made, apparently concerning the real line (or perhaps more generally) that a countable set must consist entirely of isolated points
this is a purely topological matter, separate from measure theory (although it came up when the talk was also about some basic measure theory issues as well)
At least two of us IIRC made the point that this is mistaken, a countable subset of the reals may have no isolated points at all. Indeed the rational numbers are an example: they are countable and have no isolated points.
This brings up basic definitions in topology, like what is an isolated point, about which we could have a refresher thread if people want. | {
"domain": "physicsforums.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9658995713428385,
"lm_q1q2_score": 0.802800709610971,
"lm_q2_score": 0.8311430436757313,
"openwebmath_perplexity": 670.4675315144351,
"openwebmath_score": 0.7280128598213196,
"tags": null,
"url": "https://www.physicsforums.com/threads/miscellaneous-pointset-topology-and-measure-theory.18199/"
} |
machine-learning, data-science-model, one-hot-encoding
Instead of encoding all companies, consider only encoding the top X (i.e. 100) and convert the rest under a single feature called other_company. You will have to play with the numbers. This way, the model will be trained where the company is unknown.
You will have to make adjustments to your training, validation and test set to ensure that the latter 2 contain companies not seen in training. | {
"domain": "datascience.stackexchange",
"id": 11965,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "machine-learning, data-science-model, one-hot-encoding",
"url": null
} |
ros, rosjava, android, android-gingerbread
Originally posted by amigo on ROS Answers with karma: 93 on 2012-03-28
Post score: 1
It looks like the documentation is here: http://docs.rosjava.googlecode.com/hg/android_core/html/building.html
Or, as it currently says:
roscd android_core
rosrun rosjava_bootstrap install_generated_modules.py android_tutorial_pubsub
./gradlew android_tutorial_pubsub:debug
But I'm getting the following errors:
[ bowie:~/versioned/ros/3rd_party/android_core ] ./gradlew android_tutorial_pubsub:debug
:android_gingerbread:deployTransitiveLibs
FAILURE: Build failed with an exception. | {
"domain": "robotics.stackexchange",
"id": 8772,
"lm_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, rosjava, android, android-gingerbread",
"url": null
} |
is the measure of a central angle that intercepts an arc s equal in length to the radius r of the circle. Definition of radian measure The radian measure of any central angle is the length of the intercepted arc divided by the length of the radius of the circle. One radian is the measure of a central angle subtended by an arc that is equal in length to the radius of the circle. In the figure above, notice that the central angle of the circle intercepts an arc whose length is twice the length of the radius of the circle. A circle has a central angle measuring (7pi/10) radians that intersects an arc of length 33 cm. Learn how tosolve problems with arc lengths. The radian measure, θ, of a central angle is defined as the ratio of the length of the arc the angle subtends, s, divided by the radius of the circle, r. which gives arc … The formula is $$S = r \theta$$ where s represents the arc length, $$S = r \theta$$ represents the central angle in radians and r is the length of the radius. | {
"domain": "sintap.pt",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9873750496039276,
"lm_q1q2_score": 0.8002466571712248,
"lm_q2_score": 0.810478913248044,
"openwebmath_perplexity": 577.8516825216227,
"openwebmath_score": 0.8369142413139343,
"tags": null,
"url": "https://www.sintap.pt/bmo-nesbitt-yeriz/radian-measure-of-central-angle-f85723"
} |
fitxy = FindFormula[xy];
and compare the results
Show[{ListLinePlot[xy],
Plot[fitxy[x], {x, Min[First /@ xy], Max[First /@ xy]},
PlotStyle -> Red]}]
• xy might be extracted more easily with xy = PixelValuePositions[curve, 0 ] – Ulrich Neumann Mar 13 at 15:04
• @UlrichNeumann that doesn't work for me - but I may have a different definition of curve. I need to apply Binarize to curve. And perhaps fiddle some more. – mikado Mar 13 at 15:08
• I just copied the image into the Mathematica code curve= "copy of image" . No need to binarize because black&white image. – Ulrich Neumann Mar 13 at 15:21
• @UlrichNeumann I guess we copied the image in different ways. – mikado Mar 13 at 15:29
• my way: right click -> copy picure ->paste in Mathematica – Ulrich Neumann Mar 13 at 16:00
## Get (x, y) points from the image pixel positions
curve = Import["https://i.stack.imgur.com/WG8W9.png"]; | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9458012747599251,
"lm_q1q2_score": 0.8112781671480453,
"lm_q2_score": 0.8577681049901037,
"openwebmath_perplexity": 6980.123467709541,
"openwebmath_score": 0.18191559612751007,
"tags": null,
"url": "https://mathematica.stackexchange.com/questions/241686/how-to-fit-a-curve-in-a-picture-with-an-equation"
} |
swift, ios, protocols, uikit
are global variables. To restrict their visibility, they can be made
“file private”
fileprivate var kReferenceViewKey = "ReferenceViewKey"
// ...
or static properties, private to the extension:
extension UIView: BJDraggable {
private static var kReferenceViewKey = "ReferenceViewKey"
// ...
}
Note also that the explicit type annotation is not necessary.
Only the address of the variable is needed as key for the associated
value, the type and value does not matter. You can even define it as
a single byte
private static var kReferenceViewKey: UInt8 = 0
to save some memory.
Here
if view.tag == 122 || view.tag == 222 || view.tag == 322 || view.tag == 422
“magic tag numbers” are used to identify the special views which were added earlier. That is error-prone, since the original UIView might use
the same tags by chance.
An alternative would be to create a custom UIView subclass for those
special views, or keep references to them in another (associated)
property. | {
"domain": "codereview.stackexchange",
"id": 31038,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "swift, ios, protocols, uikit",
"url": null
} |
c#, optimization, asp.net-mvc-4
But what about having fewer loops? The answer is that it doesn't matter from a theoretical perspective: Executing
foreach (x in things)
a(x);
foreach (x in things)
b(x);
foreach (x in things)
c(x); | {
"domain": "codereview.stackexchange",
"id": 8660,
"lm_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#, optimization, asp.net-mvc-4",
"url": null
} |
quantum-gate, qiskit, programming
Results of simulation: In the first circuit after Hadamard gates (I suppose that initial state is $|000\rangle$ and I will use Qiskit's convention for labeling the qubits $|q_2 q_1 q_0 \rangle$):
$$|000\rangle \xrightarrow[]{\text{Hadamards}} \frac{1}{2}|0\rangle(|00\rangle + |01\rangle+|10\rangle + |11\rangle)$$
The $R_x(0) = I$, so it does noting. Then comes Toffoli gate (apply $X$ gate on the $q_2$ qubit if the other two (control qubits) are in $|1\rangle$ state):
$$\xrightarrow[]{\text{Toffoli}} \frac{1}{2}|0\rangle(|00\rangle + |01\rangle+|10\rangle) + \frac{1}{2}|111\rangle$$
In the second circuit $R_x(\pi) = -iX$ (we can neglect $-i $ term because it is a global phase here) and the combained action of Hadamards plus $R_x(\pi)$
$$|000\rangle \xrightarrow[]{\text{Hadamards + }R_x(\pi)} \frac{1}{2}|1\rangle(|00\rangle + |01\rangle+|10\rangle + |11\rangle)$$
Then Toffoli: | {
"domain": "quantumcomputing.stackexchange",
"id": 2085,
"lm_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-gate, qiskit, programming",
"url": null
} |
homework-and-exercises, electric-circuits, electronics, electrical-engineering
As you can see, it's a relatively simple RLC circuit with a couple independent sources and a voltage-controlled voltage source. Despite this, I have been unable to solve for mesh currents and nodal voltages despite repeated attempts at tackling the problem.
From what I understand, the energy stored by a capacitor over $[t_0,t]$ follows from $i=C\frac{dV}{dt}$ since $W=\int^t_{t_0} Pdt=\int iVdt = \int_{t_0}^t CV\frac{dV}{dt}dt=C\int_{V_0}^V V\ dV=\frac12C(V^2-V_0^2)$.
Similarly, for an inductor, $V=L\frac{di}{dt}$ so $W=\int_{t_0}^tLi\frac{di}{dt}dt=L\int_{i_0}^i i\ di=\frac12L(i^2-i_0^2)$.
Unfortunately, I haven't been able to find the above $V(t),i(t)$. $V_0,i_0$ were however trivial to solve for using a DC-equivalent circuit.
How does one go about solving for these functions? A couple of suggestions:
(1) the EE stackexchange site a better home for this question | {
"domain": "physics.stackexchange",
"id": 17079,
"lm_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, electronics, electrical-engineering",
"url": null
} |
algorithms, graphs, sets, packing
←: Given a set packing problem on a collection $C$, create a graph $G(V,E)$ where for every set $S \in C$ there is a vertex $v_S \in V$, and there is an edge between $v_{S_1}$ and $v_{S_2}$ iff the sets $S_1$ and $S_2$ intersect. Now, every independent vertex set in $G$ corresponds to a set of sets from $C$ no two of which intersect, i.e., this is a set packing in $C$ of the same size.
My question is: is my reduction correct? If so, are these problem equivalent? Is it possible to use approximation algorithms for one problem on the other problem? The exact meaning of "equivalent" isn't obvious but you have shown something deeper than the normal equivalence under reductions considered for NP-complete problems. | {
"domain": "cs.stackexchange",
"id": 2101,
"lm_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, sets, packing",
"url": null
} |
equation of another plane with a tilted by 60 degree to the given plane and has the same intersection line given for the first plane. The distance between two parallel planes ax + by + cz + d 1 = 0 and ax + by + cz + d 2 = 0 is given by . Change the name (also URL address, possibly the category) of the page. The task is to write a program to find distance between these two Planes. See your article appearing on the GeeksforGeeks main page and help other Geeks. We can clearly understand that the point of intersection between the point and the line that passes through this point which is also normal to a planeis closest to our original point. We use cookies to ensure you have the best browsing experience on our website. Distance between two parallel Planes in 3-D. You are given two planes P1: a1 * x + b1 * y + c1 * z + d1 = 0 and P2: a2 * x + b2 * y + c2 * z + d2 = 0. 5x+4y+3z= 8 and 5x+4y+ 3z= 1 are two parallel planes. Find out what you can do. When we find that two planes are parallel, | {
"domain": "com.br",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9539660976007596,
"lm_q1q2_score": 0.8070004001563397,
"lm_q2_score": 0.8459424314825852,
"openwebmath_perplexity": 493.2718904415889,
"openwebmath_score": 0.478618860244751,
"tags": null,
"url": "http://www.laboratoriocitopar.com.br/steelton-products-axlrpk/distance-between-two-parallel-planes-in-3d-0b3737"
} |
seismology, waves, seismic, seismic-hazards
A figure, prepared by Professor Charles J. Ammon, shows the ranges of frequency and amplitude. Source here. The amplitude and period have a large range, that's why prefixes as milli or micro can be used and a logarithmic scale is used for amplitude.
In shallow active reflection seismic surveys, we sometimes can use frequencies up to maybe 200Hz, but in the range the penetration depth is very small. For very local events, e.g. in mines and infrastructure frequency range up to 500-1000Hz might be used.
Most energy for P and S waves used in teleseismics are in the range of a few Hertz and maybe up to 10-20Hz. | {
"domain": "earthscience.stackexchange",
"id": 866,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "seismology, waves, seismic, seismic-hazards",
"url": null
} |
# How is $\frac{1}{2n} \leq \sin (\frac{1}{n}) \leq \frac{1}{n}$
How is $\frac{1}{2n} \leq \sin (\frac{1}{n}) \leq \frac{1}{n}$
I know that $\sin \theta \leq \theta, \theta$ very small
But if take $f(x) = \sin (\frac{1}{x}) - \frac{1}{2x}, f'(x) = \frac{-1}{x^2} \cos (\frac{1}{x}) + \frac{1}{2x^2}$
But if i take $x=\frac 4\pi, x \in (0, \pi/2),$ i am getting $f'(x) < 0$ which should be other way around. Am I missing something? I got this doubt while reading Does $\sum_{n=1}^\infty(-1)^n \sin \left( \frac{1}{n} \right)$ absolutely converge?
If i say since $\sin (x)$ converges to $x$, i will have $\sin x$ values slightly less than $x$ and slightly more than $x$. But it depends on whether $f(x)$ is increasing/decreasing (local maxima or local minima)
Pls clarify | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9572777975782054,
"lm_q1q2_score": 0.8229370165832417,
"lm_q2_score": 0.8596637451167997,
"openwebmath_perplexity": 544.7842690102492,
"openwebmath_score": 0.9218793511390686,
"tags": null,
"url": "https://math.stackexchange.com/questions/2847594/how-is-frac12n-leq-sin-frac1n-leq-frac1n?noredirect=1"
} |
c#, game, console
newBallPosition
Would take a ball position, player positions and return a new position.
gameTick or newGameState
Would take player input as well as player positions and ball position and return new player positions and a new ball position.
Player input
This should be put in its own function and return the actions the players have taken, e.g. getPlayerInput.
Example
This is pseudocode just to show an example of the structure, it is not valid code in any language.
class GameState:
running, ball,
playerPosition1, playerPosition2 | {
"domain": "codereview.stackexchange",
"id": 42755,
"lm_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, console",
"url": null
} |
c#, performance, beginner, programming-challenge
var divisibles = GetDivisibles(2);
for (int i = 1; i < primes.Length; i++)
{
divisibles = JoinDivisibles(divisibles, GetDivisibles(primes[i]));
}
long sum = 0;
foreach (int divisible in divisibles)
{
for (long i = 1; i <= 9; i++)
{
long number = i * 1000000000 + divisible;
if (IsPandigital(number))
sum += number;
}
}
Console.WriteLine(sum); | {
"domain": "codereview.stackexchange",
"id": 19494,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, performance, beginner, programming-challenge",
"url": null
} |
array, swift, ios
Sum of [0, 3, 5, 6, 9, 10, 12, 15, 18, 20, 21, 24, 25, 27, 30, 33, 35, 36, 39, 40, 42, 45, 48, 50, 51, 54, 55, 57, 60, 63, 65, 66, 69, 70, 72, 75, 78, 80, 81, 84, 85, 87, 90, 93, 95, 96, 99, 100, 102, 105, 108, 110, 111, 114, 115, 117, 120, 123, 125, 126, 129, 130, 132, 135, 138, 140, 141, 144, 145, 147, 150, 153, 155] = 5633
Sum of [0, 3, 5, 6, 9, 10, 12, 15, 18, 20, 21, 24, 25, 27, 30, 33, 35, 36, 39, 40, 42, 45, 48, 50, 51, 54, 55, 57, 60, 63, 65, 66, 69, 70, 72, 75, 78, 80, 81, 84, 85, 87, 90, 93, 95, 96, 99, 100, 102, 105, 108, 110, 111, 114, 115, 117, 120, 123, 125, 126, 129, 130, 132, 135, 138, 140, 141, 144, 145, 147, 150, 153, 155, 156] = 5789
Sum of [0, 3, 5, 6, 9, 10, 12, 15, 18, 20, 21, 24, 25, 27, 30, 33, 35, 36, 39, 40, 42, 45, 48, 50, 51, 54, 55, 57, 60, 63, 65, 66, 69, 70, 72, 75, 78, 80, 81, 84, 85, 87, 90, 93, 95, 96, 99, 100, 102, 105, 108, 110, 111, 114, 115, 117, 120, 123, 125, 126, 129, 130, 132, 135, 138, 140, 141, 144, 145, 147, 150, 153, 155, 156, 159] = 5948 | {
"domain": "codereview.stackexchange",
"id": 43729,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "array, swift, ios",
"url": null
} |
quantum-gate, bloch-sphere
This may make is easier to find the correspondence. Let me put $\tilde\ $ over the entities from the first unitary in order to distinguish them.
Let's define $\tan(\beta)=\tan\frac{\alpha}{2}\cos\frac{\theta}{2}$. This is the phase of the first matrix element, so
$$
\cos\frac{\alpha}{2}-i\,\sin\frac{\alpha}{2}\,\cos\frac{\theta}{2}=e^{i\beta}\cos\frac{\tilde\theta}{2},
$$
where we're allowing equality between the two unitaries to be up to a global phase $e^{i(\gamma+\beta)}$. In other words,
$$
\cos^2\frac{\tilde\theta}{2}=\cos^2\frac{\alpha}{2}+\sin^2\frac{\alpha}{2}\cos^2\frac{\theta}{2}=\cos^2\frac{\alpha}{2}\sec^2\beta.
$$
For the off-diagonal entries, recall that a unitary matrix must have columns whose sum-mod-square must be 1. Thus, the off-diagonal entries must be $\sin\frac{\tilde\theta}{2}$ up to some phase which we have to fix. We need
$$
-\beta+\phi-\frac{\pi}{2}=\tilde\phi\qquad -\beta-\phi-\frac{\pi}{2}=\tilde\lambda+\pi,
$$ | {
"domain": "quantumcomputing.stackexchange",
"id": 4921,
"lm_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-gate, bloch-sphere",
"url": null
} |
documents = [doc_trump, doc_election, doc_putin]
In [70]:
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfVectorizer
def getMatrix(documents):
count_vectorizer = CountVectorizer(stop_words='english')
count_vectorizer = CountVectorizer() #TfidfVectorizer()#
sparse_matrix = count_vectorizer.fit_transform(documents)
doc_term_matrix = sparse_matrix.todense()
df = pd.DataFrame(doc_term_matrix,
columns=count_vectorizer.get_feature_names()
)
return df
In [71]:
matrix=getMatrix(documents)
matrix
Out[71]:
after as became by career claimed do earlier election elections ... the though to trump vladimir was who winning witchhunt with
0 1 0 1 0 0 0 0 0 1 0 ... 2 1 0 2 0 0 0 1 0 1
1 0 0 0 1 0 1 1 0 2 0 ... 2 0 1 1 0 1 1 0 1 1
2 0 1 1 0 1 0 0 1 0 1 ... 1 0 0 0 1 0 0 0 0 0
3 rows × 48 columns
In [72]:
from sklearn.metrics.pairwise import cosine_similarity
print(cosine_similarity(df, df)) | {
"domain": "jupyter.org",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9877587243478402,
"lm_q1q2_score": 0.8121244824334304,
"lm_q2_score": 0.8221891261650248,
"openwebmath_perplexity": 1393.201392972094,
"openwebmath_score": 0.5098704695701599,
"tags": null,
"url": "https://nbviewer.jupyter.org/url/cs.uwindsor.ca/~jlu/8380/8380_vector_space_model.ipynb"
} |
vba, excel
End If
Next
How is that working? You are declaring Z as an integer every loop - move that outside the For and just adjust its value. Also, your indenting isn't correct, each condition or loop should be on its own level starting on the left.
For
If Then
Do Until
'stuff
Loop
End If
Next
Now we can keep track of what's going on.
Lack of variables - Use Them!
Let's use some variables here that describe what's happening:
Dim summarySheet As Worksheet
Set summarySheet = ThisWorkbook.Sheets("Sheet1")
Dim currentAndUpcomingSheet As Worksheet
Set currentAndUpcomingSheet = ThisWorkbook.Worksheet("Current & Upcoming Projects")
Dim completedProjectSheet As Worksheet
Set completedProjectSheet = ThisWorkbook.Sheets("Completed Project Info")
Dim dataSheet As Worksheet
Set dataSheet = ThisWorkbook.Sheets("Data") | {
"domain": "codereview.stackexchange",
"id": 21547,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "vba, excel",
"url": null
} |
java, beginner, strings
while(correctName != true) {
System.out.print("Type your name: ");
String line = console.nextLine();
if(line.length() >= 5) {
StringTokenizer lineTokens = new StringTokenizer(line);
while(lineTokens.hasMoreTokens()) {
if(lineTokens.countTokens() >= 2) {
String first = lineTokens.nextToken();
String last = lineTokens.nextToken();
String name = (last + ", " + first.substring(0, 1) + ".");
System.out.println("Your name is: " + name);
correctName = true;
} else {
String checkSpace = lineTokens.nextToken();
for(int i = 0; i < checkSpace.length(); i++) {
if(checkSpace.charAt(i) == ' ') {
break;
} else {
System.out.println("Error, must be at least 5 chars with a space.");
break;
}
} | {
"domain": "codereview.stackexchange",
"id": 17320,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, beginner, strings",
"url": null
} |
classical-mechanics, differential-geometry, laws-of-physics
Ellipses, parabolas and hyperbolas are collectively known as conic sections, and they each have an equation of the form $\sum_{ij}A_{ij}y_iy_j + \sum_{i}B_iy_i + C = 0$ with $A$ a constant matrix, $\mathbf{B}$ a constant vector and $c$ a constant scalar. The ellipse-parabola-hyperbola distinction concerns whether $\det A$ is positive, zero or negative. We similarly subdivide differential equations of the form $\sum_{ij}A_{ij}\partial_i\partial_j y + \sum_{i}B_i\partial_i y + Cy + D = 0$, with all coefficients $y$-independent (though in general they can be functions of other variables $x^i$, viz. the notation $\partial_i :=\frac{\partial}{\partial x^i}$). Hence such equations can be elliptic, parabolic or hyperbolic. | {
"domain": "physics.stackexchange",
"id": 38791,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "classical-mechanics, differential-geometry, laws-of-physics",
"url": null
} |
python, infinite-impulse-response, transfer-function
plt.show() As you've seen in the linked answer the -3 dB point is given by the formula:
$$f_{-3\;\text{dB}}=\arccos\left(1-\dfrac{\alpha^2}{2-2\alpha}\right)=\arccos\left(1-\dfrac{2^{-8}}{2-2^{-3}}\right)=0.064561\cdot\dfrac{f_s}{\pi}=2055\;\text{Hz}$$
The formula given in the paper is wrong but, in fairness, I've seen it approximated in various ways, involving $2\pi$ or not. However, if you replace $f_s$ with $f_s/(2\pi)$ you do get close to the real number:
$$\dfrac{f_s}{2\pi}\cdot\dfrac{1}{2^{-M}-1}=\dfrac{2\cdot 10^5}{2\pi}\cdot\dfrac{1}{2^{-4}-1}=2122\;\text{Hz}$$
I haven't tested it further but, given the characteristic of the $\arccos(x)$ (with the above argument), the closer $x$ is to $1$, the closer the answer is to a slope at origin ($x$, itself). So, if the coefficient is $2^{-4}=0.0625$ then the value is $1-0.0625^2/(...)\approx 1$, and $\arccos(1)=0$. | {
"domain": "dsp.stackexchange",
"id": 11347,
"lm_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, infinite-impulse-response, transfer-function",
"url": null
} |
like a fan with a pivot at the points already processed, a new convex hull &... Dimensions whereas the divide-and-conquer algorithm has a low runtime constant in 2D '' ( 1998,! This works by viewing it as an incremental algorithm algorithm does not generalize 3D! Problems, k is a C++ '' implementation of Andrew 's algorithm is given below in chainHull_2D... Xmin and xmax with which it can be discarded by popping them off the stack z=x2+y project the 2D is!, push onto the stack ) { let PT1 = the second point on stack. To take its shape and conquer algorithm of a convex set that a. Ls-dyna Tutorial For Beginners, Kiss Instawave 101 Reviews, Broad Leaf Greens, Royalty Ledger Accounts, Candid Photography Poses, Osha 30 Certification, Input Field Design Css, Jungle Tiger Challenge, History Of Civil Engineering Timeline, Change Font In File Explorer Windows 10, Radishes All Tops No Bottoms, " /> 1 points p 1 (x 1, y 1), . 4th Int'l Joint Conf. Each point ⦠1). In this tutorial we will | {
"domain": "com.br",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.95598134762883,
"lm_q1q2_score": 0.874628239582888,
"lm_q2_score": 0.9149009462917594,
"openwebmath_perplexity": 854.4457365825215,
"openwebmath_score": 0.45257630944252014,
"tags": null,
"url": "https://www.nossaciencia.com.br/53mmr2m/0e6777-find-convex-hull-of-points-given-in-a-2d-plane"
} |
quantum-mechanics, orbital-motion, integration, coulombs-law, hydrogen
(*potential energy*)
PP2 = Integrate[Psi[r]*(-1/r)*Psi[r]*r^2, {r, 0, ∞}];
EE2 = KK2 + PP2(*energy in dimensionless units*)
Out[627]= -0.632157
EEE2 = EE2*E02/meV (*energy in meV*)
Out[628]= -1.94649 | {
"domain": "physics.stackexchange",
"id": 93442,
"lm_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, orbital-motion, integration, coulombs-law, hydrogen",
"url": null
} |
the Find the area bounded by the curve y = sin x and the x-axis, for 0 ≤ x ≤ 2π. Let f of x be a non-negative function on the interval ab. . Find the area bounded by the curve y = 3t2 and the t-axis between t = −3 and t = 3. If you have y1=A*sin(x) function compared to y2=1 function: your area would be 0 (because negative and positive part of sin function are the same) and compared to 1 is 0. 3. Areas under the x-axis will come out negative and areas above the x-axis will be positive. This holds true for any time sinx is evaluated with an integral across a domain where it is symmetrically above and below the x-axis. Trigonometric identities can often be used to get an integral into a form which is easy to evaluate. We will find the area under the curve cos(x) over the interval [-pi/2,pi/2]. 117094, given by this choice of x*i 's is an overestimate, by the sum of the areas of those triangle-like pieces. Find the area enclosed by the curve y = –x2 and the straight lilne x + y + 2 = 0. | {
"domain": "popping1204.site",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9825575173068325,
"lm_q1q2_score": 0.8250869244446827,
"lm_q2_score": 0.8397339696776499,
"openwebmath_perplexity": 349.75428318802983,
"openwebmath_score": 0.8734630346298218,
"tags": null,
"url": "https://dtawsw.popping1204.site/area-under-sine-curve.html"
} |
quantum-field-theory, conformal-field-theory, ising-model, critical-phenomena, integrable-systems
$$\cosh\frac{h_c(T)}{J}=\sinh^2\frac{2J}{T}$$
This relation also predicts that close to the Onsager point:
$$\left(\frac{h}{J}\right)^2=8\sqrt{2}\frac{T_c-T}{J}$$
which is exactly the result that I had in mind. In fact the same square root law for the critical curve is obtained for a bosonic field theory in 2-D with lagrangian
$$\mathcal{L}=\frac{m^2}{2}\phi^2+\frac{g}{3!}\phi^3+\frac{\lambda}{4!}\phi^4$$
where it can be seen that for small couplings $g,\lambda<<m^2$, a first order transition with the VEV of the fundamental field as the order parameter each time one crosses the line $(g/m^2)^2=3(\lambda/m^2)$ (interestingly, this happens to be the exact same formula coming from a mean field theory treatment for a coarse-grained field theory with maximum polynomial interaction of degree $4$).
Sources: | {
"domain": "physics.stackexchange",
"id": 84451,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-field-theory, conformal-field-theory, ising-model, critical-phenomena, integrable-systems",
"url": null
} |
machine-learning, convolutional-neural-network
Title: Is Maxout the same as max pooling? I've recently read about maxout in slides of a lecture and in the paper.
Is maxout the same as max pooling? They are almost identical:
The second key reason that maxout performs well is
that it improves the bagging style training phase of
dropout. Note that the arguments in section 7 motivating
the use of maxout also apply equally to rectified
linear units (Salinas & Abbott, 1996; Hahnloser, 1998;
Glorot et al., 2011). The only difference between maxout
and max pooling over a set of rectified linear units
is that maxout does not include a 0 in the max.
Source: Maxout Networks. | {
"domain": "datascience.stackexchange",
"id": 548,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "machine-learning, convolutional-neural-network",
"url": null
} |
c++, socket, server, client
Don't repeat yourself, not even in the error messages.
if (getSocketId() == 0)
{
throw std::logic_error(buildErrorMessage("DataSocket::getMessage: accept called on a bad socket object (this object was moved)"));
} | {
"domain": "codereview.stackexchange",
"id": 32434,
"lm_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++, socket, server, client",
"url": null
} |
homework-and-exercises, electrostatics
Title: Electric Field Lines between two non parallel plates A potential difference is applied between two metal plates that are not parallel.
Which diagram shows the electric field between the plates? | {
"domain": "physics.stackexchange",
"id": 8059,
"lm_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, electrostatics",
"url": null
} |
How is irrational exponent defined?
I am trying to understand the most significant jewel in mathematics - the Euler's formula. But first I try to re-catch my understanding of exponent function.
At the very beginning, exponent is used as a shorthand notion of multiplying several identical number together. For example, $5*5*5$ is noted as $5^3$. In this context, the exponent can only be $N$.
Then the exponent extends naturally to $0$, negative number, and fractions. These are easy to understand with just a little bit of reasoning. Thus the exponent extends to $Q$
Then it came to irrational number. I don't quite understand what an irrational exponent means? For example, how do we calculate the $5^{\sqrt{2}}$? Do we first get an approximate value of $\sqrt{2}$, say $1.414$. Then convert it to $\frac{1414}{1000}$. And then multiply 5 for 1414 times and then get the $1000^{th}$ root of the result?
Thanks to the replies so far. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9817357173731319,
"lm_q1q2_score": 0.8694560606493561,
"lm_q2_score": 0.885631484383387,
"openwebmath_perplexity": 287.95063053383217,
"openwebmath_score": 0.9064700603485107,
"tags": null,
"url": "https://math.stackexchange.com/questions/1992464/how-is-irrational-exponent-defined"
} |
aerodynamics
How do they move slowly in the air, without falling down?
Can this eagle flying technique be used in aviation? How does they move slowly in air, without falling down?
One possibility is soaring using a ridge lift - typically a situation when the wind is approx. perpendicular to a mountain ridge. The air is lifted at the front side of the ridge and an eagle can soar in the lifting air stream. This can also work without the wind,
Which is a situation of thermal flying. Typically, the ground is heated by the Sun, the air layer just above the ground is heated by conduction and at some moment it forms a kind of bubble that starts to rise. This bubble is usually long, resembling a column and lasts until the warm air is depleted. The situation can repeat (this behavior is called an interval). If a ridge is oriented south, then the Sun can create a thermal wind (intervals) that enables a bird to soar.
Can we use eagle's flying technic for flights? Yes, however, man will never be that good. | {
"domain": "physics.stackexchange",
"id": 21980,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "aerodynamics",
"url": null
} |
ros, turtlebot, nav2d, ros-indigo
Thanks for taking time to help me.
Tried on a obstacle free environment and after moving to different positions, still having the same problem.
Comment by Sebastian Kasperski on 2015-10-23:
Just for completeness; I assume you are using the default exploration strategy (nearest frontier). Can you try the other strategies by setting the "exploration_strategy" in navigator.yaml to "MultiWavefrontPlanner" or "MinPosPlanner"?
Comment by Swan Baigne on 2015-10-23:
Tried to change the strategy, and same results again.
Comment by Sebastian Kasperski on 2015-10-23:
As I expected, the decision whether exploration is finished should be equal among all strategies. Have you build nav2d from source or installed the binaries? Does the exploration work if you run tutorial3?
Comment by Swan Baigne on 2015-10-23:
I am currently using nav2d installed from apt-get, with a modified .launch file based on tutorial3.launch | {
"domain": "robotics.stackexchange",
"id": 22804,
"lm_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, turtlebot, nav2d, ros-indigo",
"url": null
} |
what they pay you if Alpha wins, otherwise nothing. Are you making a mistake? Assuming you don’t want to hold the risk of that bet, the question is really “for each$1 your friend gives you, can you place it on the individual games with the bookies such that at the end, you get $2 if Alpha takes the entire series, and nothing otherwise?” The series structure can be drawn like this.11 The white nodes represent games, and the score in the node is the record of wins to each team before the game starts. The black nodes indicate that a winner is determined and no more games are played, and the series result is indicated in the node. In the outcomes represented by the two top black nodes, we need to be in possession of$2, and in the bottom two nodes, nothing. For clarity, let’s add this information to the graph. | {
"domain": "two-wrongs.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9817357232512719,
"lm_q1q2_score": 0.8116125031680713,
"lm_q2_score": 0.8267117962054049,
"openwebmath_perplexity": 603.3867677020854,
"openwebmath_score": 0.6063733100891113,
"tags": null,
"url": "https://two-wrongs.com/unreasonable-effectiveness-of-conditional-probabilities.html"
} |
python, combinatorics, opencv
max_column = max(self.Abacus)
max_index = self.Abacus.index(max_column)
self.doCount(max_index)
def Enumerate(self, index = -1):
container = []
if (index < 0) or (index > self.Counter - 1):
for state in self.States:
container.append(state)
return container
else:
return self.States[index]
For the completeness sake, this class will be called here. I don't have cv2 installed (yet) so I'm going blind here, but I have a few comments. First, the problem you described can be solved very easily with itertools.product:
import itertools
def get_set_intersections(chars="+-", base=2):
numbers = range(1, base+1)
for signs in itertools.product(chars, repeat=base):
yield "".join("{}{}".format(sign, n) for sign, n in zip(signs, numbers))
list(get_set_intersections())
#>>> ['+1+2', '+1-2', '-1+2', '-1-2'] | {
"domain": "codereview.stackexchange",
"id": 11460,
"lm_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, combinatorics, opencv",
"url": null
} |
programming, circuit-construction, stim
if (backwards_compat && stim::GATE_DATA.at(gate_name).arg_count == 1) {
// If the gate expects exactly one argument but none provided, use a default value.
if (args.empty()) {
self.safe_append_ua(gate_name, targets, 0.0);
} else if (args.size() == 1) {
self.safe_append_ua(gate_name, targets, args[0]);
} else {
throw std::invalid_argument("Gate expects exactly one argument.");
}
} else {
// For gates that do not specifically require backwards compatibility handling or
// can accept multiple arguments.
if (args.size() == 1) {
// If only one argument is provided, you could still use safe_append_ua for consistency.
self.safe_append_ua(gate_name, targets, args[0]);
} else {
// Use safe_append_u for gates with multiple arguments or no arguments at all. | {
"domain": "quantumcomputing.stackexchange",
"id": 5588,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "programming, circuit-construction, stim",
"url": null
} |
geomagnetism
Now trace a line across North America in such a way as to intersect the magnetic lines at locations where they are perpendicular to true north. You should end up tracing out the green line in the image posted in the question.
Read on if that sounded confusing: Instead, find and circle the points on the lines in the map of the Earth's magnetic field where the curve of the line is perpendicular to an imaginary line drawn from the true North Poll to that point. When done, the points should all be on the green lines in the map in the posted question above. | {
"domain": "earthscience.stackexchange",
"id": 2686,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "geomagnetism",
"url": null
} |
c++, beginner, c++11, curses, tetris
curs_set(FALSE);
raw();
noecho();
nodelay(stdscr, TRUE);
game.matrix_init();
while (!game.isGameOver()) {
bool can_create_block = false;
can_create_block = game.get_last_block().move_down();
if (can_create_block) {
game.destroy();
game.create_block();
}
game.controls();
napms(game.getSpeed());
if (game.getSpeed() < DEFAULT_SPEED)
game.setSpeed(DEFAULT_SPEED);
game.draw();
game.gameOverChecker();
}
endwin();
return 0;
}
cCoord.h
#ifndef TETRIS_CCOORD_H
#define TETRIS_CCOORD_H
#define MAX_COORDINATES 4
class cCoord {
private:
int x,
y;
public:
// Getter functions
int get_x() const;
int get_y() const;
// Setter functions
cCoord set_x(int a);
cCoord set_y(int b);
cCoord(int a, int b) : x(a), y(b) {};
cCoord() = default;
~cCoord() = default;
};
#endif //TETRIS_CCOORD_H | {
"domain": "codereview.stackexchange",
"id": 23451,
"lm_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, c++11, curses, tetris",
"url": null
} |
integrand <- function(x) pnorm((adaptedZ - rho * x) / sqrt(1 - rho * rho)) * dnorm(x)
# 0.0121, abs.error 1.348036e-16, "OK" | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.98228770337066,
"lm_q1q2_score": 0.8585953166765454,
"lm_q2_score": 0.8740772318846386,
"openwebmath_perplexity": 3720.9475415620254,
"openwebmath_score": 0.7470393776893616,
"tags": null,
"url": "https://stats.stackexchange.com/questions/213456/how-to-calculate-the-total-probability-inside-a-slice-of-a-bivariate-normal-dist"
} |
ros, ros2, rclcpp, dds
Title: [ROS2][rclcpp][services] Service not being created
I am attempting to write a ROS2 SetBool Service.
I am getting no compile-time errors, and I am getting to a logger message that is placed after I call the create_service method.
Even after this, the service is not advertised when I call ros2 service list.
I am on Ubuntu 20.04, Foxy, x86
(don't think that is relevant).
The constructor / destructor:
// Minimal Example
#include <memory.h>
#include "my_test_robot/main.hpp"
#include "rclcpp/rclcpp.hpp"
#include "std_srvs/srv/set_bool.hpp"
MinimalExampleNode::MinimalExampleNode()
: Node("minimal_example_node")
{
rclcpp::Service<std_srvs::srv::SetBool>::SharedPtr set_bool_service_ =
this->create_service<std_srvs::srv::SetBool>(
"set_bool",
std::bind(&MinimalExampleNode::setBoolServiceCallback,
this,
std::placeholders::_1,
std::placeholders::_2,
std::placeholders::_3));
RCLCPP_INFO(this->get_logger(), "Service ready");
} | {
"domain": "robotics.stackexchange",
"id": 35895,
"lm_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, ros2, rclcpp, dds",
"url": null
} |
classification, tensorflow, keras
Title: Classifying with certainty I'm trying to classify a binary sample with Keras and I would like to classify as many correctly as possible, while ignore the ones where the model is not sure.
The fully connected Nerual network currencly achieves around 65% but I would like to get a higher result of correctly classified ones, while ignoring the ones where the model is uncertain.
Is there a way to tell Keras to simply ignore the ones where the model is uncertain and achieve a higher accuracy that way? Or is there a network design that could achieve this, for example feeding the result of the network striaght into a second part of it which then decides whether the prediction is likely accurate or not? | {
"domain": "datascience.stackexchange",
"id": 11903,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "classification, tensorflow, keras",
"url": null
} |
javascript, json
Title: Loading a pseudo-class instance from JSON Is there a better way to do this?
function Person(name)
{
this._type='Person';
this.name=name;
this.hello = function(){
alert('Hello '+this.name);
};
}
function object_to_instance(key, value)
{
if (!value.hasOwnProperty('_type'))
return value;
var obj= eval('new '+value._type+'()');
for (var property in value)
obj[property]=value[property];
return obj;
}
var people = [new Person('Harry'), new Person('Sally')];
var people_json = JSON.stringify(people); | {
"domain": "codereview.stackexchange",
"id": 1719,
"lm_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, json",
"url": null
} |
file-system, shell, embedded, sh
process_image "Main Background:" "$SRCDIR"/New_Main.png "$WORKDIR"/Main cp_main
cp_help() {
IMAGE=$1; shift
DIR=$1; shift
cp "$IMAGE" "$DIR"/Help_Page.png
cp "$IMAGE" "$DIR"/Help_Page2.png
# ... and so on ...
}
process_image "Help Pages:" "$SRCDIR"/New_Help.png "$WORKDIR"/Help cp_help
... but this risks the script becoming too cryptic. At some point you have to draw the line and find the right balance between optimization and overengineering. | {
"domain": "codereview.stackexchange",
"id": 7769,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "file-system, shell, embedded, sh",
"url": null
} |
atoms
1 gram atom means 1 mole of atoms
1 gram molecule means 1 mole of molecules
1 gram ion means 1 mole of ions.
Similarly,
2 gram atom means 2 moles of atoms.
So, this is the name of mole.
3rd answer :
Gram atoms are exactly Total number of atoms present in one mole of a given covalent substance.
Gram molecules are total number of molecules in one mole of given substance.
Gram ions are total number of ions present in one mole of given ionic substance.
Eg - 1 mole of $\ce{NaCl}$ is 1 gram of molecules of $\ce{NaCl}$ and 2 grams of ions of $\ce{NaCl}$.
mole of $\ce{MgBr2}$ is 1 gram molecules of $\ce{MgBr2}$ and 3 grams of atoms of $\ce{MgBr2}$. The gram-atom is a very old terminology (mainly historical now). When you express the atomic weight of an element or a molecular weight in grams, it was called gram-atom or gram-molecule. Note the hyphen. Your second and third quoted answers are quite wrong.
As a corollary, 1 gram-atom or 1 gram-molecule contain the same number of particles. | {
"domain": "chemistry.stackexchange",
"id": 15999,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "atoms",
"url": null
} |
c#, unit-testing
Dependency injection will allow you to inject mock or fake versions of the other classes you are dependent on.
Mocking/Stubbing/Faking/Test Doubles: Your unit tests should test only one thing, not all the things that one this is dependent on (they have their own tests). This allows you to localise (as in know the location of) any errors that show up. You can write your own stubs, but there are great libraries out there, and using them introduces a bit more consistency about how your tests work/look. NSubstitute is a good choice becuase it uses extension methods to be really easy to read. | {
"domain": "codereview.stackexchange",
"id": 724,
"lm_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",
"url": null
} |
c++, c++17, template-meta-programming, stl, doxygen
* This function does not participate in overload resolution
* unless `std::is_default_constructible_v<T>`.
*
* @return An iterator that points to the first element
* inserted, or `end()` if `n == 0`.
* @param n The number of elements to insert. Can be zero.
*/
template <typename..., typename U = T, REQUIRES(std::is_default_constructible_v<U>)>
iterator insert_back(size_type n)
{
ensure_space(n);
return insert_back_unchecked(n);
}
/**
* @brief Extended functionality. Inserts `n` copies of
* `value` at the end of the vector.
*
* If `max_size() - size() < n`, throws an exception of type
* `std::length_error`. Otherwise, effectively calls
* `std::uninitialized_fill_n` to construct the elements.
*
* This function does not participate in overload resolution | {
"domain": "codereview.stackexchange",
"id": 35777,
"lm_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, template-meta-programming, stl, doxygen",
"url": null
} |
We probably wouldn't want to use this method for degrees higher than this, as the algebra would become more difficult to resolve. The techniques described by the other posters are far more generally used.
-
Hmm I guess I made a mistake somewhere when using this method. Thank you for clearing things up! – RXY15 Feb 14 '14 at 2:02
Taking the absolute value of both sides: $|z^3| = |i|$, gives $|z| = 1$. So, $z = \cos (\theta) + i \sin (\theta)$ for some real $\theta$.
Using De Moivre's formula gives $z^3 = \cos(3\theta) + i \sin(3\theta)$. Given that $z^3 = i = 0 + 1i$, this means that $\cos(3\theta) = 0$ and $\sin(3\theta) = 1$. Solving this system gives $3\theta = \frac{\pi}{2} + 2\pi n$, or $\theta = \frac{\pi}{6} + \frac{2 \pi n}{3}$, for any $n \in \mathbb{Z}$.
Plugging in a few values for $n$ gives: | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9925393567567455,
"lm_q1q2_score": 0.84362984960701,
"lm_q2_score": 0.8499711813581708,
"openwebmath_perplexity": 172.53281230381657,
"openwebmath_score": 0.919531524181366,
"tags": null,
"url": "http://math.stackexchange.com/questions/674621/how-can-you-find-the-cubed-roots-of-i?answertab=active"
} |
Doesn't that make a difference or am I being stupid?
BTW I did a simulation and found it to be about half-way between the two theoretical values using sqrt(6) and your sqrt(3)!!!
• No - it is not a "mistake". The only advantage of CR high pass stages is that you don´t need a buffer for decoupling of the inverting amplifier (the first series resistor of the inverter can act as a load for the last CR section). And - of course - both alternatives (RC lowpass or CR high pass sections) work at a frequency which gives -60 deg phase shift.
– LvW
Apr 22, 2014 at 14:32 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9496693688269985,
"lm_q1q2_score": 0.8052890077086622,
"lm_q2_score": 0.8479677602988602,
"openwebmath_perplexity": 705.1326392470736,
"openwebmath_score": 0.7252331972122192,
"tags": null,
"url": "https://electronics.stackexchange.com/questions/107496/deriving-the-formula-of-oscillation-frequency-for-the-phase-shift-oscillator"
} |
coordinate system can be derived from the basic definition of the divergence. This article discusses the representation of the Gradient Operator in different coordinate systems i. Vectors are defined in cylindrical coordinates by (ρ, φ, z), where. Here we look at the latter case, where cylindrical coordinates are the natural choice. A very common case is axisymmetric flow with the assumption of no tangential velocity ($$u_{\theta}=0$$), and the remaining quantities are independent of $$\theta$$. position, velocity, and acceleration. As another example of a simple use of the Lagrangian formulation of Newtonian mechanics, we find the equations of motion of a particle in rotating polar coordinates, with a conservative "central" (radial) force acting on it. 2 Question of the Day A particle moves in a circular path of radius r = 0. We develop specifically a Coulomb collision operator in cylindrical velocity coordinates, which are the convenient or natural choice for many acceleration | {
"domain": "daisytale.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9891815519849906,
"lm_q1q2_score": 0.8177680555031247,
"lm_q2_score": 0.8267117940706734,
"openwebmath_perplexity": 603.2376859278611,
"openwebmath_score": 0.8972199559211731,
"tags": null,
"url": "http://daisytale.it/qiyn/velocity-in-cylindrical-coordinates.html"
} |
quantum-mechanics, photons, wavefunction, scattering
\eqref{eq:Schrod}, tells us that those superpositions of solutions, namely sums (or integrals) are also solutions to it. This superpositions are what is known as wave packages. Mathematically they should look something like | {
"domain": "physics.stackexchange",
"id": 48597,
"lm_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, photons, wavefunction, scattering",
"url": null
} |
\begin{align}\displaystyle \lim_{n \to \infty}\left(\begin{matrix} 1&\dfrac{a}{n}\\\dfrac{-a}{n}&1\end{matrix}\right)^{\left(\begin{smallmatrix} n &0\\ 0&n \end{smallmatrix}\right)} &\equiv \displaystyle \lim_{n \to \infty}\color{red}{\left(1+\dfrac{ai}{n}\right)^n} \\&= \left(\begin{matrix} \cos a&\sin a\\-\sin a&\cos a\end{matrix}\right).\end{align}
Application 3:
$$\displaystyle\left(\begin{smallmatrix} 1 &1\\ -1&1\end{smallmatrix}\right)^\left(\begin{smallmatrix} 0 &1\\ -1&0 \end{smallmatrix}\right)\equiv (1+i)^i = \left(\sqrt{2}e^{i\frac{\pi}{4}}\right)^i = (\sqrt{2})^ie^{-\frac{\pi}{4}}\\\equiv \displaystyle\left(\begin{smallmatrix} e^{-\frac{\pi}{4}} \cos\log \sqrt{2} &e^{-\frac{\pi}{4}}\sin\log \sqrt{2}\\ -e^{-\frac{\pi}{4}}\sin\log \sqrt{2}&e^{-\frac{\pi}{4}}\cos\log \sqrt{2}&\end{smallmatrix}\right)$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9793540710685614,
"lm_q1q2_score": 0.8029658806789023,
"lm_q2_score": 0.819893340314393,
"openwebmath_perplexity": 285.1660720172342,
"openwebmath_score": 0.9484460949897766,
"tags": null,
"url": "https://math.stackexchange.com/questions/164422/matrix-raised-to-a-matrix-mn-is-this-possible-with-m-n-in-m-n-bbb-k"
} |
c#
Logger.Info(period + " ROP Avg calculated.");
return ropAvg;
}
/// <summary>
/// Pump Strokes
/// </summary>
/// <param name="pump">Int: Pump being evaluated</param>
/// <param name="drillingHours">Double: Drilling hours for the day</param>
/// <param name="period">Enum: Period of time</param>
/// <param name="timeFrame">Bool: If the calculation is for a specific time frame</param>
/// <returns>Double: Pump Strokes</returns>
public double PumpStrokes(int pump, double drillingHours, TimePeriod period = TimePeriod.Daily, bool timeFrame = false)
{
Logger.Info("Calculating Pump strokes...");
string query; | {
"domain": "codereview.stackexchange",
"id": 3652,
"lm_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
} |
c++, memory-optimization
buf += linesize;
bufsize -= linesize - post; // Advance to next line, avoiding wrapping
pre = 0; // No pre-buffer area after first line
}
About printing pointers
I can think of use cases where you'd want to see the pointers as decimal values, possibly even just offsets from the start of the data instead of absolute values. Perhaps this could be made configurable?
Make bufsize_ const
Just as buffer_ is const, you can make bufsize_ const as well.
Implications of using a class instead of a function
Using a class that has an operator<<() overload is a way to get relatively optimized output to an std::ostream, but there are some consequences. First, the class holds references to the data that is to be printed, and there is no guarantee that the data will be valid at the time you actually print it. For example, I could write:
hd bad_hd() {
int i = 0xbad;
return hd(&i, sizeof i);
}
...
std::cout << bad_hd(); // UB | {
"domain": "codereview.stackexchange",
"id": 37157,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, memory-optimization",
"url": null
} |
turing-machines, decidability, halting-problem, undecidability, universal-turing-machines
Figure 12.3 Turing Machine Ĥ
Can the correct simulation of ⟨Ĥ⟩ ⟨Ĥ⟩ by embedded_H possibly transition to ⟨Ĥ⟩.qn ?
Linz, Peter 1990. An Introduction to Formal Languages and Automata. Lexington/Toronto: D. C. Heath and Company. (318-320) The center state is called embedded_H because the Linz text explains that that Ĥ is created entirely from prepending and appending states to the original Linz H. The Linz notation has been simplified. The notation refers to the definition of Ĥ near that bottom of the Linz proof shown above.
Ĥ.q0 ⟨Ĥ⟩ ⊢* embedded_H ⟨Ĥ⟩ ⟨Ĥ⟩ ⊢* Ĥ.qy ∞
Ĥ.q0 ⟨Ĥ⟩ ⊢* embedded_H ⟨Ĥ⟩ ⟨Ĥ⟩ ⊢* Ĥ.qn
When Ĥ is applied to ⟨Ĥ⟩ it copies its input and then transitions to the the start state of the original Linz H. Because embedded_H is a simulating halt decider the first thing that it does is simulate ⟨Ĥ⟩ applied to ⟨Ĥ⟩.
We can see that this would repeat in an endless cycle unless embedded_H (shown at qx) sees this repeating pattern and aborts its simulation. | {
"domain": "cstheory.stackexchange",
"id": 5347,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "turing-machines, decidability, halting-problem, undecidability, universal-turing-machines",
"url": null
} |
Given a point $P=\left(\frac{y^2}2,y\right)$ of your parabola, consider the line segment joining $P$ to $C=\left(\frac32,0\right)$. The slope of this line segment is $\frac{2y}{y^2-3}$. And the slope of the tangent to the parabola at $P$ is $\frac1y$. Since two lines are orthogonal if and only if one of them is horizontal and the other one is vertical or when the product of their slopes is $-1$, these lines are orthogonal if and only if $y=0$ or $\frac2{y^2-3}=-1$, which means that $y=0$ or that $y=\pm1$. Forget $0$: that's a local maximum. So, the distance from the parabola to $C$ is$$\left\|\left(\frac12,1\right)-\left(\frac32,0\right)\right\|=\sqrt2.$$
• +1 for picture. – Matthew Leingang Jun 11 '18 at 12:28
• @MatthewLeingang Also for the answer :-) – Sebastiano Oct 6 '20 at 22:38 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9790357542883923,
"lm_q1q2_score": 0.8262034821135036,
"lm_q2_score": 0.843895106480586,
"openwebmath_perplexity": 176.8516805152871,
"openwebmath_score": 0.9972216486930847,
"tags": null,
"url": "https://math.stackexchange.com/questions/2815493/shortest-distance-between-parabola-and-point"
} |
orbit, observational-astronomy, rotation, asteroids
Title: What is the largest object on which the Yarkovsky effect has been observed? The Yarkovsky effect is responsible for changes in the rotation and orbit of some celestial bodies, most notably asteroids. It has been measured on asteroids, such as 6489 Golevka and 1999 RQ36.
What is the largest object on which the Yarkovsky effect has been observed? Scholarpedia has an excellent article and list of asteroids, but the list isn't necessarily complete, and I don't know if the effect has been detected on other (non-asteroid) bodies. According to Vokrouhlicky et al. 2015 Yarkovsky forces can be measured for small bodies with diameters up to 30-40 km. The largest object they have in their list of Yarkovsky detections is 4179 Toutatis with a diameter of (only) 2.8 km. I am not aware if Yarkovsky forces have been measured on anything larger than asteroids. | {
"domain": "astronomy.stackexchange",
"id": 883,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "orbit, observational-astronomy, rotation, asteroids",
"url": null
} |
x^ { n } our teams focus is residential, multi-family, &! Root of 5x^2 + 2 as... ( 5x^2 + 2 as... ( 5x^2 + as. The base and multiply it by the formula above 2.7: extended power Natural! > stream x��VMo1��W�L�|_�Pυ���6�EU�p���s & ���TBU������ # �֑H�����Z����l��g�l����1 y+ got a c or first. View Notes - calc Notes 4 from MTH 1220C at St. John 's University we just... And coordinate with local utility companies to insure step by step procedures exponent, it be! Extended to the sum rule tells us that the derivative of a sum of any number of functions the... G are both differentiable, then the sum rule tells us that derivative! Power Rules in combination with the expanded power rule for differentiating x^ { n } we. > stream x��VMo1��W�L�|_�Pυ���6�EU�p���s & ���TBU������ # �֑H�����Z����l��g�l����1 y+ differentiating x^ { n.! Chain rule power Rules in combination with the step-by-step explanations Uploaded by monika090 the textbook paint needed to a... Feedback page which is the derivative of | {
"domain": "rpics.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9658995733060718,
"lm_q1q2_score": 0.8090567730068117,
"lm_q2_score": 0.8376199714402812,
"openwebmath_perplexity": 1401.4262520202064,
"openwebmath_score": 0.6466473340988159,
"tags": null,
"url": "https://rpics.com/gj2xrr/ccbd03-extended-power-rule"
} |
c#, performance, beginner, error-handling, tcp
public bool Send(string sendString)
{
try
{
bool successFlag = false;
lock (syncLock)
{
try
{
client.Client.Send(ASCIIEncoding.ASCII.GetBytes(sendString));
successFlag = true;
}
catch { }
}
return successFlag;
}
catch
{
return false;
}
}
public string GetReceivedString()
{
try
{
string returnString = ""; | {
"domain": "codereview.stackexchange",
"id": 35487,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, performance, beginner, error-handling, tcp",
"url": null
} |
Finally, then, S(2n)=S(2n-1)+S(n).
Check it on the example: S(6) = S(5) + S(3) = S(4) + S(2) = …
What I’m now wondering is: what is the asymptotic growth of S(n)? I.e., is there a simple function f such that S(n) is “big oh” of f?
3. Jason Dyer says:
For question #2, I have a way of expressing all the ways of counting as a tree.
Turn the number n into a binary form. Let k be the number of digits. You are going to have a tree with k layers; label each layer of the tree with the digits from n. For example, 109=1101101 so the layers would be 1, 0, 1, 1, 0, 1, 1.
What we’re imagining is adding two binary numbers together.
We will be working from right to left, imagining we are in a state of “carry” (carrying 1) or “not carry” (no carry of 1).
Start at the top of the tree with a node labelled “not carry”.
When the layer currently at is a 1, if the state is “not carry” the node will go to the next level without a split, and the state of the next node is “not carry”. (1 + 0 = 1) | {
"domain": "mathlesstraveled.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9770226347732858,
"lm_q1q2_score": 0.8304410793788483,
"lm_q2_score": 0.8499711775577736,
"openwebmath_perplexity": 531.8651181484752,
"openwebmath_score": 0.6981237530708313,
"tags": null,
"url": "https://mathlesstraveled.com/2008/04/18/challenge-12-sums-of-powers-of-two/"
} |
data-structures, binary-trees, combinatorics, graphs, proof-techniques
As an exercise, you can use the same technique to prove the following statements:
Every perfect binary tree of height $h$ has $2^h-1$ nodes.
Every full binary tree has an odd number of nodes. | {
"domain": "cs.stackexchange",
"id": 93,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "data-structures, binary-trees, combinatorics, graphs, proof-techniques",
"url": null
} |
Suppose $f:\mathbb R\to\mathbb R$ is a continuous function. Let $x\in\mathbb R$. Then there is a sequence of rational numbers $(q_n)_{n=1}^\infty$ that converges to $x$. Continuity of $f$ means that $$\lim_{n\to\infty}f(q_n) = f(\lim_{n\to\infty}q_n)=f(x).$$ This means that the values of $f$ at rational numbers already determine $f$. In other words, the mapping $\Phi:C(\mathbb R,\mathbb R)\to \mathbb R^{\mathbb Q}$, defined by $\Phi(f)=f|_{\mathbb Q}$, where $f|_{\mathbb Q}:\mathbb Q\to\mathbb R$ is the restriction of $f$ to $\mathbb Q$, is an injection. (Which implies that $|C(\mathbb R,\mathbb R)|<|\mathbb R^{\mathbb Q}|$). Here, $C(\mathbb R,\mathbb R)$ denotes the set of all continuous functions from $\mathbb R$ to $\mathbb R$, as usual.
Now, cardinal arithmetic tells us that $|\mathbb R^{\mathbb Q}| = (2^{\aleph_0})^{\aleph_0} = 2^{\aleph_0\cdot\aleph_0}=2^{\aleph_0}=|\mathbb R|$. (Namely, $(a^b)^c=a^{b\cdot c}$ holds for cardinal numbers.) | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.979354065042628,
"lm_q1q2_score": 0.8455660812302669,
"lm_q2_score": 0.8633916082162402,
"openwebmath_perplexity": 114.54577447459945,
"openwebmath_score": 0.9183537364006042,
"tags": null,
"url": "https://math.stackexchange.com/questions/477/cardinality-of-set-of-real-continuous-functions/479"
} |
Code:
\<< DUP { 30 * FACTORS REVLIST 1 5 SUB LIST\-> ROLLD DROP2 DROP MAX 1 - } IFT \>>
Slightly slower than your original method, and still just parses the FACTORS list to get the needed values. It is a bit smaller, though. Could be even shorter if 0 doesn't need to be considered for input. | {
"domain": "hpmuseum.org",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9626731158685837,
"lm_q1q2_score": 0.8311638998479365,
"lm_q2_score": 0.8633916187614823,
"openwebmath_perplexity": 1946.6274603373047,
"openwebmath_score": 0.45099034905433655,
"tags": null,
"url": "https://www.hpmuseum.org/forum/thread-9955.html"
} |
Looking at this I believe it is a conservation of energy problem. We have the Initial energy is equal to energy final - energy lost through friction.
So, Initial Energy is
$$E_i = \frac 1 2 kx^2$$
Then our final Energy is simple $MGH$ since at it's max height it stops and all energy is potential again.
So $MGH = \frac 1 2 kx^2 - \text{Friction}$
and this is where I get confused. I'm not to sure how I calculate the energy loss of friction.
I believe it is the work friction does is equal to energy loss.
So that would $W=FD$ distance is $D_2$ and the force would be $CMG$ since the normal force is equal to gravity on the flat surface. Am I correct in this?
$$H = \frac{(1/2kx^2)-(CMGD_2)}{MG}$$
Which simplifies down to:
$$H=\frac{1/2kx^2}{MG} - (CD_2)$$
This also confuses me, if my above calculations are correct, then the amound of energy loss due to friction does not depend on the mass of the object? | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9867771774699746,
"lm_q1q2_score": 0.8044528148245876,
"lm_q2_score": 0.815232489352,
"openwebmath_perplexity": 322.7749965399639,
"openwebmath_score": 0.7384679913520813,
"tags": null,
"url": "http://physics.stackexchange.com/questions/81847/finding-max-height-of-a-mass-launched-by-a-spring"
} |
data-structures, time-complexity, heaps, subsequences
It is a data structure which is used to operate over a range of input.
How does it work?
The original elements of the array form the leaves of the tree. Each internal node represents some merging of the sub trees. For example consider the array $A = [1,5,7,8,9,15]$.
If we were to construct a segment tree out of the array with the sum operation in mind, we would have the following tree.
What about the run time complexity?
If we try to implement the $Sum(i,j)$ and $Change(i,x)$ operations via a segment tree, the time complexity would be the following:
Construction of the Segment Tree: This would take $O(n)$ time.
$Sum(i,j)$ : This would take $O(\log(n))$ time.
$Change(i,x)$ : This would take $O(\log(n))$ time.
What about the space complexity?
Being an almost complete binary tree, a Segment tree with $n$ leaf nodes will have $2n — 1$ total nodes. Hence the space complexity will be $O(n)$. | {
"domain": "cs.stackexchange",
"id": 10769,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "data-structures, time-complexity, heaps, subsequences",
"url": null
} |
ros, urdf, openrave, collada-urdf
Originally posted by Stefan Kohlbrecher on ROS Answers with karma: 24361 on 2012-08-08
Post score: 1
I'm on the same project as Stefan, but I have far less experience with ROS and OpenRAVE. From Rosen's response, I now know that the COLLADA model that was generated does in fact include the mimic tags properly, and when I run
openrave-robot.py newarmdae.dae --info joints
I get the same output that Rosen's second response displays. 5 DOF arm, one fixed joint, two mimic joints.
IKfast apparently doesn't support mimic joints. I unfortunately do not have experience generating inverse kinematics with anything besides IKfast, and I'm not sure what other methods there are to choose from. Here are the steps I am using to generate IK after I generate the COLLADA model and create the OpenRAVE scene description; would anybody tell me what I need to change or what different steps I need to follow to generate IK with the mimic tags included?
roscd openrave/bin | {
"domain": "robotics.stackexchange",
"id": 10538,
"lm_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, urdf, openrave, collada-urdf",
"url": null
} |
The Minkowski distance or Minkowski metric is a metric in a normed vector space which can be considered as a generalization of both the Euclidean distance and the Manhattan distance.It is named after the German mathematician Hermann Minkowski. Find distance similarity between two objects arbitrary p, minkowski_distance ( l_p ) used... The value of distance criteria to choose distance while building a K-NN model valid here with the minkowski is... This distance closer the two objects Pros and Cons of KNN use to test knowledge! Depending on the chosen distance metric to use for the tree are few. That we need to tune to get an optimal result as a result the... L2 ) for p = 1, this is equivalent to the Euclidean! Any method valid for the tree be specified with the minkowski distance is a general metric for distance! Use the p norm as the distance metric to use for the tree and Cons of KNN to tune get. Is equivalent to using manhattan_distance ( l1 ), and with p=2 is to. Default= ’ | {
"domain": "com.br",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9830850827686584,
"lm_q1q2_score": 0.8170843319963884,
"lm_q2_score": 0.8311430478583168,
"openwebmath_perplexity": 839.0046071311169,
"openwebmath_score": 0.8868896961212158,
"tags": null,
"url": "http://stadiumsports.com.br/3f19qms/89731f-minkowski-distance-knn"
} |
Again, taking the limit doesn't tell you anything about an oblique asymptote. It merely tells you the gross behavior of the rational function as x gets large or as x gets very negative.
If the degree of the numerator is one more than the degree of the denominator, then there will be an oblique asymptote. To find it, do polynomial long division to write the as a linear part and a proper rational function. IOW, as $L(x) + \frac{p(x)}{q(x)}$. Here L(x) = ax + b for some constants a and b, and the degree of p < degree of q.
6. Oct 28, 2014 | {
"domain": "physicsforums.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9621075711974104,
"lm_q1q2_score": 0.8119178712414166,
"lm_q2_score": 0.843895106480586,
"openwebmath_perplexity": 268.24936877809006,
"openwebmath_score": 0.8874718546867371,
"tags": null,
"url": "https://www.physicsforums.com/threads/limit-algebraic-manipulation-of-rational-function.778571/"
} |
w ( k ) = { 2 ( k − 1 ) n − 1 , 1 ≤ k ≤ n 2 2 ( n − k ) n − 1 , n 2 ≤ k ≤ n w(k)=\begin{cases} \frac{2(k-1)}{n-1},&\text{$1\leq k\leq \frac{n}{2}$}\\ \frac{2(n-k)}{n-1},&\text{$\frac{n}{2} \leq k \leq n$} \end{cases} w(k)={n−12(k−1),n−12(n−k),1≤k≤2n2n≤k≤n
N = 42
win = np.bartlett(N)
print(win)
plt.plot(win)
[0. 0.04878049 0.09756098 0.14634146 0.19512195 0.24390244
0.29268293 0.34146341 0.3902439 0.43902439 0.48780488 0.53658537
0.58536585 0.63414634 0.68292683 0.73170732 0.7804878 0.82926829
0.87804878 0.92682927 0.97560976 0.97560976 0.92682927 0.87804878
0.82926829 0.7804878 0.73170732 0.68292683 0.63414634 0.58536585
0.53658537 0.48780488 0.43902439 0.3902439 0.34146341 0.29268293
0.24390244 0.19512195 0.14634146 0.09756098 0.04878049 0. ]
## Blackman window
The time domain expression is as follows: | {
"domain": "fatalerrors.org",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9711290930537121,
"lm_q1q2_score": 0.8154900922744748,
"lm_q2_score": 0.8397339736884712,
"openwebmath_perplexity": 3388.48679894393,
"openwebmath_score": 0.48512622714042664,
"tags": null,
"url": "https://www.fatalerrors.org/a/numpy-learning-notes-6-common-functions-5.html"
} |
matlab, fourier-transform
IDFT
fft(I) Yes it does but your DFT implementation is wrong. w1,w2,n1 and n2 should be in the range of $0, \ldots, N-1$. Also you should be comparing against MATLAB's fft2 function.
Here is a correct implementation. I've replace w1,w2 with u,v and n1,n2 with x,y to follow conventions. I've done some algebraic simplification.
I = [255, 255, 30, 100
255, 50, 90, 20
70, 70, 20, 10
100, 20, 10, 0];
% it converts it to grayscale
I = mat2gray(I);
% DFT
N = size(I,1);
IDFT = 1i*zeros(N,N);
for u=0:N-1
for v=0:N-1
DFT = 0;
for x=0:N-1
for y=0:N-1
DFT = DFT + I(x+1,y+1)*exp(-1i*2*pi*(u*x+v*y)/N);
end
end
IDFT(u+1, v+1) = DFT;
end
end
IDFT
fft2(I) | {
"domain": "dsp.stackexchange",
"id": 4395,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "matlab, fourier-transform",
"url": null
} |
which expands to | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9845754479181589,
"lm_q1q2_score": 0.8464038292972131,
"lm_q2_score": 0.8596637577007394,
"openwebmath_perplexity": 650.2529878170147,
"openwebmath_score": 0.6676205992698669,
"tags": null,
"url": "https://math.stackexchange.com/questions/22159/how-many-n-times-m-binary-matrices-are-there-up-to-row-and-column-permutation/881965"
} |
roslaunch
This is the PATH output for me and my rbx1 package is in /home/ros/catkin_ws/src
ROS_PACKAGE_PATH="/home/ros/catkin_ws/src:/opt/ros/groovy/share:/opt/ros/groovy/stacks"
Originally posted by Maya with karma: 1172 on 2014-04-13
This answer was ACCEPTED on the original site
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 17638,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "roslaunch",
"url": null
} |
python, logging
class ContextLogger:
def __init__(self, logger, obj):
self.logger = logger
self.obj = obj
def log(self, msg, level=logging.INFO):
log_func = {
logging.INFO: self.logger.info,
logging.WARN: self.logger.warn,
logging.ERROR: self.logger.error,
logging.DEBUG: self.logger.debug,
}
log_func[level](msg, extra={"obj": self.obj})
def info(self, msg):
self.log(msg, logging.INFO)
def error(self, msg):
self.log(msg, logging.ERROR)
def warn(self, msg):
self.log(msg, logging.WARN)
def debug(self, msg):
self.log(msg, logging.DEBUG)
The information is recorded in each class via __repr__ dunder method.
Example
class B:
def __init__(self, a, b, logger):
self.a = a
self.b = b
self.logger = logger
self.logger_ = ContextLogger(logger, self)
self.logger.info('plain info')
self.logger_.info('context info') | {
"domain": "codereview.stackexchange",
"id": 44906,
"lm_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, logging",
"url": null
} |
redshift, doppler-effect
$$\gamma \simeq 1 + \frac{v^2}{2c^2}\ ,$$
so whilst the standard (longitudinal) Doppler shift is of order $v/c$, the transverse Dopper shift is of order $v^2/c^2$.
NB: This scenario is chosen so that the relative motion of the source and receiver are perpendicular to the line between them. All other scenarios are complicated by the usual Doppler shift you would see because there is a component of the velocity along the line joining the source and receiver. | {
"domain": "astronomy.stackexchange",
"id": 4308,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "redshift, doppler-effect",
"url": null
} |
programming, ibm-q-experience, simulation
If you go and look at the circuit that being executed, you will see that it uses qubit 3 and 4 of the device:
If you don't to use quantum_instance but instead you want to use execute class directly, then you can just specify the initial_layout method in execute. For example:
result = execute(circuit, backend=provider.get_backend('ibmq_santiago'),
initial_layout = [3,4], shots= 1000)
This will also make sure qubit 3 and 4 of the hardware are use when you execute your circuit. | {
"domain": "quantumcomputing.stackexchange",
"id": 2791,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "programming, ibm-q-experience, simulation",
"url": null
} |
electromagnetism, maxwell-equations, gauge-invariance, gauge
What's going on? What is "real" in electrodynamics is what you measure. The fields can be measured without ambiguity due to their influence on charges and currents, and so these are the things that are real. Maxwell's equations directly reference these fields and contain only physical information.
Potentials, on the other hand, are defined through the relations $\vec{E} = -\nabla\Phi - \partial\vec{A}/\partial t$ and $\vec{B} = \nabla\times\vec{A}$, subject to the constraints imposed by Maxwell's equations. This is entirely a trick that we use to hopefully make life easier. | {
"domain": "physics.stackexchange",
"id": 92703,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electromagnetism, maxwell-equations, gauge-invariance, gauge",
"url": null
} |
performance, c, cython, radix-sort
uint8_t radix_key_func_i8(void *item, size_t byte_offset)
{
return ((uint8_t *)item + byte_offset)[0] + 128;
}
uint8_t radix_key_func_u16(void *item, size_t byte_offset)
{
return ((uint8_t *)item + byte_offset)[0];
}
uint8_t radix_key_func_i16(void *item, size_t byte_offset)
{
uint16_t value = ((uint16_t *)item)[0] + 32768;
return ((uint8_t *)&value + byte_offset)[0];
}
uint8_t radix_key_func_u32(void *item, size_t byte_offset)
{
return ((uint8_t *)item + byte_offset)[0];
}
uint8_t radix_key_func_i32(void *item, size_t byte_offset)
{
uint32_t value = ((int32_t *)item)[0] + (int32_t)2147483648;
return ((uint8_t *)&value + byte_offset)[0];
}
uint8_t radix_key_func_u64(void *item, size_t byte_offset)
{
return ((uint8_t *)item + byte_offset)[0];
}
uint8_t radix_key_func_i64(void *item, size_t byte_offset)
{
uint64_t value = ((int64_t *)item)[0] + (int64_t)9223372036854775808;
return ((uint8_t *)&value + byte_offset)[0];
} | {
"domain": "codereview.stackexchange",
"id": 43799,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "performance, c, cython, radix-sort",
"url": null
} |
vba
Public Sub Auto_Close()
VBEMenuButton.DeleteAllVBEMenuButtons
End Sub
VBEMenuButton: Class
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "VBEMenuButton"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Const TagName = "My VBEMenuButton"
Public Button As CommandBarControl
Public WithEvents EventHandler As VBIDE.CommandBarEvents
Attribute EventHandler.VB_VarHelpID = -1 | {
"domain": "codereview.stackexchange",
"id": 42923,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "vba",
"url": null
} |
safety
Title: Is this poor laboratory safety? I'm a formulation chemist. My co-worker, is also a formulation scientist but has no previous formal training in chemical safety or lab chemistry settings.
I always work in the hood unless I’m just mixing fruit extracts or something non-volatile. My coworker doesn't ever work in the hood as they believe that since this goes in food it must be safe.
The lab is small and our work stations are pretty close. My coworker opens up reagent bottles and performs all other tasks on the bench top.
I don't think their reasoning is correct since in food items, the chemicals we work with are present in the ppm to ppb ranges whereas when a pure bottle of them is opened on a lab bench, they are in high concentrations. In addition we face prolonged exposure ($8$ hr work days,$5$ days a week). The two scenarios are very different.
Also, I feel like I’ve had a sore throat ever since I’ve started working there. | {
"domain": "chemistry.stackexchange",
"id": 14438,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "safety",
"url": null
} |
particle-physics, experimental-physics, neutrinos
It depends on the experimental setup.
Experiments measure neutrino oscillations by starting with a known neutrino beam, measuring its content in the three standard model neutrinos, i.e. have detectors that count how many there are at one specific location, then put a detector far enough away (depending on the energy of the beam) and count again the percentages of the standard model neutrinos. Two locations give the purely in count rates . Discrepancies between expected by the standard model counts and counts found by the experiments have given rise to the sterile neutrinos proposals.
how do we know what we are counting if not by knowing the energy and distance-dependent characteristic | {
"domain": "physics.stackexchange",
"id": 67630,
"lm_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, experimental-physics, neutrinos",
"url": null
} |
-
thanks. answer is given as R={(x,y)| y<=x}. thats may be because they dont want to loose the actual relation i.e. y=x+1 . but i am not getting how they got that answer – user1771809 Jan 28 '13 at 17:01
R = {x, y) | y<=x} will give you reflexive closure and transitive closure, but not symmetric closure. It will however, give you an antisymmetric relation. – amWhy Jan 28 '13 at 17:06
Do you need to find "separate" conditions for closure? That is, what will the relation need to be for it to be reflexive. Separately, what will it need to be for it to be symmetric. Separately, what will it need to be for the relation to by transitive. Or...do you need closure of all three properties? – amWhy Jan 28 '13 at 17:11
If you want closure with respect to all three properties, then you need $R = \{ (x,y) | x-y \in \mathbb{Z} \}$. – polkjh Jan 28 '13 at 17:30 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9715639653084245,
"lm_q1q2_score": 0.8138013729975875,
"lm_q2_score": 0.8376199633332891,
"openwebmath_perplexity": 240.2485354457037,
"openwebmath_score": 0.9318026900291443,
"tags": null,
"url": "http://math.stackexchange.com/questions/289038/reflexive-symmetric-and-transitive-closure-of-a-given-relation"
} |
java, object-oriented, homework
System.out.println("Enter the values between 1 and 10");
double[][] d = getArray(row,column);
Location l = locateLargest(d);
System.out.println(l.toString());
}
public static double[][] getArray(int row,int column){
double [][] a = new double[row][column];
double input;
for (int i=0;i<a.length;i++){
for (int j=0;j<a[i].length;j++){
a[i][j] = kk.nextDouble();
}
}
return a;
}
public static Location locateLargest(double[][] a){
int rowIndex=0;
int columIndex=0;
double max = a[rowIndex][columIndex];
for (int i=0;i<a.length;i++){
for (int j=0;j<a[i].length;j++){
if (a[i][i]>max) {
max = a[i][j];
rowIndex=i;
columIndex=j;
}
}
}
return new Location(rowIndex,columIndex,max);
}
}
class Location{ | {
"domain": "codereview.stackexchange",
"id": 25535,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, object-oriented, homework",
"url": null
} |
beginner, bash, git, openssl
# Create the timestamp request using the specified revision as a digest. The
# sha1 hashes Git uses for revisions are already in the correct format. The
# default should be sha1, but we specify it anyway to show our intent is to
# pass an sha1 hash.
#
# The request is submitted to the timestamp server using curl.
#
# The data is base64 encoded and temporarily stored in the TSREPLY variable so
# the timestamp can be verified before storing it in Git notes.
timestamp=$(openssl ts -query -cert -digest "$rev" -sha1 \
| curl -s -H "$CONTENT_TYPE" -H "$ACCEPT_TYPE" --data-binary @- "$url" \
| openssl enc -base64)
# Verify the reply to make sure the timestamp is valid. We don't want to add
# invalid timestamps to Git notes since an invalid timestamp has no value.
echo "$timestamp" \
| openssl enc -d -base64 \
| openssl ts -verify -digest "$rev" -in /dev/stdin -CAfile "$cafile" > /dev/null 2>&1 | {
"domain": "codereview.stackexchange",
"id": 2347,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "beginner, bash, git, openssl",
"url": null
} |
ros, macbook, ubuntu
Originally posted by cerebraldad on ROS Answers with karma: 45 on 2017-02-03
Post score: 0
You're on the right track. Basically you need three things: ROS on the netbook, ROS on the macbook, and those two computers talking to each other.
You can follow the ROS Tutorials which will guide you through installing in understanding ROS.
For your macbook, you will need a virtual machine. ROS is not yet fully supported for OSX, and attempting to install it can be quite difficult. I personally use Parallels on my macbook, but other options would be VMWare, or VirtualBox. However, I don't believe VMWare supports virtual graphics acceleration, which is quite important for any visualization work. Once you have Ubuntu installed on your virtual machine, you follow the same install instructions from the ROS Tutorials link above. | {
"domain": "robotics.stackexchange",
"id": 26916,
"lm_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, macbook, ubuntu",
"url": null
} |
interpolation
Title: Interpolating irregularly missing data points of regularly spaced data If I have a set of regularly spaced sample data (spacing $\delta x$) and some of my data is missing (zero) but not at regular intervals, i.e.
$[a_0, (missing), (missing), (missing), a_4, a_5, (missing), a_7, a_8, a_9, a_{10}, ...]$
Can digital signal processing techniques be used to interpolate the missing data?
I've only read of interpolating by a FIR or IIR when the missing data is every nth element.
There is a lot more data present than missing.
The interpolation can be done offline.
The first or last data point(s) might be missing. If you want to have just a working example, you can consider the functionality of scipy.interpolate:
N = 128
n = np.arange(N)
x = np.sin(2*np.pi*n/32)
plt.plot(n, x)
pos = np.random.randint(N, size=(50,))
x_received = np.delete(x, pos)
n_received = np.delete(n, pos)
plt.stem(n_received, x_received)
import scipy.interpolate | {
"domain": "dsp.stackexchange",
"id": 5251,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "interpolation",
"url": null
} |
$\frac{3}{4} n \ge 51$
Now, we multiply each side of the inequality by $\frac{\textcolor{red}{4}}{\textcolor{b l u e}{3}}$ to solve for $n$ while keeping the inequality balanced:
$\frac{\textcolor{red}{4}}{\textcolor{b l u e}{3}} \times \frac{3}{4} n \ge \frac{\textcolor{red}{4}}{\textcolor{b l u e}{3}} \times 51$
$\frac{\cancel{\textcolor{red}{4}}}{\cancel{\textcolor{b l u e}{3}}} \times \frac{\textcolor{b l u e}{\cancel{\textcolor{b l a c k}{3}}}}{\textcolor{red}{\cancel{\textcolor{b l a c k}{4}}}} n \ge \textcolor{red}{4} \times 17$
$n \ge 68$
Feb 26, 2017
Without any punctuation there are different interpretations which lead to different solutions:
$\frac{3}{4} x - 9 \ge 42 \text{ or } \frac{3}{4} \left(x - 9\right) \ge 42$
$x \ge 56 \text{ or } x \ge 65$
#### Explanation:
Let's use some punctuation so show exactly what is meant:
note how the placement of a comma gives a different meaning. | {
"domain": "socratic.org",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9886682474702956,
"lm_q1q2_score": 0.8059944831858021,
"lm_q2_score": 0.8152324960856175,
"openwebmath_perplexity": 1760.7302209178451,
"openwebmath_score": 0.8682423233985901,
"tags": null,
"url": "https://socratic.org/questions/how-do-you-write-an-inequality-and-solve-given-three-fourths-of-a-number-decreas"
} |
robotic-arm
But again, this is all assuming the rotations affect the end effector. The rotation parameters could be in Euler anglges, or Tait-Bryan angles, but it's unlikely to be something too exotic.
If you could edit your question with more detail about what you're trying to do and link to the user manual or communication protocol I could give more help, but I don't really have any useful information about your problem, so at the moment all I can give are educated guesses.
:EDIT: | {
"domain": "robotics.stackexchange",
"id": 724,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "robotic-arm",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.