text stringlengths 1 1.11k | source dict |
|---|---|
javascript
Title: JavaScript Code for image rotation on a web page How does this look for basic image rotation? What is there to be improved here?
<p>
<img src='images/rotation/dsc_0052.jpg' id='rotateImg0' alt='image rotation' />
<img src='images/rotation/bilde1.jpg' id='rotateImg1' style='display:none;' alt='image rotation' />
<img src='images/rotation/bilde2.jpg' id='rotateImg2' style='display:none;' alt='image rotation' />
<img src='images/rotation/bilde3.jpg' id='rotateImg3' style='display:none;' alt='image rotation' />
<img src='images/rotation/bilde4.jpg' id='rotateImg4' style='display:none;' alt='image rotation' />
<img src='images/rotation/dsc_0043.jpg' id='rotateImg5' style='display:none;' alt='image rotation' />
</p> | {
"domain": "codereview.stackexchange",
"id": 822,
"lm_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",
"url": null
} |
c#
// map back to skeleton.Width & skeleton.Height
return new Point((int)(skeleton.Width * colorX / 640.0), (int)(skeleton.Height * colorY / 480));
}
My Version
private Point getDisplayPosition(Joint joint)
{
float depthX, depthY;
KinectSensor sensor = kinectSensorChooser1.Kinect;
DepthImageFormat depth = DepthImageFormat.Resolution320x240Fps30;
depthX = 320;
depthY = 240;
sensor.MapSkeletonPointToDepth(joint.Position, depth);
depthX = Math.Max(0, Math.Min(depthX * 320, 320));
depthY = Math.Max(0, Math.Min(depthY * 240, 240));
int colorX, colorY;
colorX = 320;
colorY = 240;
return new Point((int)(skeleton.Width * colorX / 640.0), (int)(skeleton.Height * colorY / 480));
} | {
"domain": "codereview.stackexchange",
"id": 2246,
"lm_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
} |
javascript, performance, programming-challenge, time-limit-exceeded
Title: two-sum algorithm Can someone help me in optimizing the code here?
This is the original question
Given an array of integers, return indices of the two numbers such
that they add up to a specific target.
You may assume that each input would have exactly one solution, and
you may not use the same element twice.
Question link: https://leetcode.com/problems/two-sum/
/**
* @param {number[]} nums
* @param {number} target
* @return {number[]}
*/
var twoSum = function(nums, target) {
const hashMapArray = {}
for (let i=0; i<nums.length; i++) {
const num = nums[i]
for (let index in hashMapArray) {
if (hashMapArray[index] + num === target) {
return [index, i]
}
}
hashMapArray[i] = num
}
return []
} | {
"domain": "codereview.stackexchange",
"id": 36425,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, performance, programming-challenge, time-limit-exceeded",
"url": null
} |
c++, mathematics, c++17, boost
} } } } } // namespace boost::math::differentiation::autodiff::v1
namespace std {
/// boost::math::tools::digits<RealType>() is handled by this std::numeric_limits<> specialization,
/// and similarly for max_value, min_value, log_max_value, log_min_value, and epsilon.
template <typename RealType,size_t Order>
class numeric_limits<boost::math::differentiation::autodiff::dimension<RealType,Order>>
: public numeric_limits<typename boost::math::differentiation::autodiff::dimension<RealType,Order>::root_type>
{ };
} // namespace std
namespace boost { namespace math { namespace tools { | {
"domain": "codereview.stackexchange",
"id": 33182,
"lm_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++, mathematics, c++17, boost",
"url": null
} |
homework-and-exercises, classical-mechanics, lagrangian-formalism, spring, constrained-dynamics
I don't really understand what I'm getting and their physical meaning.
Any help will be very much appreciated. So a holonomic constraint like you've got, exerts a force perpendicular to itself, which is whatever it needs to be to keep the particle on that constraint. It's just the normal force due to the constraint, coming from whatever is enforcing (no pun intended) the constraint. The dynamical expression for it will mostly reflect all of the things that are trying to violate the constraint. | {
"domain": "physics.stackexchange",
"id": 79564,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises, classical-mechanics, lagrangian-formalism, spring, constrained-dynamics",
"url": null
} |
gazebo
while True:
yield From(publisher.publish(message))
yield From(trollius.sleep(1.0))
loop = trollius.get_event_loop()
loop.run_until_complete(publish_loop())
What am I doing wrong? Am I sending the command to the wrong endpoint? is my message improperly formatted?
I am using Gazebo 4.1.0 on Ubuntu with the Simbody physics engine.
Originally posted by Skylion on Gazebo Answers with karma: 5 on 2015-07-02
Post score: 0
I believe you are advertising on the wrong topic. Try:
manager.advertise('/gazebo/world/default_body/joint_cmd', 'gazebo.msgs.JointCmd'))
The topic name is /gazebo/WORLD_NAME/MODEL_NAME/join_cmd. In your case WORLD_NAME="world", and MODEL_NAME="default_body", based on your SDF file.
Originally posted by nkoenig with karma: 7676 on 2015-07-02
This answer was ACCEPTED on the original site
Post score: 1 | {
"domain": "robotics.stackexchange",
"id": 3797,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gazebo",
"url": null
} |
python, beginner, json, error-handling, http
def validate_all(
session: Session, env: str, instance: str, new_config: str, action: str
) -> Tuple[
int, # Succeeded machines
int, # Total machines
List[str], # Error messages
]:
"""
This will get list of all ipAddresses for that 'instance' in that 'environment'.
And then check whether each machine/ipAddress from that list have downloaded and
verified successfully. Basically for each 'action' type I need to validate to make
sure each of those 'actions' completed successfully. If successful at the end then print out the message.
Returns the number of machines.
"""
with session.get(
make_catalog_url(env=env),
params={'ns': 'default', 'tag': instance}
) as response:
response.raise_for_status()
machines = response.json()
n_succeeded = 0
n_total = len(machines)
messages = [] | {
"domain": "codereview.stackexchange",
"id": 40142,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, beginner, json, error-handling, http",
"url": null
} |
bert, transformer
Title: Comparison between applications of vanilla transformer and BERT I try to identify applications of vanilla transformer in nlp, as well as those in BERT. But I don't seem to find good summaries for either of them. Thus my questions are:
what are the applications of transformer and bert respectively?
in (1), why in some application vanilla transformer is used over BERT? (or vice versa?) What're the reasons?
TIA. A normal transformer has two parts: encoder (non-autoregressive) and decoder (autoregressive). This allows it to generate text (i.e. sequences of tokens). Therefore the applications of the vanilla transformer are those receiving a piece of text as input and getting another piece of text as output. The main example is machine translation.
BERT is a transformer encoder. Its applications are those tasks where the input is a piece of text (or N pieces of text) and the output is either: | {
"domain": "datascience.stackexchange",
"id": 10722,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "bert, transformer",
"url": null
} |
pcl, ros-kinetic, pointcloud
The fields give you information about parsing the data. Each group of 16 numbers in the array data gives you x,y,z and intensity for a single point in the point cloud. First 1-4 numbers represent x as a 32 bit float, 5-8 represents y, 9-12 represents z, 13-16 represents the intensity. All you then need to do is convert the data to 32 bit float in little endian.
Libraries should exist where all this is done. However, if you are into reinventing the wheel or couldn't find one, this will get you home.
Originally posted by janindu with karma: 849 on 2019-03-24
This answer was ACCEPTED on the original site
Post score: 4 | {
"domain": "robotics.stackexchange",
"id": 32735,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "pcl, ros-kinetic, pointcloud",
"url": null
} |
python, scikit-learn, random-forest
I'd like to plot the decision boundary of i1/i2 while ignoring the remaining features.
Is this possible? or useful at all? For decision trees, this can be both possible and useful. For the random forest (RF), each decision tree has their own boundaries for these features. And, since RF trains each tree with a subset of original features, some trees don't have any these features and so boundaries. This might also occur due to pruning. So, you have a set of boundaries, which can be plotted at the same time to get a feeling of how the trees in the forest learnt your dataset. However, these boundaries also depend on other features. If some more explanatory feature is selected in a higher node in some trees, the low level thresholds might mislead you. | {
"domain": "datascience.stackexchange",
"id": 4566,
"lm_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, scikit-learn, random-forest",
"url": null
} |
# 4.7. Nonlinear least squares#
After the solution of square linear systems, we generalized to the case of having more constraints to satisfy than available variables. Our next step is to do the same for nonlinear equations, thus filling out this table:
linear
nonlinear
square
$$\mathbf{A}\mathbf{x}=\mathbf{b}$$
$$\mathbf{f}(\mathbf{x})=\boldsymbol{0}$$
overdetermined
$$\min\, \bigl|\mathbf{A}\mathbf{x} - \mathbf{b}\bigr|_2$$
$$\min\, \bigl|\mathbf{f}(\mathbf{x}) \bigr|_2$$
Definition 4.7.1 : Nonlinear least-squares problem
Given a function $$\mathbf{f}(\mathbf{x})$$ mapping from $$\real^n$$ to $$\real^m$$, the nonlinear least-squares problem is to find $$\mathbf{x}\in\real^n$$ such that $$\bigl\|\mathbf{f}(\mathbf{x})\bigr\|_2$$ is minimized. | {
"domain": "tobydriscoll.net",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9893474869616596,
"lm_q1q2_score": 0.8088652468298347,
"lm_q2_score": 0.8175744695262777,
"openwebmath_perplexity": 571.8954191137506,
"openwebmath_score": 0.7986860871315002,
"tags": null,
"url": "https://tobydriscoll.net/fnc-julia/nonlineqn/nlsq.html"
} |
quantum-field-theory, statistical-mechanics, field-theory, renormalization, critical-phenomena
Concerning the flow equation of the XY model close to two dimensions, one should notice that here we only have one relevant field (which one naturally associates with the temperature, as it is the experimentally tunable parameter), corresponding to $u_1$ as it preserves the XY symmetry $y_t$ is thus the value of the positive eigenvalue associated with deviations to the fixed point (one then compute $\nu$ and $alpha$ from the equations given by the OP). There are no symmetry breaking field here, so one does not see the effect of $u_2$, and its eigenvalue $y_h$. Instead, the other direction is an irrelevant one (also associated with a XY symmetric field), the eigenvalue only contributing to correction to scaling. | {
"domain": "physics.stackexchange",
"id": 39068,
"lm_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, statistical-mechanics, field-theory, renormalization, critical-phenomena",
"url": null
} |
or radians), and so on. A right triangle is a triangle in which one of the angles is 90°, and is denoted by two line segments forming a square at the vertex constituting the right angle. All the basic geometry formulas of scalene, right, isosceles, equilateral triangles ( sides, height, bisector, median ). If you cannot use the … As is the case with the sine rule and the cosine rule, the sides and angles are not fixed. In this tutorial I show you how to find a length of one side of a non-right angled triangle by using the Sine Rule. If SAS is Although trigonometric ratios were first defined for right-angled triangles (remember SOHCAHTOA? This formula works for a right triangle as well, since the since of 90 is one. The bisector of a right triangle, from the vertex of the right angle if you know sides and angle , - legs - hypotenuse Obtuse triangles have one obtuse angle (angle which is greater than 90°). Also, the calculator will show you a step by step explanation. With this, we can | {
"domain": "marcellogabrielli.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9728307716151472,
"lm_q1q2_score": 0.8189538959114231,
"lm_q2_score": 0.8418256492357358,
"openwebmath_perplexity": 608.2235356476862,
"openwebmath_score": 0.8196149468421936,
"tags": null,
"url": "https://www.marcellogabrielli.com/sleepyhead-safety-tla/b71019-non-right-angle-triangle-formula"
} |
java, multithreading, concurrency, queue, socket
}
LogWriterTask.java:
import java.io.BufferedWriter;
import java.io.IOException;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.BlockingQueue;
public class LogWriterTask extends Thread {
private final static int MAX_NINE_DIGIT_RANGE = 1000000000;
private final static int SUMMARY_WAIT_PERIOD = 10000;
private int uniqueCount = 0;
private int duplicateCount = 0;
private int uniqueTotal = 0;
private BlockingQueue<Integer> blockingQueue;
private BufferedWriter bw;
private int[] uniqueNums = new int[MAX_NINE_DIGIT_RANGE];
public LogWriterTask(BlockingQueue<Integer> blockingQueue, BufferedWriter bw) {
this.bw = bw;
this.blockingQueue = blockingQueue;
Timer timer = new Timer();
timer.schedule(new SummaryTask(), 0, SUMMARY_WAIT_PERIOD);
} | {
"domain": "codereview.stackexchange",
"id": 41351,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, multithreading, concurrency, queue, socket",
"url": null
} |
python, chess
# Maps from a board where the weak king is to move
# to the strong to move parent board
weak_to_move_parents = {}
checkmate_found = False
# Search for checkmate
while unexplored_boards and not checkmate_found: # loop once per round
# Search all known unexplored boards (except ones discovered in the process)
for parent_board in unexplored_boards: # explore the child positions of each new strong_to_move_board
# Find, record, and evaluate all children of a parent board
for weak_to_move_board in kmwu.weak_to_move_boards(parent_board):
# new_weak_king_pos will be a square if possible or None if there are no squares out of check
new_weak_king_pos = kmwu.weak_goes(weak_to_move_board) | {
"domain": "codereview.stackexchange",
"id": 27538,
"lm_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, chess",
"url": null
} |
java, object-oriented, tree
Title: Walk on tree with different actions on different nodes I have a tree whose nodes are of type Node. Depending on the type (one of the implementations of Node) nodes differ in the set of information that is stored in them (in the demo example, the information is not different). I also have action sets the Action that should be invoked when you visit a particular node type.
Although this is not implemented, I originally tried to write the code so that the action could support multiple types of nodes simultaneously.
public final class ActionA implements Action {
@Override
public void act(final NodeA node) {
System.out.println("Act action1 (" + node.value() + ")");
}
@Override
public void act(final NodeB node) {
System.out.println("Act action1 (" + node.value() + ")");
}
}
Here's what I got actually
I have a tree whose nodes are of type Node:
import java.util.List;
public interface Node {
String value();
List<Node> childs();
} | {
"domain": "codereview.stackexchange",
"id": 28184,
"lm_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, tree",
"url": null
} |
filters, audio, interpolation, decimation
Title: Performing Sample-Rate Conversion on Subchunks of an Audio Signal I have implemented sample-rate conversion (SRC) from scratch in my hobby music player, and it worked fine. However, originally, the music player loaded entire audio files into memory and performed the sample-rate conversion on the entire audio signal during loading. I've now changed this to instead stream the audio file chunk by chunk (to reduce memory footprint), and tried to port my SRC implementation.
But I'm encountering a problem where it I hear clicks between each chunk when they're played back. Increasing the size of each chunk of the audio file I load at a time increases the duration between the clicks, so that's how I'm pretty confident that they appear between chunks. Other than these artifacts, the SRC works/sounds fine. | {
"domain": "dsp.stackexchange",
"id": 11151,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "filters, audio, interpolation, decimation",
"url": null
} |
quantum-field-theory, renormalization, regularization, dimensional-regularization
My second professor claims that one may use:
$$
\int d^n q \frac{\partial}{\partial q^{\mu}}(q^{\mu}f(q)) = \int d^n q q^{\mu}\left(\frac{\partial}{\partial q^{\mu}} f(q)\right) + n\int d^n q f(q),
$$
such that one throws away the boundary term as it is a surface integral by Gauss' theorem. He states explicitly that this may be done if $f(q)$ vanishes quickly enough at infinity, but also that "analytic continuation will be implemented by ignoring the surface term irrespective of the asymptotic behaviour of the integral." If this is true/legit, one may write:
$$
\int d^n q q^{\mu}\left(\frac{\partial}{\partial q^{\mu}} f(q)\right) = - n\int d^n q f(q),
$$
such that one can express divergent integrals in terms of finite ones. | {
"domain": "physics.stackexchange",
"id": 8293,
"lm_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, renormalization, regularization, dimensional-regularization",
"url": null
} |
Thank you
-
Surely you are assuming $p$ is odd. Otherwise, take $p=2$, $a=3$, $e=2$. – Arturo Magidin Apr 13 '11 at 3:18
add comment
## 2 Answers
You need to lift one solution to the next power. See Hensel's lemma.
Here is how to lift one solution $u$ of $x^2 \equiv a \pmod p$ to a solution $v$ of $x^2 \equiv a \pmod {p^2}$: Write $u^2=a+kp$ for some $k$. Consider $v=u+tp$ with $t$ to be determined. Then $v^2 = u^2+2utp+p^2 = a+kp+2utp+p^2$. So we need $t$ such that $k \equiv 2ut \bmod p$. Assuming $p$ odd and $a \not\equiv 0 \bmod p$, you can solve for $t$.
-
Thank you. To be honest, when asking, I hope the answer won't be Hensel's lemma. Don't know why I don't like this lemma at all :( ! – Chan Apr 13 '11 at 2:57
@Chan, you can do the lifting without invoking Hensel's lemma. Several books do that. – lhf Apr 13 '11 at 3:00
Many thanks ;) – Chan Apr 13 '11 at 3:25
add comment | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9895109109053046,
"lm_q1q2_score": 0.8066814342543122,
"lm_q2_score": 0.8152324803738429,
"openwebmath_perplexity": 117.51839525059776,
"openwebmath_score": 0.9626697301864624,
"tags": null,
"url": "http://math.stackexchange.com/questions/32678/prove-that-x2-equiv-a-pmodp-has-solution-if-and-only-if-x2-equiv-a-pm"
} |
java, unit-testing, junit
@Test
public void testDivide() throws Exception {
calcEngine.add(10);
calcEngine.divide(10);
assertEquals(calcEngine.currentTotal, 1.0);
}
} Do you mean the default access modifier (i.e. none specified) by package-private? If you can offer your CalculatorEngine's code as another review then I'm sure some of us can give you good-quality advice there. As pointed out by OP, it's actually in this question: Simple calculator in Java using Swing and AWT. :)
Running down your list of tests... | {
"domain": "codereview.stackexchange",
"id": 14024,
"lm_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, unit-testing, junit",
"url": null
} |
ros, ros-melodic, move-group, ros-control
Comment by Mike Scheutzow on 2021-11-02:
Have you studied the ros_control diagram on this page? I suggest you figure out how the boxes relate to your setup. You may not have all those boxes in your setup.
It may or may not be a problem that vel_command does not match the current element in your specified trajectory. 1) There is a feedback loop in play, so the next calculated value of vel_command for a specific joint depends on the current velocity, how far the joint is the from target position, and how much time it has to get to the target position, 2) It depends on whether you specify position-only, or position+velocity for each element.
You should not try to inject new commands into different levels of the software stack during a single movement unless your intent is to confuse the software and cause problems. If the ActionServer is driving command_message input, don't interfere until it says it is done.
Comment by Mike Scheutzow on 2021-11-02: | {
"domain": "robotics.stackexchange",
"id": 37043,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, ros-melodic, move-group, ros-control",
"url": null
} |
c#, object-oriented, email, asp.net-core
The content provider provides all the email information(subject, body, To and Cc)
public interface IEmailContentProvider
{
EmailMessage Message { get; }
}
Then we have the abstracted email sender IEmailSender that has a single method Send which uses IEmailContentProvider parameter to get the email information
interface IEmailSender
{
Task Send(IEmailContentProvider provider);
}
I have an example for the content provider WelcomEmailProvider
public class WelcomEmailProvider : IEmailProvider
{
public EmailMessage Message { get; }
public WelcomEmailProvider(string address, string name)
{
Message = new EmailMessage
{
Subject = $"Welcome {name}",
Content = $"This is welcome email provider!",
ToAddresses = new List<EmailAddress> { new EmailAddress { Address = address, Name = name} }
};
}
} | {
"domain": "codereview.stackexchange",
"id": 39226,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, object-oriented, email, asp.net-core",
"url": null
} |
computability, turing-machines, terminology
But on other sources I found the following definition, a language $A \subseteq \Sigma^{\ast}$ is recursively enumerable, iff there exists a Turing machine such that
$$
A = \{ w \in \Sigma^{\ast} \mid \mbox{The machine halts in an accepting state} \}
$$
or
$$
A = \{ w \in \Sigma^{\ast} \mid \mbox{The machine halts and outputs a specified output } \}.
$$
Both notions, by special state or special output, are clearly equivalent. But they do not require the machine to run forever if $w \notin A$. This could be fixed, by letting the machine enter an endless loop if it enters a non-accepting state after finishing its computation. But this seems quite unnatural to me. | {
"domain": "cs.stackexchange",
"id": 8282,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "computability, turing-machines, terminology",
"url": null
} |
telescope
portable than, for instance, something like a 10" dob. Reflectors have their advantages too: lack of chromatic aberration, for instance (although they do suffer from other forms of aberration). I hope this gives you a better idea of the pros and cons of different kinds of telescopes. | {
"domain": "astronomy.stackexchange",
"id": 3299,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "telescope",
"url": null
} |
pressure, collision, fluid-statics
If according to bright magnus' answer it is due to both weight and collisions then if at sea level we close the cap of a bottle, then the pressure in the bottle will the pressure outside because the weight of the air above is transmitted through the cap.
But if we take this same bottle at Everest or say space the weight of the air above would be significantly less at Everest and in the case of space there will be no air outside the bottle to transmit the pressure. But still the pressure in the bottle will be the same as it was at sea level.
Why is it so? How has small column of air in the bottle got the same pressure as the entire atmosphere ( the bottle off course is of tough material and doesn't blast). | {
"domain": "physics.stackexchange",
"id": 64448,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "pressure, collision, fluid-statics",
"url": null
} |
of any number '13 at 10:45 values is very to!, values are determined through equal ratios and conversion functions which are easy. Be reduced to the data table logarithmic interpolation calculator is the first logarithm as exponent and convert the 3 a... Is lower than logarithmic interpolation calculator number ratio uses the same and beyond ) this 'Logarithmic regression calculator,! Cross-Multiplication, y ) pairs and an additional x or y, the... Coordinates points this linear interpolation, a ratio of logarithmic values is very similar to linear!, lin-log, log-lin and log-log point on a set of experimental data be a f… good point decreasing drug... Am trying to obtain is logarithmic interpolation between 1 mm and 2mm get... In engineering, linear is just one method ensure you get the best experience the logarithmic ratio uses the.. Uses the same logarithmic interpolation between data points to calculate log value to the previ-ous one of... It will be linear of great mathematical and | {
"domain": "thekabbalahuniversity.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.960361162033533,
"lm_q1q2_score": 0.8064478832149853,
"lm_q2_score": 0.8397339616560072,
"openwebmath_perplexity": 939.1964955684742,
"openwebmath_score": 0.6536239981651306,
"tags": null,
"url": "http://thekabbalahuniversity.com/k4w0pc9/ae36a1-logarithmic-interpolation-calculator"
} |
error-analysis
Title: Ambiguity in Rounding of Significant Figures This is not a direct physics question, but I guess quite related. Given a number stated in five significant figures (5 SFs)
x=3.1449, what's the corresponding rounded value in 2 SFs?
I would (of course) say it is x=3.1, however if the rounding is performed insteps like: 1-) round from 5 to 4 SFs x=3.145 , 2-) re-round from 4 to 3 SFs x=3.15, 3-) finally round from 3 to 2 SFs it's now x=3.2 ...
What's wrong here? Are we not allowed to perform step by step rounding?
Are we not allowed to perform step by step rounding? | {
"domain": "physics.stackexchange",
"id": 91889,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "error-analysis",
"url": null
} |
geology, earthquakes, earth-history, tectonics, structural-geology
up until suddenly the friction force holding it in place gives way, and there is an earthquake as the moving plate slips forward for a few metres. For these reasons, geologists have never seen a newly created fold after an earthquake. It is impossible for one to form in so short a time. | {
"domain": "earthscience.stackexchange",
"id": 1804,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "geology, earthquakes, earth-history, tectonics, structural-geology",
"url": null
} |
ros2, ros-humble
t_range = TransformStamped()
q = tf_transformations.quaternion_from_euler(0, radians(90), 0)
t_range.header.stamp = self.get_clock().now().to_msg()
t_range.header.frame_id = 'base_link'
t_range.child_frame_id = 'crazyflie_flowdeck'
t_range.transform.rotation.x = q[0]
t_range.transform.rotation.y = q[1]
t_range.transform.rotation.z = q[2]
t_range.transform.rotation.w = q[3]
self.tfbr.sendTransform(t_range)
zrange = float(data.get('range.zrange'))/1000.0
msg = Range()
msg.header.stamp = self.get_clock().now().to_msg()
msg.header.frame_id = 'crazyflie_flowdeck'
msg.field_of_view = radians(4.7)
msg.radiation_type = Range().INFRARED
msg.min_range = 0.01
msg.max_range = 3.5
msg.range = zrange
##self.range_publisher.publish(msg) | {
"domain": "robotics.stackexchange",
"id": 38626,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros2, ros-humble",
"url": null
} |
quantum-mechanics, quantum-interpretations, bells-inequality
In the protocol at the end he says if $X_a$ = 0 than do a certain measurement. What is the output produced by the strategy? It is very unclear. Is the output the result of the measurement?
Also don't you have to perform a measurement to know that $X_a$ = 0? Wouldn't this already affect the state EPR pair before you made the second measurement?
Am I fundamentally missing something? According to the source: Alice and Bob are each handed a single random classical bit $X_a$ and $X_b$ and they also share a pair or maximally entangled qubits in the state $|\psi\rangle=(|00\rangle+|11\rangle)/\sqrt{2}$.
Now based on this $X_a ∧ X_b = 0$ unless both $X_a$ and $X_b=1$ (definition of the logical "and" operator, $∧$). Because $X_a$ and $X_b$ are random and independent, this means that $X_a ∧ X_b$ is random and $=0$ 75% of the time and =1 only 25% of the time. | {
"domain": "physics.stackexchange",
"id": 53337,
"lm_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, quantum-interpretations, bells-inequality",
"url": null
} |
differential-geometry
and $dg^{\dagger}=(A_a)^{\dagger}dx^a$.
Now $dg^{\dagger}dg$ is thus $(A_a)^{\dagger}A_b dx^adx^b$.You can now compute $Tr((A_a)^{\dagger}A_b)dx^adx^b$ to obtain$2(\cos^2(\theta) d\phi^2 +\sin^2(\theta) d^2 \chi + d\theta^2)$. One can directly see it produces the correct coefficients for the metric in the diagonal, and a short computation can show other ones vanish. | {
"domain": "physics.stackexchange",
"id": 31970,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "differential-geometry",
"url": null
} |
quantum-mechanics, quantum-field-theory, quantum-electrodynamics
Lepage (1989), "What is renormalization?" Boulder ASI, pages 483-508, https://arxiv.org/abs/hep-ph/0506330. | {
"domain": "physics.stackexchange",
"id": 54762,
"lm_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, quantum-field-theory, quantum-electrodynamics",
"url": null
} |
series for a half wave rectified sine wave. Using Table 15. Conventionally, a periodic signal f(t) as trigonometric Fourier series, can be expressed as The first term is a constant and represents DC component of the signal. Switch one out for half power, and switch them both in series for quarter power, but that's only any good for bulk heating applications which doesn't help you if you need to specifically control the wire's heat. A subtle, but very important, aspect of the Fourier spectrum is its. You can then apply this method to find the Fourier series of the following period 2π functions: 1. % Author : Seungwon Park (swpark. Therefore,!1 = 2ˇ T1 = ˇ T =!o 2. where a 0 models a constant (intercept) term in the data and is associated with the i = 0 cosine term, w is the fundamental frequency of the signal, n is the number of terms (harmonics) in the series, and 1 ≤ n ≤ 8. 0e-5) + 1; % Total points "(final point-initial point)/Interval+1% for n = 1: 12 % Values we are considering to | {
"domain": "amicidellacattolica.it",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9848109511920161,
"lm_q1q2_score": 0.811939131812706,
"lm_q2_score": 0.8244619242200081,
"openwebmath_perplexity": 603.0161213606915,
"openwebmath_score": 0.8685778975486755,
"tags": null,
"url": "http://amicidellacattolica.it/bcpi/rectified-wave-fourier-series.html"
} |
python, python-3.x, flask, sqlalchemy
from flask import Flask, render_template, request, redirect, url_for
from movie import Movie, db
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///adatabase.db'
db.init_app(app)
@app.route('/', methods=['GET'])
@app.route('/movies', methods=['POST', 'GET'])
def movies():
if request.method == 'POST':
title = request.form['title']
release_date = request.form['release_date']
db.session.add(Movie(title, parse_release_date(release_date)))
db.session.commit()
movies = Movie.query.all()
return render_template('movies.html', movies=movies)
@app.route('/movies/<int:post_id>', methods=['GET', 'PUT', 'DELETE'])
def movie(post_id):
the_movie = Movie.query.filter(Movie.id == post_id).first()
if request.method == 'DELETE':
db.session.delete(the_movie)
db.session.commit()
return redirect(url_for('movies')) | {
"domain": "codereview.stackexchange",
"id": 31383,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, python-3.x, flask, sqlalchemy",
"url": null
} |
collision, particle-physics
The beam basically just killed all the tissue it passed through. The symptoms were the relatively mundane ones expected from tissue death.
The LHC has a much, much greater energy than the one that struck Bugorski, so it would cause a lot more heating and presumably burning of neighbouring tissue. How much extra damage there would be depends on how rapidly the beam is absorbed, and I must admit I don't know this. The total LHC beam energy is 362 MJ, which is enough to turn 150kg of water at body temperature to steam. If any significant fraction of this was absorbed by your head the resulting explosion would probably not leave much of your head behind. | {
"domain": "physics.stackexchange",
"id": 16606,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "collision, particle-physics",
"url": null
} |
c, linked-list, memory-management, circular-list
typedef struct node {
header_t header;
void *retaddress; // the memory address returned to user
} node_t;
typedef struct head {
struct node *first;
struct node *last;
struct node *curr;
size_t len;
} head_t;
static char MYHEAP[MYHEAPSIZE]; // in reality this comes from OS via a syscall
static head_t freelist; // header for the circular linked list of free blocks
void *my_malloc( size_t sz);
void my_free( void *p );
void print_list( head_t *head );
int main( void )
{
void *alloclist[MAXALLOCS] = {0}; // list of allocated blocks
size_t reqsize = 0;
int i;
node_t *nodeptr;
freelist.len = 1;
freelist.first = freelist.last = freelist.curr = nodeptr = (node_t *)MYHEAP;
nodeptr->header.s.size = (MYHEAPSIZE/sizeof(header_t))*sizeof(header_t);
nodeptr->header.s.next = nodeptr;
nodeptr->retaddress = MYHEAP+sizeof(header_t); | {
"domain": "codereview.stackexchange",
"id": 28401,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c, linked-list, memory-management, circular-list",
"url": null
} |
• @Alex: Oh, I see, I take the Pascal matrix you wrote and start changing signs on the shifted diagonals. I think I got it. And I see we can even multiply by a geometric sequence $1$, $\lambda$, $\lambda^2$,$\ldots$. So these are some maps on the polynomials. What are the transposes as linear maps? – orangeskid Feb 2 '15 at 2:42 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9728307661011975,
"lm_q1q2_score": 0.8106838084952871,
"lm_q2_score": 0.8333245994514084,
"openwebmath_perplexity": 185.84010932306472,
"openwebmath_score": 0.9949563145637512,
"tags": null,
"url": "https://math.stackexchange.com/questions/1128041/matrices-representing-the-same-linear-transformation"
} |
links to each of the topics mentioned above along with the tutorial and the problems that have been asked in the various contests. We show some experimental results. Convex Hull | Set 1 (Jarvis’s Algorithm or Wrapping) Convex Hull | Set 2 (Graham Scan) Given n line segments, find if any two segments intersect; Check whether a given point lies inside a triangle or not; How to check if given four points form a square; Recent Articles on Geometric Algorithms Coding Practice on Geometric Algorithms. active oldest votes. The boundary of Ὄ Ὅis the convex hull of. A convex hull of a given set of points is the smallest convex polygon containing the points. 5, release 3. consider the points in sorted order, for each. We are here going to use the Gift wrapping algorithm, also known as a Jarvis March. Generate random points and draw the convex hull of the points. – Examine the spatial proximity of each object in the data space – If the proximity of an object considerably deviates from the | {
"domain": "ciod.it",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9879462222582661,
"lm_q1q2_score": 0.8054058559000264,
"lm_q2_score": 0.8152324871074607,
"openwebmath_perplexity": 702.2431703921578,
"openwebmath_score": 0.4055248498916626,
"tags": null,
"url": "http://ciod.it/pjtg/convex-hull-algorithm-tutorial.html"
} |
java, performance, programming-challenge, linked-list, interview-questions
while (current != null) {
// do something here
sb.append(current.data);
sb.append(" ");
current = current.next;
}
return sb.toString();
}
}
public static Node moveTailToHead(Node head) {
if (head == null || head.next == null) {
throw new IllegalStateException(
"List should have atleast two elements");
}
Node current = head;
Node prev = null;
while (current.next != null) {
prev = current;
current = current.next;
}
prev.next = null;
current.next = head;
head = current;
return head;
}
public static void main(String[] args) {
Node head = new Node(10, null);
head.append(20)
.append(30)
.append(40);
System.out.println(head); // 10 20 30 40
Node newHead = moveTailToHead(head);
System.out.println(newHead); // 40 10 20 30 | {
"domain": "codereview.stackexchange",
"id": 29970,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, performance, programming-challenge, linked-list, interview-questions",
"url": null
} |
navigation, turtlebot
How can I apply the theoretical rotation matrix between Kinect frame and Turtlebot frame?
Where should I implement the rotation transformation between the frames (because there are not a lot of files in turtlebot_navigation folder)?
Is it possible to update the angle for the rotation transformation as often as the motor angle changes?
Let me know if wasn't clear in my explanations.
Thank you for your answers and your advices!
Originally posted by Drumzone on ROS Answers with karma: 1 on 2016-06-28
Post score: 0
So did you integrated your rotating kinect and servo in your turtleblot xacro file? This is the common way to go in ROS.
Take a look at this tutorial. Maybe there' re other better ones, but this covers what you need. Basically, you must do 3 things: | {
"domain": "robotics.stackexchange",
"id": 25088,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "navigation, turtlebot",
"url": null
} |
c++, algorithm, c++11, time-limit-exceeded, k-sum
Title: Finding indices of numbers that sum to a target I've taken this algorithm question, which is to find the indexes of any two numbers in an array that sum to a given number. It is quite a simple problem to solve. But it is the execution time of my code algorithm that bugs me.
#include <iostream>
#include <vector>
using namespace std;
class TwoSum
{
public:
static std::pair<int, int> findTwoSum(const std::vector<int>& list, int TargetSum)
{
for (int increment = 0; increment < list.size(); increment++)
{
for (int i = 0; i < list.size(); i++)
{
if (list.at(increment) + list.at(i) == TargetSum)
{
return make_pair(increment, i);
}
}
}
return make_pair(-1, -1);
}
};
int main(int argc, const char* argv[])
{
vector<int> list = {1, 3, 5, 7, 9 };
int targetSum = 12;
pair<int, int> indices = TwoSum::findTwoSum(list, targetSum); | {
"domain": "codereview.stackexchange",
"id": 19911,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, algorithm, c++11, time-limit-exceeded, k-sum",
"url": null
} |
natural-language-processing, lexical-recognition
I don't think anybody knows how to answer this for the general case. If they did, they'd have basically solved AGI. But we can certainly talk about techniques that get part of the way there, and approaches that could work.
One thing I would consider trying (and I don't know off-hand if anybody has tried this exact approach) is to model the disambiguation of each word as a discrete problem for a Bayesian Belief Network where your priors (for any given word) are based on both stored "knowledge" as well as the previously encountered words in the (sentence|paragraph|document|whatever). So if you "know", for example, that "Reading is a city in the UK" and that "place names are usually capitalized", your network should be strongly biased towards interpreting "Reading" as the city, since nothing in the word position in the sentence strongly contradicts that. | {
"domain": "ai.stackexchange",
"id": 138,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "natural-language-processing, lexical-recognition",
"url": null
} |
quantum-mechanics
My question is, is this same effect observable when a single electron is fired at speeds much lower than the speed of light?
If so, how? For this to happen, the electron (which has mass and experiences time the way we do) has to be physically present at two locations at the same time (in both slits). Yes, electrons can be brought to interfere with themselves. This can actually be shown in a double slit experiment, just as with photons.
The electron you are thinking of is a localized particle in space. Instead, you have to consider the electron's position as a wave function. The wave function can be non-zero at both slits and interfere with itself afterward. With electrons, you will also find the typical stripes (or rings, if you use a circular aperture as a single slit) that you found with photons.
This is one of the groundbreaking experiments that one can conduct in schools to prove that electrons actually are both, a wave and a particle. | {
"domain": "physics.stackexchange",
"id": 50012,
"lm_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",
"url": null
} |
For instance, if $n=5$, you get the following:
$$\begin{bmatrix} 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 1 \\ 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 \end{bmatrix}$$
• but how do you write it? Trial and error? Or some rule/logic? – low iq Jun 5 '16 at 11:58
• @lowiq of course not trial and error; that's lame. This is based on theorems. I might expand my answer later, but if you are interested, you may want to read about the invariant factors and rational canonical forms of matrices – user258700 Jun 5 '16 at 12:05
• In Wikipedia, it is written that companion matrix has minimal polynomial P.what does it mean? Minimal polynomial should satisfy the matrix. How does p satisfies the matrix? – low iq Jun 5 '16 at 12:20 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9752018448494248,
"lm_q1q2_score": 0.8327372902061927,
"lm_q2_score": 0.8539127510928476,
"openwebmath_perplexity": 114.7351915532728,
"openwebmath_score": 0.9999595880508423,
"tags": null,
"url": "https://math.stackexchange.com/questions/1814376/minimal-polynomial-of-n-by-n-matrix"
} |
quantum-mechanics, quantum-entanglement, speed
Title: Can a link between photons that don't exist at the same time provide communication with the past? They have published something about a link between photons that don't exist at the same time. Does this means that it is possible to build a device that will receive messages from itself but these messages will be received earlier than they will be sent? Can someone operating this device can win the lottery? How would you describe in numbers the bandwidth of such device? Larger than infinite? Negative? The global answer is "No".
You cannot go back into past, you cannot receive a message before you send it, you cannot win the lottery, and so on.
Photon Entanglement are only special correlations (quantum correlations).
This does not violate causality, and this does not allow you to send a message faster than light.
Let's take a basic example about correlations, in this case a simple classical correlation. | {
"domain": "physics.stackexchange",
"id": 7883,
"lm_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, quantum-entanglement, speed",
"url": null
} |
A number is divisible by $18$ iff it's divisible by $2$ and $9$. So, we must have $b \in \{0,2,4,6,8\}$ and $7+a+5+b$ divisible by $9$, since a number is divisible by $9$ iff the sum of its digits is divisible by $9$. I think you can solve it by now.
-
Since it is divisible by $18$, $7a5b$ must be divisible by $9$ and $2$. Using divisibility rules, $$b \text{ must be even}$$ $$7+a+5+b \text{ must be divisible by 9}$$ So if $b$ is even it is of the form $2k$ for some integer $k$. So then $7+a+5+2k=9m$. Now use cases for $b$. For example, when $b=2$, $$7+a+5+2=14+a$$ So $a$ must be 4 since $14+4=18=9\cdot2$. Now, what about $a=4,6,8,10$? You can try them on your own.
-
Thanks a lot. I just solved it. – Ally Jan 4 '14 at 13:47
One way:
$$7a5b=7050+100a+b\equiv 12+10a+b\pmod{18}$$
Clearly, $b$ must be even
and $9$ must divide $12+10a+b=12+10a+b\iff 3+a+b$ must be divisible by $9$
For example,
if $b=0,3+a$ must be divisible by $9\implies a=6$ as $0\le a\le9\iff3\le a+3\le12$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9822877044076956,
"lm_q1q2_score": 0.8120688345982903,
"lm_q2_score": 0.8267117983401363,
"openwebmath_perplexity": 221.70783976751986,
"openwebmath_score": 0.8290666341781616,
"tags": null,
"url": "http://math.stackexchange.com/questions/626917/whats-the-digit-a-in-this-number"
} |
homework-and-exercises, aerodynamics, viscosity
References:
http://en.wikipedia.org/wiki/Atmospheric_entry
http://en.wikipedia.org/wiki/Space_Shuttle_thermal_protection_system#Why_TPS_is_needed
http://en.wikipedia.org/wiki/Convection | {
"domain": "physics.stackexchange",
"id": 16556,
"lm_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, aerodynamics, viscosity",
"url": null
} |
ros, slam, navigation, g2o, cmake
Originally posted by sunilsulania9192 on ROS Answers with karma: 224 on 2012-09-03
Post score: 0
I think the error is only with g2o. Have you built g2o before rgbdslam? If not do,
$rosmake g2o
$rosmake rgbdslam
otherwise (if g2o is already built)
$rosmake --pre-clean rgbdslam.
Originally posted by Sudhan with karma: 171 on 2012-09-03
This answer was ACCEPTED on the original site
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 10876,
"lm_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, slam, navigation, g2o, cmake",
"url": null
} |
Structure and Randomness
The solution to this puzzle explores the structure in randomness. A lot of work in computer science is based on looking at the structure (or expected structure) of a randomly chosen object. A very elegant kind of proof consists in creating a random process that generates object and prove that some object exists because is happens with positive probability. One simple, yet very beautiful example, is the following theorem: given any logic expression in 3-CNF form, i.e., one expression of the kind:
$\displaystyle \bigwedge_i (a_{i1} \vee a_{i2} \vee a_{i3})$ | {
"domain": "bigredbits.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9890130586647623,
"lm_q1q2_score": 0.8198312999946107,
"lm_q2_score": 0.8289388019824946,
"openwebmath_perplexity": 295.07903853169154,
"openwebmath_score": 0.7653859257698059,
"tags": null,
"url": "http://www.bigredbits.com/archives/54"
} |
homework-and-exercises, electrostatics, electric-fields, potential
&=&\underline{-\frac{\lambda}{2\pi\epsilon_0}\ln{\frac{r_x}{a}}} .\end{eqnarray*}$$
Now I can do the same thing for the "y-wire's" potential using the same finite reference point a to get
$$\phi_{y}(\vec{r})=\underline{-\frac{\lambda}{2\pi\epsilon_0}\ln{\frac{r_y}{a}}}.$$
$r_x$ and $r_y$ I know from above, so if I add the two potentials relying on the superposition principle, my total potential for both wires should look like this:
$$\begin{eqnarray*}\phi_{total}(\vec{r})=\phi_{x}(\vec{r})+\phi_{y}(\vec{r}) &=& -\frac{\lambda}{2\pi\epsilon_0}\ln{\frac{r_x}{a}}+\left(-\frac{\lambda}{2\pi\epsilon_0}\ln{\frac{r_y}{a}}\right) \\
&=& -\frac{\lambda}{2\pi\epsilon_0}\left(\ln{\frac{r_x}{a}}+\ln{\frac{r_y}{a}}\right) \\
&=& \underline{\underline{-\frac{\lambda}{2\pi\epsilon_0}\ln{\frac{r_x\cdot r_y}{a^2}}}}.\end{eqnarray*}$$
Now if I plug in $r_x$ and $r_y$ I get | {
"domain": "physics.stackexchange",
"id": 26290,
"lm_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, electric-fields, potential",
"url": null
} |
javascript, node.js
if (fse.existsSync(directory)) {
fse.removeSync(directory, err => {
if (err) {
console.log(err);
} else {
console.log("Success");
}
})
} else {
fse.mkdirpSync(directory, err => {
if (err) {
console.log(object);
} else {
console.log("Success");
}
})
}
}
})
}) The built in file system package (fs) provides you with a commands to create directories.
fs.mkdirSync(path[, options]) for synchronous
fs.mkdir(path[, options], callback) for asynchronous
According to their documentation, you can add an option for recursively creating a folder. It also notes
"Calling fs.mkdir() when path is a directory that exists results in an error only when recursive is false." | {
"domain": "codereview.stackexchange",
"id": 36632,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, node.js",
"url": null
} |
javascript, game-of-life
if(!running) {
o.init();
}
else if(!o.start) {
o.start = stepNum;
}
else {
let steps = stepNum - o.start;
o.start = stepNum;
o.total += steps;
o.n++;
o.speed.textContent = steps + " /sec, average: " + (o.total/o.n).toFixed(2);
o.period.textContent = "fastest: " + o.fastest + "ms, slowest: " + o.slowest
+ ", average: " + (o.totalMs/o.m).toFixed(1);
}
}
};
setInterval( speedo.monitor, 1000);
/******************************************************/ | {
"domain": "codereview.stackexchange",
"id": 23510,
"lm_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, game-of-life",
"url": null
} |
lagrangian-formalism, variational-principle, constrained-dynamics
\end{equation}
and
\begin{equation}
\left(\frac{\delta f}{\delta z} - \frac{d}{dx}\frac{\delta f}{\delta z'} \right)= 0
\end{equation}
so that $\frac{\delta J}{\delta \alpha} = 0$ when $\alpha =0$, but now because of the constraint, "the variations $\frac{\delta y}{\delta \alpha}$ and $\frac{\delta z}{\delta \alpha}$ are no longer independent, so the expressions in parentheses do not separately vanish at $\alpha = 0$"
$\textbf{Question}$
Why are $\frac{\delta y}{\delta \alpha}$ and $\frac{\delta z}{\delta \alpha}$ no longer independent?
I would really appreciate if you could help me understand it. | {
"domain": "physics.stackexchange",
"id": 85382,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "lagrangian-formalism, variational-principle, constrained-dynamics",
"url": null
} |
oceanography, data-analysis, software
I do the same with the rest of the parameters. Now in order to validate this step, I first have to test every value and for that I choose the update test option, so in principle in the test column (next to conversion column) those first parameter values should appear according to the output format (format column).
The problem is that nothing appears in the test column. I've tried several times repeating the process from scratch without getting any error message when validating steps, but every time I get to the data tab, choose parameters, select the right start/end and try to update test, it continues appearing nothing. Besides, if I try anyway to validate the step, I get no error or succes message in the log tab at the bottom of the program screen. At this step the program doesn't let me change nothing else. | {
"domain": "earthscience.stackexchange",
"id": 2033,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "oceanography, data-analysis, software",
"url": null
} |
quantum-mechanics, atomic-physics, spectroscopy, atoms, orbitals
Title: Is my understanding of the limitations of the Bohr model related to atomic spectra correct? I'm talking about a neutral hydrogen atom here: | {
"domain": "physics.stackexchange",
"id": 83565,
"lm_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, atomic-physics, spectroscopy, atoms, orbitals",
"url": null
} |
Combinatorics proof: From a group of $m$ people (among which $n$ are left-handed) we can pick a committee of $n$ people by picking $k$ left-handers and $n-k$ right-handers, $0\le k\le n$.
\begin{align} \color{#f00}{\sum_{k = 0}^{n}{n \choose k}{m - n \choose n - k}} & = \sum_{k = 0}^{n}{n \choose k}\ \overbrace{\oint_{\verts{z} = 1}{\pars{1 + z}^{m - n} \over z^{n - k + 1}} \,{\dd z \over 2\pi\ic}}^{\ds{{m - n \choose n - k}}}\ =\ \oint_{\verts{z} = 1}{\pars{1 + z}^{m - n} \over z^{n + 1}}\ \overbrace{\sum_{k = 0}^{n}{n \choose k}z^{k}}^{\ds{\pars{1 + z}^{n}}}\ \,{\dd z \over 2\pi\ic} \\[3mm] & =\ \underbrace{% \oint_{\verts{z} = 1}{\pars{1 + z}^{m} \over z^{n + 1}} \,{\dd z \over 2\pi\ic}}_{\ds{{m \choose n}}}\ =\ \color{#f00}{{m \choose n}} \end{align} | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9759464443071381,
"lm_q1q2_score": 0.806826444223583,
"lm_q2_score": 0.8267118026095992,
"openwebmath_perplexity": 1192.375946335043,
"openwebmath_score": 0.9538273811340332,
"tags": null,
"url": "https://math.stackexchange.com/questions/1802387/prove-sum-k-0n-binomnk-binomm-nn-k-binommn"
} |
ros, navigation, move-base, global-planner
bool done = false;
int i,n;
float *Coordinate_Array = NULL;
char* Filename;
Filename = "/home/p3dx/fuerte_workspace/navigation/carrot_planner/src/Coordinate.txt";
FILE *fp = NULL;
fp = fopen(Filename, "r");
fscanf(fp, "%d", &n);
Coordinate_Array = Readfile2D(Filename);
for (i=0; i<n; i++)
{
geometry_msgs::PoseStamped first_start = start;
geometry_msgs::PoseStamped first_goal = goal;
first_start.pose.position.x=Coordinate_Array[i*2]-Coordinate_Array[0];//offset
first_start.pose.position.y=Coordinate_Array[i*2+1]-Coordinate_Array[1];
first_goal.pose.position.x=Coordinate_Array[i*2+2]-Coordinate_Array[0];
first_goal.pose.position.y=Coordinate_Array[i*2+3]-Coordinate_Array[1];
plan.push_back(first_start);
tf::Stamped<tf::Pose> goal_tf;
tf::Stamped<tf::Pose> start_tf;
poseStampedMsgToTF(first_goal,goal_tf);
poseStampedMsgToTF(first_start,start_tf); | {
"domain": "robotics.stackexchange",
"id": 13648,
"lm_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, navigation, move-base, global-planner",
"url": null
} |
kinematics, acceleration, velocity
- what you can do is to demonstrate in experiments that they actually fit the real world, and that every prediction you can make using these laws (e.g., what happens if I shoot a cannon ball in this-and-that direction?) actually works in practice. | {
"domain": "physics.stackexchange",
"id": 96002,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "kinematics, acceleration, velocity",
"url": null
} |
ros, ros-melodic, diagnostic-aggregator, diagnostics
Title: Trigger action according to diagnostics
Hello,
I have nodes publishing diagnostic data and I have configured them correctly and I can visualize them in Rviz.
But now I would like to trigger some actions, for example ring a buzzer when one sensor fails.
Do I need to create my own diagnostic analyzer that will do what I need ? Or do I need to write a node that will subscrive to /diagnostics_agg or /diagnostics_toplevel_state ?
Thanks a lot ! :) | {
"domain": "robotics.stackexchange",
"id": 35148,
"lm_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, ros-melodic, diagnostic-aggregator, diagnostics",
"url": null
} |
geophysics, climate, rain, nitrogen
Can this effect be seen in Sprinkler irrigation ?
Is it possible to mimic this effect in other irrigation methods? I think what you mean by thermo-electric nitrogen fixation is the nitric oxides created by lightning discharges. This is absorbed by the raindrops as they form and as they fall to earth, and helps to fertilise the soil. You won't get this effect with sprinkler irrigation to any great extent, because the water droplets are exposed to the nitrogen oxides for far less time. In addition, sprinkler use is not usually accompanied by lighting flashes, whereas rain sometimes is. | {
"domain": "earthscience.stackexchange",
"id": 1926,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "geophysics, climate, rain, nitrogen",
"url": null
} |
bash, linux, networking
virsh start "$1" &>/dev/null
for ((i=0; i<=maxcounter; i++))
do
sleep "$sleeptime"s
loc_vmstatus=$( virsh list --all | grep "$1" | awk '{print $3}' )
if [ "$loc_vmstatus" == "$vmstate_running" ] || [ "$loc_vmstatus" == "$vmstate_running_localized" ]
then
break
fi
done
} | {
"domain": "codereview.stackexchange",
"id": 32281,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "bash, linux, networking",
"url": null
} |
c#, algorithm, programming-challenge, depth-first-search, backtracking
Title: Leetcode 17. Letter Combinations of a Phone Number Problem Statement
Given a digit string, return all possible letter combinations that the number could represent.
A mapping of digit to letters (just like on the telephone buttons) is given below.
Input: Digit string "23"
Output: ["ad", "ae", "af", "bd", "be", "bf", "cd", "ce", "cf"].
Note:
Although the above answer is in lexicographical order, your answer could be in any order you want.
My explanation of algorithm
I spent more than one hour to review my last practice, and like to ask code review for C# code.
Highlights of change
Use meaningful variable names
the depth first search function has 5 arguments, I chose to order
the arguments using 3 categories, input, DFS helper, output.
Use var explicit typing when possible.
Add two test cases. | {
"domain": "codereview.stackexchange",
"id": 24210,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, algorithm, programming-challenge, depth-first-search, backtracking",
"url": null
} |
java, performance
W.initialize(matrix, rows, cols, "matrixB.txt");
W.display(matrix);
W.findWords(matrix, "words.txt");
}
} You've asked about how to improve performance, but I would advise you to improve the code organization first. It's rather difficult to do a good job of optimizing the performance with the code in its current form.
Specifically, your code violates the Single-Responsibility Principle, as exemplified in findWords(), which does…
Read a file containing a list of words.
For each word, display it in yellow, while worrying about laying out that list in a two-column format.
Search for the word in the matrix.
Highlight rectangles to display the progress as the search progresses.
Call displayWord() when the word is found — which sleeps (making benchmarking difficult). | {
"domain": "codereview.stackexchange",
"id": 17040,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, performance",
"url": null
} |
java, strings
Title: Elegant solution to find a pair of Strings in a List I'm new to Java8 and I must find an elegant solution to a problem. The problem goes I have a List of letters (of any size) that could contain any letter such as "A", "B", "C", "D", etc. I must check if I have an pair of "A" and "B". So, if I have something like ["A", "A", "C", "Z"], since I don't have both "A" and "B" the code should throw an error. I need to refactor something like this in java8...
import java.util.Arrays;
import java.util.List;
public class atest { | {
"domain": "codereview.stackexchange",
"id": 37556,
"lm_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, strings",
"url": null
} |
sql, vba, excel, db2
If Len(Gender) > 0 Then
Wheres.Add "CFSEX = '" & Gender & "'"
Else
Wheres.Add "CFSEX != 'O'"
End If
If Len(City) > 0 Then Wheres.Add "CFCITY = '" & UCase(City) & "'"
If Len(State) > 0 Then Wheres.Add "CFSTAT = '" & UCase(State) & "'"
Dim SQL As String
If Wheres.Count > 0 Then
Dim Values() As String
ReDim Values(1 To Wheres.Count)
Dim n As Long
For n = 1 To Wheres.Count
Values(n) = Wheres(n)
Next
SQL = BaseSQL & vbNewLine & "WHERE " & Join(Values, " AND ")
Else
SQL = BaseSQL
End If
getCFMASTSQL = SQL
End Function | {
"domain": "codereview.stackexchange",
"id": 36500,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "sql, vba, excel, db2",
"url": null
} |
string-theory, supersymmetry, ads-cft, superconformality, supergravity
To start off how one know that the operators ${\cal O}_1$ and ${\cal O}_2'$ related to the boundary values of the two scalar fields are actually (super?)conformal primaries of the boundary (S?)CFT?
I did not understand how one sees that the deformation as stated in equation 4.12 (and the line before it) preserves quantum conformal invariance.
and the main point about the structure of equation 4.12 and the conformal invariance of the boundary being maintainable for $f \neq 0$.. First, the paper is relatively famous but among Witten's papers, at less than 200 citations, it is his average paper. | {
"domain": "physics.stackexchange",
"id": 4725,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "string-theory, supersymmetry, ads-cft, superconformality, supergravity",
"url": null
} |
tic-tac-toe, ai, delphi
GridPrint[6] := Symbol;
goto Finish;
end;
if GridStore[9] = -3 then
begin
GridStore[9] := P1Bot;
GridPrint[9] := Symbol;
goto Finish;
end;
end;
if WinCon[7] = ((2 * y) - 3) then
begin
if GridStore[1] = -3 then
begin
GridStore[1] := P1Bot;
GridPrint[1] := Symbol;
goto Finish;
end;
if GridStore[5] = -3 then
begin
GridStore[5] := P1Bot;
GridPrint[5] := Symbol;
goto Finish;
end;
if GridStore[9] = -3 then
begin
GridStore[9] := P1Bot;
GridPrint[9] := Symbol;
goto Finish;
end;
end;
if WinCon[8] = ((2 * y) - 3) then
begin
if GridStore[3] = -3 then
begin
GridStore[3] := P1Bot;
GridPrint[3] := Symbol;
goto Finish;
end;
if GridStore[5] = -3 then
begin
GridStore[5] := P1Bot;
GridPrint[5] := Symbol;
goto Finish;
end;
if GridStore[7] = -3 then
begin
GridStore[7] := P1Bot; | {
"domain": "codereview.stackexchange",
"id": 29988,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "tic-tac-toe, ai, delphi",
"url": null
} |
c, strings, security, library
if (the_string == NULL || word == NULL) {
return -1;
}
if (strlen(the_string) == 0 || strlen(word) == 0) {
return -1;
}
do {
pch = strstr(pch, word);
if (pch != NULL) {
pch += strlen(word);
count++;
}
} while(pch != NULL);
return count;
} | {
"domain": "codereview.stackexchange",
"id": 12622,
"lm_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, strings, security, library",
"url": null
} |
black-hole, radio-astronomy
The paper Indication of Another Intermediate-mass Black Hole in the Galactic Center (open access) is pretty hard to read as it details the careful analysis of ALMA data reduction and analysis.
Question: How did the authors determine both the spatial size of gas cloud HCN-0.009-0.044 and the mass of the central object at the same time? The gas clouds are much larger than you think: From Fig. 1 of the paper (Takakawa 2019), the largest cloud (which they call the "Balloon") is roughly 10 arcsec across. Now they can't actually measure its exact distance, but its projected distance from the Galactic center is only 7 pc, and the authors argue that it's at least 5 kpc away due to absorption from molecular gas which is known at this distance (Sofue 2006), and since such hot and high density ($\sim 10^7\,\mathrm{cm}^{-3}$) molecular gas is abundant in the Galactic center, it is probably located there, i.e. at a distance of $R=8\,\mathrm{kpc}$.
The cloud's absolute size is thus
$$ | {
"domain": "astronomy.stackexchange",
"id": 3529,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "black-hole, radio-astronomy",
"url": null
} |
ros-melodic
Title: RViz Grid Direction
I'm trying to make a little sense of the grid that is drawn in RViz relative to its frame. I set it to be tied to . I want to be able to look at the grid and understand where on the displayed grid, for example, I would find point 1,1.
It seems to me that vertical is x, with zero in the middle, and positive up. Makes sense. But then that horizontal is y. But from my coding it is acting as if left is positive and right is negative.
Is that true, or is there something in my setup that is incorrectly configured? THanks,
Originally posted by pitosalas on ROS Answers with karma: 628 on 2019-08-11
Post score: 0
As described in REP 103 the default convention is x forward, y left, z up. The grid display shows a grid in the xy plane, with the option for 3D visualization also using the z axis by setting "Normal Cell Count" to a non-zero value. | {
"domain": "robotics.stackexchange",
"id": 33602,
"lm_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-melodic",
"url": null
} |
javascript, angular.js
Is there a more concise way to achieve this functionality?
I was thinking something along these lines:
var setComponentVisibility = function (componentName = null)
{
var bool = false;
var map = {
'Regions': vm.showRegions = bool,
'Accounts': vm.showAccounts = bool,
'Orders': vm.showOrders = bool,
'Invoices': vm.showInvoices = bool,
'Warehouses': vm.showWarehouses = bool
}
if (componentName != null)
{
// code to set bool to true only for that componentName in map
// is this even possible?
// if so, how?
}
}
However, being new to AngularJS, I'm not sure the above is possible. You can use Bracket Notation to have custom object key by ['text'+variable].
vm.showComponent = function(componentName)
{
hideComponents();
vm['show' + componentName]=true;
} | {
"domain": "codereview.stackexchange",
"id": 31713,
"lm_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, angular.js",
"url": null
} |
seismic
Hence, the image that you have is probably a migrated stack, varying from extremely light blue to dark blue to grey to red to yellow. The z axis corresponds to (approximate) depth, the x axis corresponds to receiver positions/offsets. All the lines are contrasts between rock types that have been geologically deformed, either a positive or negative impedance contrast. Features of interest to geologists are too numerous to mention, but of basic interest are (1) tracking a whole line over the entire image to see the continuity of a single reflecting unit, (2) seeing a fault -- where a reflector breaks and picks up a bit below, (3) finding really intense ('bright') spots in the data, (4) finding salt, e.g., as done here https://www.kaggle.com/c/tgs-salt-identification-challenge/ ...
But yeah, demand more information from whoever wants you to do this work about what features are of interest because there's too much in the image to just blindly start learning things... | {
"domain": "earthscience.stackexchange",
"id": 1801,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "seismic",
"url": null
} |
Each set $F_i$ is compact since it is closed in $Z$. The intersection of finitely many $F_i$ is also compact. Thus the $\cap G$ in the definition of $Y$ in the above claim is compact. There can be only countably many $\cap G$ in the definition of $Y$. Thus $Y$ is a $\sigma$-compact space that is covered by the open cover $\mathcal{U}$. Choose a countable $\mathcal{V} \subset \mathcal{U}$ such that $\mathcal{V}$ covers $Y$. Then $\mathcal{V}$ is a cover of $X$ too. This completes the proof that $X$ is Lindelof.
$\text{ }$
Proof of Theorem 4
Recall that $Z=\prod_{i=1}^\infty Z_i$ and that $X=\prod_{i=1}^\infty C_i$. Each $Z_i$ is the one-point compactification of $C_i$, which is the topological sum of the disjoint compact spaces $C_{i,1},C_{i,2},\cdots$.
For integers $i,j \ge 1$, define $K_{i,j}=C_{i,1} \oplus C_{i,2} \oplus \cdots \oplus C_{i,j}$. For integers $n,j \ge 1$, define the product $F_{n,j}$ as follows: | {
"domain": "wordpress.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9843363499098282,
"lm_q1q2_score": 0.8366575264457774,
"lm_q2_score": 0.8499711775577736,
"openwebmath_perplexity": 148.87961063114636,
"openwebmath_score": 0.9994206428527832,
"tags": null,
"url": "https://dantopology.wordpress.com/tag/point-set-topology/"
} |
thermodynamics, temperature, kinetic-theory, thermal-conductivity, heat-conduction
In the context of Fourier's law, the two "plates" have not to be intended as two physical objects, but are just two geometric surfaces of the same material which fills the whole space in between, used to evaluate the integral of the heat flux density.
The physical problem of finding the temperature field between two $physical$ plates at different temperature, one in front of the other, may require more than the Fourier law (for example, if between the two surfaces there would be a gas, convective motion could play an important role). | {
"domain": "physics.stackexchange",
"id": 53938,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "thermodynamics, temperature, kinetic-theory, thermal-conductivity, heat-conduction",
"url": null
} |
python, algorithm
Then, reduce the number of line comparisons for whatever your problem is. I suggest learning about longest repeated substring (as suggested), and maybe suffix trees.
If you want to squeeze the last ounce of performance out of something line-based, you can try pre-processing by hashing the lines into integers. | {
"domain": "codereview.stackexchange",
"id": 41957,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, algorithm",
"url": null
} |
php, form, symfony2
Title: Friends edit form I have a list of friends and new friends are added via a form. When you click on a friend you see all the information about him. There is also an Edit button. When clicking it, I want a form to be displayed (the same as the form for adding) but already filled with the current information about the friend.
It is working this way:
class FriendController extends Controller
{
public function editDisplayAction($id, Request $request)
{
$em = $this->getDoctrine()->getEntityManager();
$friend = $em->getRepository('EMMyFriendsBundle:Friend')->find($id);
if (!$friend)
{
throw $this->createNotFoundException('There is no such friend');
}
$edit_fr_form = $this->createForm(new FriendType(), $friend); | {
"domain": "codereview.stackexchange",
"id": 2283,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "php, form, symfony2",
"url": null
} |
computability, programming-languages, type-theory, types-and-programming-languages
Title: Does Types and Programming Languages use a recursive equation to define a recursive type or its generator? In Types and Programming Languages by Pierce et al:
The recursive equation specifying the type of lists of numbers is similar to the equation specifying the recursive factorial function on page 52:
factorial = λn. if n=0 then 1 else n * factorial(n-1)
Here, as there, it is convenient to make this equation into a proper definition by moving the “loop” over to the right-hand side of the =.
We do this by introducing an explicit recursion operator µ for types:
NatList = µX. <nil:Unit, cons:{Nat,X}>;
Intuitively, this definition is read, “Let NatList be the infinite type satisfying
the equation X = <nil:Unit, cons:{Nat,X}>.”
I have some questions for understanding it: | {
"domain": "cs.stackexchange",
"id": 14543,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "computability, programming-languages, type-theory, types-and-programming-languages",
"url": null
} |
c++, algorithm, graph, breadth-first-search
I also see you created a constant Graph::invalid_node, but you never seem to use it anywhere else.
Unnecessary use of floating points
Your use of floating point numbers in middleNodes() is unnecessary. If you start with integer numbers and have to end up with integer numbers, avoid having floating points in the middle; it's usually unnecessary, it's less efficient, and if you are not aware of all the subtle issues (like the fact that not all integers can be represented correctly by a floating point number of the same size) it's easy to introduce bugs. Consider:
if (maxDist % 2 == 0) {
maxDistDivBy2 = {maxDist / 2, maxDist / 2};
} else {
maxDistDivBy2 = {maxDist / 2 + 1, maxDist / 2};
} | {
"domain": "codereview.stackexchange",
"id": 44049,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, algorithm, graph, breadth-first-search",
"url": null
} |
quantum-mechanics, homework-and-exercises, quantum-information, quantum-entanglement
Here $|ii〉 ≡ |i〉_A⊗|i〉_B$, both local bases $\{|i〉\}_{A,B}$ depend on the state $|\Psi\rangle$ | {
"domain": "physics.stackexchange",
"id": 68121,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, homework-and-exercises, quantum-information, quantum-entanglement",
"url": null
} |
deep-learning, nlp
Title: For text match problem, what is the different between question-question match and question-answer match? I know question-question match is a text similarity problem.
What about question-answer or question-doc match? It is used in information retrieval.
question-question match is indeed text similarity. But how do you define question-answer similarity?
Thank you!! You can refer to the paper "A Deep Look into Neural Ranking Models for
Information Retrieval" to get more discussion about different matching tasks. | {
"domain": "datascience.stackexchange",
"id": 5827,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "deep-learning, nlp",
"url": null
} |
general-relativity, gravity, visible-light, black-holes
Title: Could you view yourself in high gravity situations? I'm trying to understand what effects gravity can have on light. First of all, I don't understand how gravity can even affect it, since it doesn't have mass, right? That is probably a separate question though.
When gravity is strong enough, it bends light towards the source of the gravity. So if you were on a small planet and gravity were to gradually increase, would the horizon rise as well, allowing you to see further? If so, at some point, could you look up at some angle and have the light go all the way around the planet and back to yourself, in which case you would essentially be looking up at yourself?
Also, as the gravity increases, is there a point at which light could orbit the planet indefinitely.
Is this the right place to ask questions like this?
When gravity is strong enough, it bends light towards the source of the gravity.
Roughly true | {
"domain": "physics.stackexchange",
"id": 23984,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "general-relativity, gravity, visible-light, black-holes",
"url": null
} |
human-biology, evolution, zoology, mutations
Title: Has a beneficial mutation ever been documented? I am trying to find a case/study where scientists documented a mutation in an animal or human that was to the benefit of the host.
The closest thing I have been able to find is sickle cell anemia (SCA) helping to fight malaria. However, the life expectancy for people with SCA is 40 – 60 years, and in 1973 it was only 14 years (source). I am looking for another case, preferably one that is not life-threatening.
Are there any other cases where a beneficial mutation — one where the good outweighs the bad — was documented?
By beneficial I simply mean that it helps or protects the host in some way, while not causing substantial harm. As in my example of SCA it can benefit the host if the host lives in an area with malaria. However, it is also life threatening and reduces the life expectancy of the host. | {
"domain": "biology.stackexchange",
"id": 6729,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "human-biology, evolution, zoology, mutations",
"url": null
} |
This is an old friend. If $f$ may be discontinuous, as a counterexample you can propose $$f(x) = \chi_{\{n \mid n \in \mathbb{N}\}}(x) = \begin{cases} 1 &\text{if x \in \mathbb{N}}\\ 0 &\text{otherwise}. \end{cases}$$ If you want a continuous counterxample, you must play with "bump" functions, for instance a function that is mostly zero but that has small bumps of smaller and smaller area.
• @JaneR You should try to construct a counterexample by yourself. Start from the discontinuous example above, and draw small triangle with one side on the $x$-axis. Now you should make these triangles smaller and smaller, so that the infinite sum of their areas is convergent. See also math.stackexchange.com/questions/85975/… – Siminore Jun 18 '16 at 17:09
The statement is false. See Fresnel-Integrals $$\int_{0}^{\infty}\cos(t^2)=\int_{0}^{\infty}\sin(t^2)=\frac{\sqrt{2a}}{4}$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9688561676667173,
"lm_q1q2_score": 0.8135814376644018,
"lm_q2_score": 0.8397339716830606,
"openwebmath_perplexity": 507.5354152121015,
"openwebmath_score": 0.758170485496521,
"tags": null,
"url": "https://math.stackexchange.com/questions/1831018/t-f-if-int-1-inftyfxdx-converges-then-lim-x-to-inftyfx-0?noredirect=1"
} |
gazebo, rviz
Originally posted by rctaylor on ROS Answers with karma: 36 on 2012-07-13
Post score: 0
Original comments
Comment by rctaylor on 2012-07-17:
I've noticed that the problem is inconsistent which leads me to believe it has something to do with the order (or timing) of things being loaded.
This likely is the same issue reported here. I created a ticket on the gazebo trac here and a bug was found in the way transformations are aggregated. The fix doesn't seem to have been incorporated yet however.
Originally posted by Stefan Kohlbrecher with karma: 24361 on 2012-07-13
This answer was ACCEPTED on the original site
Post score: 1
Original comments
Comment by rctaylor on 2012-07-16:
It sounds like you have a fixed version of Gazebo. Could you try the NASA R2 simulator to confirm that the fix resolves this problem as well? Should just require 2 steps (sudo apt-get install nasa_r2_simulator; roslaunch r2_gazebo r2_empty.launch). The problem is obvious in the elbow and fingers. | {
"domain": "robotics.stackexchange",
"id": 10187,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gazebo, rviz",
"url": null
} |
of how the object is rotating. Disagree 5. The second moment of area, also known as area moment of inertia, is a geometrical property of an area which reflects how its points are distributed with regard to an arbitrary axis. The second moment of area, also known as moment of inertia of plane area, area moment of inertia, polar moment of area or second area moment, is a geometrical property of an area which reflects how its points are distributed with regard to an arbitrary axis. (Filename:tfigure3. The moment of inertia on a quarter circle is giver by: Ix=(pi*r^4)/16 So using Steiner's theorem to calculate the MoI of the Quarter circle on the main figure's centroid we get: Ix'=(pi*r^4)/16 + dy * (pi*r^2)/4 where dy is the difference between yG of the quarter circle and yG of the main figure. 1: Determine angular displacement. Key to deflection diagrams and symbols. What if we tried to find the area of a circle as though it were an ellipse? We would measure the radius in one direction: | {
"domain": "accademiakravmagaitalia.it",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9828232935032462,
"lm_q1q2_score": 0.8334024631854222,
"lm_q2_score": 0.8479677564567913,
"openwebmath_perplexity": 611.8841540734246,
"openwebmath_score": 0.6420783400535583,
"tags": null,
"url": "http://qupw.accademiakravmagaitalia.it/moment-of-inertia-of-quarter-circle.html"
} |
c++, optimization, strings, search
Title: Can this FindString function be optimized further, in terms of speed? int FindStr(char* str, int strsize, char* fstr, int from)
{
for(int i=from, j=0; i<strsize; i++)
{
if(str[i]==fstr[j])
j++;
else
{i-=j; j=0;}
if(fstr[j]=='\0')
return i-j+1;
}
return -1;
}
The function searches for a string fstr in str and returns its index in str if found, otherwise, it will return -1. It's also possible to specify where to start searching in the string.
My question is, can I optimize this function further? Also, do you see any potential problems in this function? Some comments to add to the first two of @200_success: | {
"domain": "codereview.stackexchange",
"id": 5489,
"lm_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, strings, search",
"url": null
} |
matlab, signal-analysis, modulation, snr
%MODULATION
ask=[];
for i=1:bits
if b(i)==1 % If bit = 1
ask=[ask carrier_signa_l];
else
ask=[ask carrier_signal_0];
end
end If it is a sinusoidal signal, there will be peak (among the frequency bins) in the frequency spectrum corresponding to the tone's frequency.
Ratio of the magnitude of this peak to the sum of the magnitudes of all other bins (which are noise) correspond to Signal to Noise Ratio.
But when its a non sinusoidal signal (like the one in your plot) you have to consider the relevant band of the signal instead of a single peak. you can quantify it by specifying a frequency bin corresponding to the mojor frquency component in the signal plus some leakage (related to bandwidth) into the nearby bins.
Please take a look in the following matlab code.
N = 8192; % FFT length
leak = 50;
% considering a leakage of signal energy to 50 bins on either side of major freq component | {
"domain": "dsp.stackexchange",
"id": 6572,
"lm_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, signal-analysis, modulation, snr",
"url": null
} |
ros2, roslaunch, ros-bouncy
Original comments
Comment by William on 2018-10-08:
I'll add that it is a specific choice to not have something like the ROS_PACKAGE_PATH (which would find packages even if they have not been built yet by searching) and instead require all packages to be installed before our tools can find them (allowing us to avoid all expensive searching).
Comment by severin on 2018-10-09:
But then the question surely is: why does ROS_PACKAGE_PATH find non-build packages? I've only ever pointed my ROS_PACKAGE_PATH to my install directories (and I thought it was the way it was supposed to be done...)
Comment by severin on 2018-10-09:
Thanks @jacobperron. In ROS1, the traditional, non-ROS-specific, cd build && cmake .. && make && make install sequence works great and install a setup.sh in $CMAKE_INSTALL_PREFIX. I'd rather do the same with ROS2 instead of using 'magic' tools like colcon.
Comment by Zhoulai Fu on 2018-12-22: | {
"domain": "robotics.stackexchange",
"id": 31863,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros2, roslaunch, ros-bouncy",
"url": null
} |
python, array, python-3.x
if __name__ == "__main__":
main()
value_list = []
Global variables are almost never necessary. If you are tempted to use a global, you have two choices:
Give the variable as an argument and reassign it to what the function returns (or just give it if the function mutates it).
Define a class and use instance attributes.
In this case, value_list is used by far too many things and with lambda functions and everything. Therefore, I would suggest that you define a Commands class.
"/add": lambda *value : value_list.extend(list(value))
You don't need to convert value to a list. That is just unnecessary processing time. A list can be extended by a list, a tuple, a string, a generator, ... whatever iterable you want.
"/rindex": lambda value : value_list.pop(int(value)), | {
"domain": "codereview.stackexchange",
"id": 19769,
"lm_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, array, python-3.x",
"url": null
} |
c#
Title: What would be alternative ways to model IConvention? public class Item { /*...*/ }
public class Model { /*...*/ }
public interface IConventionInstanceSelector {
IConventionInstance Select(Item item);
}
public interface IConventionInstance {
void ApplyTo(Model model);
}
public interface IConvention {
bool IsMatchedBy(Item item);
IConventionInstance CreateInstance(Item item);
}
public class ConventionInstanceSelector : IConventionInstanceSelector {
readonly List<IConvention<Item>> _conventions;
public ConventionInstanceSelector(IEnumerable<IConvention<Item>> conventions) {
_conventions = conventions.ToList();
}
public IConventionInstance Select(Item item) {
foreach(var convention in _conventions) {
if(convention.IsMatchedBy(item)) {
return convention.CreateInstance(item);
}
}
return NullConventionInstance.Instance;
}
}
public class ModelReader {
IConventionInstanceSelector _selector; | {
"domain": "codereview.stackexchange",
"id": 1383,
"lm_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
} |
quantum-mechanics, many-body, time-evolution
Title: Time evolution of a reduced density matrix For a bipartite quantum system evolving under some master equation, is the time derivative of the reduced density matrix equal to the partial trace of the time derivative of the matrix?
In other words, is the following true:
$\dot{\rho}_{A} = Tr_B(\dot{\rho}_{AB})$
(Where $\rho_A = Tr_B(\rho_{AB})$)
If not, is there some other simple method to find $\dot{\rho}_{A}$ from $\dot{\rho}_{AB}$? Yes, as long as $B$ doesn't depend on time. | {
"domain": "physics.stackexchange",
"id": 5586,
"lm_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, many-body, time-evolution",
"url": null
} |
mass, standard-model, elementary-particles
EDIT: To address the comments, I've removed the two gaps I put in by hand where there are subjective jumps between particles 10 and 11, and particles 13 and 14. The masses are in rank order, which is unique up to ascending or descending. I have also included the norm of residuals as the 'error'. To be clear, this is an approximation. The Kolmogorov complexity of the complete list (upper bound computed using Mathematica, $ByteCount[Compress[list]]$) is approximately 256, with an error of 0 (really a small positive $\epsilon$) using that description. With this description, the K-complexity is approximately 112, and the error is 4.31219. The comments seemed to imply that if you allow gaps, one could bring the error to zero. However, there is a cost in K-complexity. Here is a plot: | {
"domain": "physics.stackexchange",
"id": 69162,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "mass, standard-model, elementary-particles",
"url": null
} |
sql, sql-server, t-sql
DECLARE @insert_query varchar(max) = (select Concat('([', string_agg(cast(name as varchar(max)),'],['), '])', ' VALUES ([', string_agg(cast(name as varchar(max)),'],['), '])')
from sys.columns
WHERE object_id = OBJECT_ID(@DestinationTable) and generated_always_type = 0 and is_identity = 0 and system_type_id != 189);
DECLARE @merge_query varchar(max) = 'MERGE ' + @DestinationTable +
' USING ' + @SourceTable +
' ON (' + @SourceTable + '.' + @PrimaryKey + ' = ' + @DestinationTable + '.' + @PrimaryKey + ')' +
' WHEN MATCHED THEN UPDATE ' + @update_query +
' WHEN NOT MATCHED BY TARGET THEN INSERT ' + @insert_query +
' WHEN NOT MATCHED BY SOURCE THEN DELETE;';
select @merge_query;
EXEC(@merge_query)
END
GO
It appears to work. Is there any way in which this code can be improved? Also, I am not sure how to make this work with compound keys, but that might be off topic for this site.
Is there any way in which this code can be improved? | {
"domain": "codereview.stackexchange",
"id": 31540,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "sql, sql-server, t-sql",
"url": null
} |
mechanical-engineering, gears, applied-mechanics, mechanical, experimental-physics
Example A-
Constraints: gears cannot be less than 15 teeth(m1), gear cannot exceed 100 teeth(m1).
I need to use a compound stud gear system to result in a ratio of 7.81
Presently the solution that does not suit my constraints is a 20 tooth driving gear and a 156 tooth driven gear. I know I can guess around and then make minor adjustments to come up with a four to six gear system. I do have several more oddball ratios to solve and I would like to approach this with the aim of becoming a better engineer by applying physics and mathematics.
So, how do I go about this problem?
Sample A-
An example of a solution to an easier ratio of 2.55 is as follows:
https://geargenerator.com/#225,312.5,50,1,1,2,8288.700000012579,4,1,20,5,4,27,0,0,0,0,0,0,0,20,5,4,27,-86,0,0,0,0,1,0,51,12.75,4,27,0.3000000000000007,0,0,0,0,2,1,20,5,4,27,5.300000000000001,0,0,0,0,0,1,3,-229 | {
"domain": "engineering.stackexchange",
"id": 5213,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "mechanical-engineering, gears, applied-mechanics, mechanical, experimental-physics",
"url": null
} |
javascript, algorithm, sorting, typescript, complexity
return sorted; }
let array : data[] = [ { id: 4, parentPK : 1, orderPos:'100' , children:[]}, {id:1, parentPK : -1, orderPos:'1', children:[] }, { id:2, parentPK : 1, orderPos:'51',children:[] }, {id:3, parentPK : 2, orderPos:'1',children:[] }, {id:5, parentPK : 2, orderPos:'10',children:[] } ]
let sortedArray = sort(array)
console.log('sorted array : ',sortedArray.map(element => [element.id, element.parentPK,element.orderPos] ))
The main improvement that can be made in the algorithm is recognizing that you can reduce more expensive sorting (and make the algorithm a lot easier to understand at a glance) by arranging the data into a structure indexed by the parent ID first. This operation is O(n). (In contrast, sorting is O(n log n)) The data structure will look like: | {
"domain": "codereview.stackexchange",
"id": 40065,
"lm_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, algorithm, sorting, typescript, complexity",
"url": null
} |
the period. For Option B, you don't have time on your side, and the payment received in three years would be your future value. Time value of money. It also depends on whether we are working with an interest rate or a discount rate. If you choose to receive$15,000 today and invest the entire amount, you may actually end up with an amount of cash in four years that is less than $18,000. The offers that appear in this table are from partnerships from which Investopedia receives compensation. Using the numbers above, the present value of an$18,000 payment in four years would be calculated as $18,000 x (1 + 0.04)-4 =$15,386.48. However, many areas of accounting apply this concept in the measurement basis for certain items in the financial statements, as well as in the determination of adjustment items in some transactions. You have won a cash prize! Underlying Principle of Time Value of Money . Most obviously, there is inflation that reduces the purchasing power of money. In other words, | {
"domain": "saberion.org",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.984093606422157,
"lm_q1q2_score": 0.8045698082347964,
"lm_q2_score": 0.8175744695262775,
"openwebmath_perplexity": 844.4499617236826,
"openwebmath_score": 0.8469468355178833,
"tags": null,
"url": "http://cloverepublic.saberion.org/u33uz45q/y2n2f.php?page=2545aa-time-value-of-money-concept"
} |
In introductory finance courses, we are taught to calculate the standard deviation of the portfolio as a measure of risk, but part of this calculation is the covariance of these two, or more, stocks. Do October 10, 2008 A vector-valued random variable X = X1 ··· Xn T is said to have a multivariate normal (or Gaussian) distribution with mean µ ∈ Rn and covariance matrix Σ ∈ Sn 1. covariance calculator - step by step calculation to measure the statistical relationship (linear dependence) between the two sets of population data, along with. This calculator determines the following coin toss probability scenarios * Coin Toss Sequence such as HTHHT * Probability of x heads and y tails * Covariance of X and Y denoted Cov(X,Y) * The. Is there a relationship between Xand Y? If so, what kind? If you’re given information on X, does it give you information on the distribution of Y? (Think of a conditional distribution). It's an online statistics and probability tool requires two sets of | {
"domain": "agence-des-4-fontaines.fr",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9877587218253718,
"lm_q1q2_score": 0.8581912259846873,
"lm_q2_score": 0.8688267762381844,
"openwebmath_perplexity": 553.4405559171647,
"openwebmath_score": 0.7428514361381531,
"tags": null,
"url": "http://oqxm.agence-des-4-fontaines.fr/covariance-calculator-with-probability.html"
} |
sql, vba, ms-access
The hungarian notation isn't necessary either. Things like lngCurrDocTblRecordCount aren't necesary in the modern IDE. I'm sure you read somewhere that it's best practice, but it's just clutter. I do like that I know exactly what that variable is though. It's a little long, but its meaning is clear.
I'll reiterate what @Malachi said about the Do While Not loops. Do Until is easier to understand.
On the other hand, this If Right(strCOMMENT2, 1) <> "~" Then is probably more understandable as
If Not Right(strCOMMENT2, 1) = "~" Then
Speaking of strCOMMENT, you have the exact same logic for both 1 & 2. That's a dead give away that you need a function. This one will take a string parameter and return another string.
Private Function markCommentIfEmpty(str as String) As String
If str = vbNullString Then
markCommentIfEmpty = "¿"
Else
markCommentIfEmpty = str
End If
End
'called like this
strCOMMENT1 = markComment(strCOMMENT1) | {
"domain": "codereview.stackexchange",
"id": 7873,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "sql, vba, ms-access",
"url": null
} |
quantum-field-theory, quantum-electrodynamics, phase-space
$$
\int_{-1}^1 dz \delta \left( 2 - x_1 - x_2 - \sqrt{ x_1^2 + x_2^2 + 2 x_1 x_2 z + 4 \beta } \right)
$$
The argument of the delta function vanishes if $x_1 + x_2 \leq 2$ and
$$
z = 1 + 2 \frac{1-\beta-x_1-x_2}{x_1x_2}
$$
However, we get a non-zero contribution only if this value lies in $[-1,1]$. This implies
$$
- 1 \leq 1 + 2 \frac{1-\beta-x_1-x_2}{x_1x_2} \leq 1
$$
Since $x_1,x_2>0$, the upper bound gives $1-\beta \leq x_1+x_2 \leq 2 $. The lower bound gives
$$
x_2 \leq 1-\frac{\beta}{1 - x_1}
$$
This is where your upper bound comes from. This bound is violated if you choose $x_1=x_2=1-\beta$. | {
"domain": "physics.stackexchange",
"id": 99301,
"lm_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, quantum-electrodynamics, phase-space",
"url": null
} |
turing-machines, undecidability
The complement $\overline{H}$ of $H$, however, is not recognizable as if it was recognizable a Turing machine $M'$ for $\overline{H}$, together with $M$, would allow to solve the Halting problem. To do so simply simulate in parallel $M$ and $M'$ until one of them accepts. | {
"domain": "cs.stackexchange",
"id": 17083,
"lm_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, undecidability",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.