text stringlengths 1 1.11k | source dict |
|---|---|
c#, strings, .net-core
to
Dictionary<Match, string> dic = matches.Cast<Match>().Zip(sentences, (x, y)
=> new { Key = x, Value = y }).ToDictionary(x => x.Key, y => y.Value);
It comes for sure from copying the code (which seems to be posted using Shift + Enter for phrase) from this question to the IDE....if you inspect the result of dict you will see that from the second item on the Value is prepended by a \n. This can be prevented by using TrimStart('\n') on y at new { Key = x, Value = y }.
Implementing the mentioned points will lead to
static void Main(string[] args)
{
string phrase = @"MHD001|LOCCOD|GRCACS|20191117|133601|CB|trx_grcacs_tsk_20191117133601498|TSK001|GLS|GRCACS|59144|59144|2|TU|93000161357|TRACE|INF|DE 800|please send us the completely address information-thanks|68481|20191117|133555|TSA001|X|TSI001|3655|please send us the completely address information-thanks|66510|TSI001|5637|80337|61335|TSI001|5841|DE|61313|MTR001|5|"; | {
"domain": "codereview.stackexchange",
"id": 36966,
"lm_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, .net-core",
"url": null
} |
HP-SEEComputingChallenge 1/16. Nizhni Novgorod, 2005 Introduction to Parallel Programming: Matrix Multiplication ©GergelV. c / mv_mult_checkerboard. The multiplication of a vector by a matrix is the kernel operation in many algorithms used in scientific computation. Matrix Multiplication Basics Edit. Assignment 1: Matrix Multiplication using MPI Problem Description In this assignment, you are supposed to calculate the product of two matrices A (of size N*32) and B (of size 32*N), which should be an N*N matrix. 133, which involves fully implementing the Fox parallel algorithm for multiplying matrixes. A simple matrix multiplication. Tasks in each row of the. You will have to be a bit patient here. Tools>Matrix Algebra are one way of doing these sorts of data transformations. view, an n x n matrix A can be regarded as a q x q array of blocks A i,j (0 ≤i, j < q) such that each block is an (n/q) x (n/q) submatrix. example such that the scalar variable is treated like a scalar?. | {
"domain": "puntoopera.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9838471651778591,
"lm_q1q2_score": 0.8133580487147855,
"lm_q2_score": 0.8267117876664789,
"openwebmath_perplexity": 1441.1504902018999,
"openwebmath_score": 0.701557457447052,
"tags": null,
"url": "http://puntoopera.it/ruym/mpi-block-matrix-multiplication.html"
} |
c++, c++11, reinventing-the-wheel, vectors
template<class T> typename Vector<T>::ConstElement& Vector<T>::operator[](UInt offset) const
{
AssertVectorIsEmpty(_origin);
AssertRange(offset, Length());
return *(_origin + offset);
}
/******************************************************************************/
/* Accesors *******************************************************************/
/******************************************************************************/
template<class T> typename Vector<T>::CtorModeEnum Vector<T>::CtorMode() const
{
return _ctorMode;
}
template<class T> Bool Vector<T>::IsEmpty() const
{
return _last == _origin;
}
template<class T> UInt Vector<T>::Capacity() const
{
return _end - _origin;
}
template<class T> UInt Vector<T>::Length() const
{
return _last - _origin;
} | {
"domain": "codereview.stackexchange",
"id": 11274,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, c++11, reinventing-the-wheel, vectors",
"url": null
} |
\geq c+\epsilon \big)\bigg]\\ should become smaller and smaller as is a zero-probability event and the U. UniKaos. Join us for Winter Bash 2020. P\big(|X_n-X| \geq \epsilon \big)&=P\big(|Y_n| \geq \epsilon \big)\\ \lim_{n \rightarrow \infty} P\big(|X_n-0| \geq \epsilon \big) &=\lim_{n \rightarrow \infty} P\big(X_n \geq \epsilon \big) & (\textrm{ since $X_n\geq 0$ })\\ where $\sigma>0$ is a constant. Therefore, the above limit is the usual limit thatwhere , convergence are based on different ways of measuring the distance between two Let In general, the converse of these statements is false. Convergence in probability provides convergence in law only. , n ∈ N are all defined on the same probability space. is far from Let Xn ∼ Exponential(n), show that Xn p … is the indicator function of the event We can write for any $\epsilon>0$, Then, $X_n \ \xrightarrow{d}\ X$. isWe convergence in distribution is quite different from convergence in probability or convergence almost surely. . | {
"domain": "bastiroid.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.951142225532629,
"lm_q1q2_score": 0.8121924780212152,
"lm_q2_score": 0.8539127548105611,
"openwebmath_perplexity": 673.7103411425754,
"openwebmath_score": 0.9490130543708801,
"tags": null,
"url": "http://bastiroid.com/anko-rattan-dbaja/69be7d-convergence-in-probability"
} |
$P(H...HH or HH|H...) = \frac{1/3}{1/2} = 2/3$
$P(H...TT|H...) = \frac{1/6}{1/2} = 1/3$.
Check if it adds up: $P(T|H...) + P(H...HH or HH|H...) + P(H...TT|H...) = 0 + 2/3 + 1/3 = 1$.
• Note: you should not be factoring in the probability that the first one comes up $H$, that is a given of the problem. Thus the factor of $p$ in your final answer shouldn't be there, and if $p=\frac 12$ the answer is $\frac 13$, not $\frac 16$.
– lulu
Feb 9 '16 at 0:54
• @lulu Oh yeah, noticed that. Edited. Thanks
– BCLC
Feb 10 '16 at 11:08 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9808759643671934,
"lm_q1q2_score": 0.8152482406464138,
"lm_q2_score": 0.8311430499496096,
"openwebmath_perplexity": 160.4205823056255,
"openwebmath_score": 0.9481833577156067,
"tags": null,
"url": "https://math.stackexchange.com/questions/1646860/probability-of-a-fair-sequence-of-tosses-ending-on-two-successive-tails-given-th"
} |
rviz
Title: How to visualize sensor_msgs/LaserScan without using RViz?
Hi all, thank you for reading this post.
i don't get any images in RViz, not even sensor_msgs/images, just a black screen. I think it's a bug. cause i can see them using image_view pack.
Now I want to visualize sensor_msgs/LaserScan without using RVIz, Is there any other way to do this?
Any answers would be appreciated.
Originally posted by Rm4n2aa on ROS Answers with karma: 1 on 2014-08-16
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 19078,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "rviz",
"url": null
} |
optimization, machine-learning, reinforcement-learning
steps not in $S_T$ from gradient descent, which is $O\left(\frac{n}{\delta}\sqrt{T}\right)$. And we have to use a separate bound for the time steps in $S_T$. The proof uses the easiest one: at each such step, at worst, the algorithm has loss $1$ while $i^*$ has loss zero, so the contribution to regret from that step is at most $1$, for a total of $|S_T|$, which in expectation is $\delta T$. | {
"domain": "cs.stackexchange",
"id": 12633,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "optimization, machine-learning, reinforcement-learning",
"url": null
} |
c#, .net, asp.net-core
public BinanceApiClient(IHttpClientFactory httpClientFactory, string apiKey, string secretKey) { ... }
// holds the Request arguments
internal class RequestArguments { ... }
// for building and processing the request arguments
internal class RequestArgumentsBuilder<T> where T : class
{
// to generate the Api url along with queryStrings if applicable.
private string GetEndPointUrl(string endpoint, bool useSecuritySignature = false, IEnumerable<KeyValuePair<string, string>> parameters = null) { ... }
// the underlying request processer
private async Task<T> ProcessRequest<T>(RequestArguments arguments, CancellationToken cancellationToken = default) where T : class { ... }
// exposed processor would be called whenever the consumer is done building the request.
public async Task<T> Process() { ... }
} | {
"domain": "codereview.stackexchange",
"id": 42426,
"lm_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#, .net, asp.net-core",
"url": null
} |
ros-indigo
Title: Unable to uninstall ros-indigo before re-intall from the beginning
Greetings,
I'm a newbie and have an Ubuntu 14.04 computer with ROS indigo loaded on it. I was trying to install ros-indigo-navigation, where I encountered dependency issues. I tried various suggestions and nothing worked. So, I decided to uninstall ROS and reinstall the full desktop version from the beginning. I am having trouble even uninstalling ROS.
for sudo apt-get remove ros-* or for sudo apt-get purge ros-* I get the error saying that Unable to locate package ros-apt.txt and couldn't find any package by regex 'ros-apt.txt'
I did find a file by that name in my home directory though. Any suggestions on how to overcome this and help me reinstall ROS-indigo is very much appreciated. | {
"domain": "robotics.stackexchange",
"id": 32496,
"lm_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-indigo",
"url": null
} |
$$a$$ is inversely proportional to $$b$$ means that as the absolute value of $$b$$ gets bigger, the absolute value of $$a$$ gets smaller, so there is some non-zero constant constant $$y$$ such that $$a=\frac{y}{b}$$.
So if $$a$$ is inversely proportional to $$b$$ ($$a=\frac{y}{b}$$), then vise-versa is also correct: $$b$$ is inversely proportional to $$a$$ ($$b=\frac{y}{a}$$ as the absolute value of $$a$$ gets bigger, the absolute value of $$b$$ gets smaller).
As for the question:
In a certain business, production index p is directly proportional to efficiency index e, which is in turn directly proportional to investment i. What is p if i = 70?
Given: $$p=ex$$ and $$e=iy$$ (for some constants $$x$$ and $$y$$), so $$p=ixy$$. Question: $$p=70xy=?$$ So, basically we should find the value of $$xy$$. | {
"domain": "gmatclub.com",
"id": null,
"lm_label": "1. Yes\n2. Yes\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 1,
"lm_q1q2_score": 0.8244619350028204,
"lm_q2_score": 0.8244619350028204,
"openwebmath_perplexity": 1564.8456925625587,
"openwebmath_score": 0.834241509437561,
"tags": null,
"url": "https://gmatclub.com/forum/in-a-certain-business-production-index-p-is-directly-proportional-to-63570.html"
} |
php, object-oriented, design-patterns
/**
* @return array return the error if registered during operation
*/
public function getError()
{
return $this->error;
}
/**
* A quick and dirty function to delete rows
* @param string $query delete query to perform
* @return mixed return numbers of row deleted, 0 if no row deleted
*/
public function exec($query)
{
return $this->dbHandler->exec($query);
}
}
MatEducation.php
class MatEducation
{
/**
* @var int $id id of the user/family member
* @var int $eduId
* @var string $degree
* @var string $institute information of user
* @var int $type mapper type - User/Family member
*/
private $id;
private $eduId;
private $degree;
private $institute;
/**
* getter and setter methods for properties
* **************removed to make code shorter
*/ | {
"domain": "codereview.stackexchange",
"id": 15712,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "php, object-oriented, design-patterns",
"url": null
} |
c++, coordinate-system, raytracing
const float x;
const float y;
const float z;
FreeVector operator*(float) const;
FreeVector operator/(float) const;
private:
UnitVector(float, float, float, float);
};
UnitVector::UnitVector(const float x, const float y, const float z)
: UnitVector(x, y, z, std::sqrt(x * x + y * y + z * z)) {}
UnitVector::UnitVector(const FreeVector& v) : UnitVector(v.x, v.y, v.z) {}
FreeVector UnitVector::operator*(const float k) const {
return FreeVector(x * k, y * k, z * k);
}
FreeVector UnitVector::operator/(const float k) const {
return FreeVector(x / k, y / k, z / k);
}
UnitVector::UnitVector(const float x, const float y, const float z, const float r)
: x{x / r}, y{y / r}, z{z / r} {}
UnitVectors allow you to define directions in a much better manner:
struct Ray {
BoundVector source;
UnitVector direction;
BoundVector parametric_eq(float) const;
};
BoundVector Ray::parametric_eq(const float t) const {
return source + direction * t;
} | {
"domain": "codereview.stackexchange",
"id": 32733,
"lm_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++, coordinate-system, raytracing",
"url": null
} |
• @RossMillikan well, the pdf is straightforward (and is included in one of your two links in some form) and we can apply the definition of expected value. I don't know of a clean way to simplify the sum by hand, but computers can calculate it easily enough for us. – JMoravitz Aug 19 '17 at 2:12 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9869795095031688,
"lm_q1q2_score": 0.899315694924836,
"lm_q2_score": 0.9111797015700341,
"openwebmath_perplexity": 279.07212059651675,
"openwebmath_score": 0.7660864591598511,
"tags": null,
"url": "https://math.stackexchange.com/questions/2398684/average-number-of-selections-before-duplicate-picked"
} |
c++, simulation
#endif // NET_CODERODDE_CIRCUITS_BRANCH_WIRE_HPP
InputGate.hpp
#ifndef NET_CODERODDE_CIRCUITS_INPUT_GATE_HPP
#define NET_CODERODDE_CIRCUITS_INPUT_GATE_HPP
#include "../AbstractSingleInputPinCircuitComponent.hpp"
#include <string>
namespace net {
namespace coderodde {
namespace circuits {
class InputGate : public AbstractSingleInputPinCircuitComponent {
public:
InputGate(const std::string& name, bool bit) :
AbstractSingleInputPinCircuitComponent{name},
m_bit{bit}
{}
InputGate(const std::string& name) : InputGate{name, DEFAULT_BIT} {}
bool doCycle() const {
if (m_input != nullptr) {
return m_input->doCycle();
}
return m_bit;
}
bool getBit() const {
return m_bit;
}
void setBit(bool bit) {
m_bit = bit;
} | {
"domain": "codereview.stackexchange",
"id": 27816,
"lm_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++, simulation",
"url": null
} |
word2vec, gensim
model = gensim.models.Word2Vec(data, min_count = 1,
size = 32, window = 2)
model.wv.most_similar(positive='friend', topn=10)
[('mind', 0.9998476505279541),
('present', 0.9998302459716797),
('till', 0.9998292326927185),
('herself', 0.9998183250427246),
('highbury', 0.999806821346283),
('the', 0.9998062252998352),
('place', 0.9998047351837158),
('house', 0.999799907207489),
('her', 0.9997915029525757),
('me', 0.9997879266738892)]
Run the lower casing operation before running stop-word removal since it is case sensitive.
Your window size, currently set to 2 is probably too low. Run it with default setting of 5. It will allow more natural similar pairs to be discovered (words frequently found in similar context but with distance more than 2). It would be also helpful to increase the minimum count threshold to weed out low frequency words which can give rise to spurious correlation. | {
"domain": "datascience.stackexchange",
"id": 7970,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "word2vec, gensim",
"url": null
} |
tensor-calculus
For example, Ohm's law says that
$$ \vec J = \sigma \vec E $$
where $\vec J$ is the current density and $\sigma$ is the conductivity tensor for the material. In simple cases, the conductivity of a material is a scalar, so the current flows in precisely the same direction as the applied electric field. However, there's no reason why that has to be the case; the weird crystalline structure of the atoms and molecules in a material may cause the current to flow at an oblique angle.
In such a case, we would have that
$$ \vec J=\pmatrix{J_1 \\J_2\\J_3} = \pmatrix{\sigma_{11}E_1+\sigma_{12}E_2+\sigma_{13}E_3\\\sigma_{21}E_1+\sigma_{22}E_2+\sigma_{23}E_3\\\sigma_{31}E_1+\sigma_{32}E_2+\sigma_{33}E_3}= \sigma \vec E$$
In colloquial terms, all three components of the electric field may contribute to the each component of the resulting current. For instance, $\sigma_{21}$ tells us how much of $E_1$ goes into $J_2$. | {
"domain": "physics.stackexchange",
"id": 42470,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "tensor-calculus",
"url": null
} |
rostest
[ROSTEST]-----------------------------------------------------------------------
[testtalker_listener][failed]
SUMMARY
* RESULT: FAIL
* TESTS: 0
* ERRORS: 0
* FAILURES: 1
ERROR: The following tests failed to run:
* testtalker_listener
rostest log file is in /home/mech-user/.ros/log/rostest-test1-pc-7453.log
Originally posted by Heecheol Kim on ROS Answers with karma: 46 on 2015-10-13
Post score: 2 | {
"domain": "robotics.stackexchange",
"id": 22775,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "rostest",
"url": null
} |
quantum-field-theory, quantum-gravity, qft-in-curved-spacetime
Title: Scalar field in a curved space-time We know that action of a scalar field in a curved space-time in Jordan frame is given by:
$$ \int \left( \frac{1}{2} M^2 R -\frac{1}{2} \partial_\mu \phi \partial^\mu \phi –V(\phi) -\frac{1}{2} \xi \phi^2 R \right) \sqrt{-g}\ d^4x $$
I have two questions about this equation:
Why does this action break the equivalence principle?
It is said in the literature that when coupling to gravity is minimal $$\xi = 0$$, then M is the Planck scale. | {
"domain": "physics.stackexchange",
"id": 39666,
"lm_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-gravity, qft-in-curved-spacetime",
"url": null
} |
c++, object-oriented, snake-game
class Snake {
public:
enum class Direction {
up,
right,
down,
left,
};
private:
struct Coordinates {
int x;
int y;
};
std::vector<Coordinates> m_snakesBody{};
Coordinates m_frontPosition{};
int m_startLength{ 3 };
Direction m_direction{Direction::right};
static int m_score;
public:
Snake(mapType& map); //begining snakes position
void move(mapType& map); // controls snakes movement
void takeDirectionsByUserInput(); // enables user to control snake directions using WSAD keys
void eraseTail(mapType& map); //erases last 'o' on the snake as the snake moves
//adds 'o' on in direction where snake is going, so it can move ahead
void addHeadToRight( mapType& map);
void addHeadToDown( mapType& map);
void addHeadToLeft( mapType& map);
void addHeadToUp( mapType& map); | {
"domain": "codereview.stackexchange",
"id": 43332,
"lm_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, snake-game",
"url": null
} |
c++, unit-testing
REQUIRE(idx.buffer_size() == (width * height));
std::uint32_t x = 0u;
std::uint32_t y = 0u;
std::uint32_t reference_mapped_position = 0u;
idx.set({0,0});
for(std::uint32_t i = 0; i < idx.buffer_size(); ++i){
if(
(-padding_x <= static_cast<std::int32_t>(x) && x < (padding_x + width))
&&(-padding_y <= static_cast<std::int32_t>(y) && y < (padding_y + height))
){
REQUIRE(idx.inside_bounds());
REQUIRE(idx.inside_content());
REQUIRE(idx.mapped_position().has_value() == true);
REQUIRE(idx.mapped_position().value() == reference_mapped_position);
++reference_mapped_position;
}else{
REQUIRE(idx.inside_bounds());
REQUIRE(idx.mapped_position().has_value() == false);
}
if(x < (width - 1)){
REQUIRE(idx.step() == 0u);
++x;
}else{
REQUIRE(idx.step() == 1u);
x = 0;
++y;
}
}
} Surprising behavior of the copy constructor | {
"domain": "codereview.stackexchange",
"id": 43993,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, unit-testing",
"url": null
} |
differential-geometry, gauge-theory, field-theory, tensor-calculus
However, the fun part is gauge theory, where an additional gauge field is introduced and a relevant $\Omega^2_x$ appears on the fibre. Lets say our spin-1/2 particle is an electron and we are talking about the $U(1)$ Abelian gauge group. Then an extra piece of the fibre $A(x) \in \Omega^1_x$ appears which is known as the electromagnetic vector potential (or the gauge potential). It corresponds to the photon, the carrier of the electromagnetic forces, and it does all sorts of beautiful things in the gauge theory.
Since the field $A(x)$ also needs its proper dynamics, the field theory is also formulated on the field fibres plus their first jet. The funny thing, however, is that only a subspace of the jet $J\Omega^1_x \sim \Omega^1_x \otimes \Omega^1_x$ turns out to be gauge invariant and it is always a subspace of $\Omega^2_x$. In the Abelian case it is the subspace of exact two-forms which we will denote as $\bar{\Omega}^2_x$. | {
"domain": "physics.stackexchange",
"id": 42963,
"lm_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, gauge-theory, field-theory, tensor-calculus",
"url": null
} |
# Simple system of two nonhomogeneous ordinary differential equations solved by elimination. (3.1-15)
My differential equations textbook states to use the "elimination method" to crack this for $x$ and $y$. The final answer uses $t$ as the independent variable which both $x$ and $y$ are dependent on. I was able to solve this for $x(t)$ but it is $y(t)$ where I am having difficulty duplicating the answer in text.
The system consists of the following two linear ordinary differential equations written in linear differential operator forms:
\begin{align*} &(1) \: D(x + y) = x + t &\\ &(2) \: D^2y = Dx & \end{align*}
The textbook states that the general solution for both $x$ and $y$ are:
\begin{align*} & x(t) = \frac{1}{2}t^2 + c_1t + c_2 &\\ & y(t) = \frac{1}{6}t^3 + \frac{1}{2}c_1t^2 + (c_2 - c_1)t + c_3 &\\ \end{align*} | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9817357216481429,
"lm_q1q2_score": 0.8116125018427457,
"lm_q2_score": 0.8267117962054049,
"openwebmath_perplexity": 503.1482710514059,
"openwebmath_score": 0.9648268818855286,
"tags": null,
"url": "https://math.stackexchange.com/questions/1615505/simple-system-of-two-nonhomogeneous-ordinary-differential-equations-solved-by-el"
} |
javascript, virtual-machine
Something I'm less sure about as I haven't implemented a CHIP-8 emulator in some time is that it doesn't appear to be functioning 100% correctly, although some games are certainly playable.
As far as it running is concerned, I picked of a few games to see how they ran, I had no problems with:
15PUZZLE
BLITZ
The following didn't work as expected:
CONNECT4 (Tokens wouldn't land on top of each other, only the bottom row was ever used)
HIDDEN (most of the tiles generated appeared as X's resulting in some strange gameplay and in the end it wasn't completable as the 2 remaining tiles didn't match when flipped)
However the following I had no luck running:
BLINKY (Occasional heart would draw in top left but nothing more)
This indicates that a few of your opcodes may be functioning incorrectly (although it could be a deeper issue), it might be worth running your emulator alongside another to see how they compare. | {
"domain": "codereview.stackexchange",
"id": 30003,
"lm_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, virtual-machine",
"url": null
} |
reinforcement-learning, q-learning, unsupervised-learning, eligibility-traces
rewards_all_episodes.append(reward_current_episode)
#Print average reward per thousend episodes
reward_per_thousend_episodes = np.split(np.array(rewards_all_episodes),num_episodes/1000)
count = 1000
print("*** Average award per 1000 episodes ***")
for r in reward_per_thousend_episodes:
print(count, ": ", str(sum(r/1000)))
count+=1000
#Print Q-Table
print("\n\n******* Q-Table *******\n")
print(q_table)
print("\n\n******* ET-Table *******\n")
print(et_table) | {
"domain": "ai.stackexchange",
"id": 1935,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "reinforcement-learning, q-learning, unsupervised-learning, eligibility-traces",
"url": null
} |
quantum-mechanics, cosmology, measurement-problem, anthropic-principle
The Fine-tuning Problem
I will assume that everyone is aware of this and also aware that the Weak Antropic Principle is often postulated as an explanation to this problem by suggesting that given a large selection of possible universes, the one with the right conditions for sapient life is the one which will have people like us asking such philosophical questions as "why is the universe the way it is". However, this theory relies on invoking the notion of multiple universes in some form and often comes hand in hand with multiverse theory which seems like a stretch. | {
"domain": "physics.stackexchange",
"id": 35576,
"lm_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, cosmology, measurement-problem, anthropic-principle",
"url": null
} |
formal-languages, context-free, formal-grammars, parsing
Title: Can this CFG be written into an equivalent LL(1) grammar? I have the following CFG which I suspect cannot be rewritten to one which is LL(1):
$S \rightarrow \epsilon\ |\ aSbS\ |\ bSaS\ |\ cSdS\ |\ dScS$
I've thought about it for a while, and can't seem to make any progress. I know that the simpler grammar here can be rewritten into LL(1), but it seems like there is something different about the above grammar which prevents a rewriting in a similar style. Is it possible? If not, is there an easy way to prove that this is the case? The comment above is correct. What is referenced here is generally called a "first-follow set clash" and occurs when a non-terminal is nullable, and has non disjoint first and follow sets. You can try to remove these by substituing for the nullable non terminal (shown for your grammar below). However, this process might result in a loop. If that happens, your grammar can't be transformed to LL(1).
Note that . simply denotes esp.
S → a S b S
| c S2 S | {
"domain": "cs.stackexchange",
"id": 6274,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "formal-languages, context-free, formal-grammars, parsing",
"url": null
} |
lo.logic, complexity, first-order-logic
[1] Grädel, E., Kolaitis, P., & Vardi, M. (1997). On the Decision Problem for Two-Variable First-Order Logic. Bulletin of Symbolic Logic, 3(1), 53-69.
[2] Statman, R. (1979). Intuitionistic propositional logic is polynomial-space complete. Theoretical Computer Science, 9(1), 67-72. The two-variable fragment of intuitionistic first-order logic is undecidable, as proved in
Roman Kontchakov, Agi Kurucz, and Michael Zakharyaschev: Undecidability of First-Order Intuitionistic and Modal Logics with Two Variables, Bulletin of Symbolic Logic 11 (2005), no. 3, pp. 428–438. http://www.jstor.org/stable/1578742. | {
"domain": "cstheory.stackexchange",
"id": 5352,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "lo.logic, complexity, first-order-logic",
"url": null
} |
ros, orocos
Title: problem installing orocos_toolchain from source
I am trying to use orocos_toolchain to control a multi link robot in real time, but when i try to install the orocos_toolchain package from source, i get the above error:Failed to process package 'utilrb'
, what is the problem? I followed this link to install it.
I also tried this ros tutorial: but i get the error:
Could not resolve host: git.gitorious.org
this same error was also coming when i followed first link but after i changed git wit http it worked, but in the second link, i dont know what is the problem. So how do i install orocos with ros ?
Originally posted by dinesh on ROS Answers with karma: 932 on 2017-02-09
Post score: 0
Is there a reason why you want to build the orocos_toolchain from source, if you're using indigo on Ubuntu you can use the binary packages instead.
Otherwise, can you try this updated documentation instead: https://github.com/orocos-toolchain/orocos_toolchain/blob/installation-script/INSTALL.md | {
"domain": "robotics.stackexchange",
"id": 26972,
"lm_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, orocos",
"url": null
} |
pcl, rosdep, tutorial, turtlesim, ros-fuerte
Traceback (most recent call last):
File "/usr/lib/pymodules/python2.7/rosdep2/main.py", line 111, in rosdep_main
exit_code = _rosdep_main(args)
File "/usr/lib/pymodules/python2.7/rosdep2/main.py", line 232, in _rosdep_main
return _package_args_handler(command, parser, options, args)
File "/usr/lib/pymodules/python2.7/rosdep2/main.py", line 255, in _package_args_handler
lookup = _get_default_RosdepLookup(options)
File "/usr/lib/pymodules/python2.7/rosdep2/main.py", line 103, in _get_default_RosdepLookup
lookup = RosdepLookup.create_from_rospkg(sources_loader=sources_loader)
File "/usr/lib/pymodules/python2.7/rosdep2/lookup.py", line 299, in create_from_rospkg
lookup._load_all_views(loader=sources_loader)
File "/usr/lib/pymodules/python2.7/rosdep2/lookup.py", line 443, in _load_all_views
self._load_view_dependencies(resource_name, loader)
File "/usr/lib/pymodules/python2.7/rosdep2/lookup.py", line 465, in _load_view_dependencies | {
"domain": "robotics.stackexchange",
"id": 10856,
"lm_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, rosdep, tutorial, turtlesim, ros-fuerte",
"url": null
} |
ros, compressed-image-transport, usb-cam, camera
Original comments
Comment by Rouno on 2016-08-02:
To be more specific, I run usb_cam driver and would like to stream mjpeg camera output to a remote node based on my camera framerate
The ROS driver for your camera should have a parameter or a dynamic_reconfigure option to adjust the frame rate.
Without knowing which camera you're using or which ROS driver you're using, I can't provide more specific advice.
UPDATE
The usb_cam driver decodes the image and passes it directly to the image_transport publisher, so it isn't passing mjpeg images through directly.
The "quick and dirty" approach mentioned by the compressed_image_transport page is dirty because it only publishes compressed images, and doesn't provide the uncompressed images that most other ROS nodes expect. | {
"domain": "robotics.stackexchange",
"id": 25420,
"lm_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, compressed-image-transport, usb-cam, camera",
"url": null
} |
gravity, orbital-motion, earth, asteroids, meteors
Title: Is it possible for meteors and asteriods to become natural satellites of Earth? We know that the moon isn't falling on the earth because it's in orbit. If we make an asteriod or meteor spin is it possible for it to become a natural satellite of Earth? If your question is asking whether it's possible for an asteroid to be naturally captured and put into orbit around the earth, the answer is "yes". But it requires a very specific set of conditions.
The incoming asteroid would need to be deflected by the Moon into a direction and speed that corresponds to an orbital trajectory. That means that its speed, the distance by which it misses the moon, and the angle of its approach relative to the Moon's direction of motion, would all have to fit within specific ranges. The vast majority of approach trajectories would result in the asteroid just flying by with its final trajectory altered by interactions with the Earth and Moon. | {
"domain": "physics.stackexchange",
"id": 62974,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gravity, orbital-motion, earth, asteroids, meteors",
"url": null
} |
physical-chemistry, terminology, units
An amagat is a practical unit of number density. Although it can be applied to any substance at any conditions, it is defined as the number of ideal gas molecules per unit volume at 1 atm and 0 °C.
We already have the good ol' Loschmidt Number...so why introduce another term/unit that is (seemingly) defined the same way, has the same value and carries the same (SI) units?
Besides, what's with the "...practical unit of number density." bit? I haven't seen any of these particular units before so I could be mistaken, but I imagine it is similar to how we don't say "I have 3 Avogadro's Numbers of water" we would say "I have 3 moles of water". We very well could describe amounts by explicitly naming multiples of the constant, but we instead defined a new unit so that we could describe things more easily. | {
"domain": "chemistry.stackexchange",
"id": 8630,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "physical-chemistry, terminology, units",
"url": null
} |
fft
Title: Removing mean from signal massively distorts FFT I have a series of signals sampled at 1200 Hz that are 200-300 samples long. I'd like to analyze them in the frequency domain in 1 Hz bins in MATLAB. I'm primarily interested in the frequencies below about 20 Hz, since this is where virtually all of the signal power is contained.
However, I'm finding conflicting opinions on whether it's appropriate to subtract the mean value from the signal before I perform the FFT function. When I don't subtract the mean, I get a strong 0Hz component, which makes sense given the shape of the original signal. But some sources say you should zero-mean the data so you don't get distortion of the low frequencies, which are the ones I care about. If I do subtract the mean, the FFT is markedly different, and appears to contain massive sinc-like distortions.
Here is the original signal in blue, and the zero-mean version in red, created using detrend(mySignal, 'constant'). | {
"domain": "dsp.stackexchange",
"id": 6022,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fft",
"url": null
} |
catkin, ros-groovy, ros-hydro
Originally posted by ahendrix with karma: 47576 on 2014-03-16
This answer was ACCEPTED on the original site
Post score: 5
Original comments
Comment by demmeln on 2014-03-20:
Just as a note: You might want to use symlinks in your src folder to only have one common checkout of your code for both workspaces. | {
"domain": "robotics.stackexchange",
"id": 17306,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "catkin, ros-groovy, ros-hydro",
"url": null
} |
complexity-theory, reductions, proof-techniques
Title: Is the NP-hardness Proof with One Way Implication Correct and Why? A problem $\Pi$ is NP-hard if I can prove this:
a known NP-hard problem $\Pi'$ reduces to $\Pi$ in polynomial time; and
$f(x) \in \Pi\iff$ $x \in \Pi'$. | {
"domain": "cs.stackexchange",
"id": 6134,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "complexity-theory, reductions, proof-techniques",
"url": null
} |
work, friction, kinetic-theory
Title: Why is friction positive in this solution?
According to the solution, the work of kinetic friction is positive, but doesn't the friction force always go negative to the displacement, making the work by friction negative? Why is friction positive in the solution.
The values used in the question and solution are different, but solve for the same thing in question (a).
According to the solution, the work of kinetic friction is positive,
That's not what is says.
Move the friction work and the work done by the spring to the left side of the equation. Then the left side of the equation becomes the net work done on the block and the right side becomes the change in kinetic energy of the block, per the work energy theorem. The work done by the applied force is positive while the work done by friction and spring forces are negative.
Hope this helps. | {
"domain": "physics.stackexchange",
"id": 98444,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "work, friction, kinetic-theory",
"url": null
} |
bash, cache, shell, memoization
Update: I've implemented several of the features suggested below and packaged the improved code into a dedicated project: bash-cache. This looks very slick! I've tried it on a few things, and it speeds up very slow commands quite a bit. Less-slow commands, as you've noticed, are still a bit expensive.
A few preliminary thoughts (I'll likely add more to this post as I spend more time looking at this): | {
"domain": "codereview.stackexchange",
"id": 26702,
"lm_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, cache, shell, memoization",
"url": null
} |
organic-chemistry, stability, conformers, hyperconjugation
In alkenes the eclipsed conformers are local minima, while the staggered, or more accurately bisected, conformers are transition states. The rotational barrier for propene is only about 8 kJ/mol.[2]
I have performed a full, relaxed rotational scan of 1-butene around the central carbon-carbon bond axis (blue). The minima and maxima of this scan have been reoptimised and thermal corrections at 298.15 K and 1 atm have been added (orange). | {
"domain": "chemistry.stackexchange",
"id": 5041,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "organic-chemistry, stability, conformers, hyperconjugation",
"url": null
} |
That said, I did try several methods before settling on the "brute force" test that my RPL/SysRPL code used, including Didier's ΔLIST/ΠLIST approach. I was actually surprised to find that even some optimized list processing approaches were slower than what I ended up using. I realized that ANDing the numbers with"111.." would result in "10101..." results for ping-pong numbers, which could then be divided by 11 for interesting intermediate results, etc. But all those transformations in RPL ended up being slower than simply testing for alternating parity of each digit. That's part of the fun of challenges like this -- you learn a lot through the experimentation. | {
"domain": "hpmuseum.org",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9787126444811033,
"lm_q1q2_score": 0.8413637791072295,
"lm_q2_score": 0.8596637469145054,
"openwebmath_perplexity": 1845.7878489250068,
"openwebmath_score": 0.45289504528045654,
"tags": null,
"url": "https://www.hpmuseum.org/forum/thread-10782.html"
} |
qiskit, programming, textbook-and-exercises
operator_shape = state._op_shape
# we only use the ket convetion for qubit statevectors
# this means the operator shape should hve no input dimensions and all output dimensions equal to 2
is_qubit_statevector = len(operator_shape.dims_r()) == 0 and set(operator_shape.dims_l()) == {2}
if convention == "ket" and is_qubit_statevector:
latex_str = _state_to_latex_ket(state._data)
else:
latex_str = array_to_latex(state._data, source=True, **args)
return prefix + latex_str + suffix | {
"domain": "quantumcomputing.stackexchange",
"id": 4322,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "qiskit, programming, textbook-and-exercises",
"url": null
} |
Deviation Measures of Position – Percentile, Quartiles. See full list on toppr. Sign Up Free. Some Commonly Used Measures of Relative Dispersion / Absolute Dispersion. The two most common types of statistical measures are those for central tendency and those for dispersion. The measures are functions of the 3rd and 4th powers of the difference between sample data values and the distribution mean (the 3rd and 4th central moments). In a way, mean deviation or standard deviation tell us more about the way data is spread. Two distinct samples may have the same. The "variance" is simply the square of the standard deviation. o One measure of dispersion is range. As with other types of measures, there is more than one approach to defining such a measure. Meaning of dispersion in English 'Since World War I, the wider dispersion of forces on the battlefield and the increased use of cover and concealment have reduced exposure to enemy fire. Start learning to code for free with real developer | {
"domain": "lab-consulting.it",
"id": null,
"lm_label": "1. Yes\n2. Yes",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9877587254288979,
"lm_q1q2_score": 0.8453744399010924,
"lm_q2_score": 0.8558511488056151,
"openwebmath_perplexity": 721.0817150749654,
"openwebmath_score": 0.5135897994041443,
"tags": null,
"url": "http://ptue.lab-consulting.it/uses-of-measures-of-dispersion.html"
} |
quantum-state, quantum-algorithms, bb84
The question is (keep in mind there is an intruder), say Alice sent $20$ qubits to Bob, and only $10$ qubits Bob chose the correct basis, the rest are discarded. Alice and Bob then compare the results between the two to detect Eve, is the probability of detecting Eve
$1-\left(\frac34\right)^{10}$ or just $\left(\frac34\right)^{10}$? Firstly we have
$$
\mathbb{P}[\text{Eve detected in round $i$}] = \mathbb{P}[\text{Eve chooses wrong basis and Bob chooses correct basis}].
$$
As we assume Alice, Bob and Eve choose their basis independently and uniformly at random we have
$$
\mathbb{P}[\text{Eve detected in round $i$}] = \frac12 \times \frac12 = \frac14.
$$
So we also have $\mathbb{P}[\text{Eve not detected in round $i$}] = 1-\mathbb{P}[\text{Eve detected in round $i$}]=\frac34$.
Now suppose we run the protocol for $n$ rounds
$$
\begin{aligned}
\mathbb{P}[\text{Eve detected}] &= 1-\mathbb{P}[\text{Eve not detected}] \\ | {
"domain": "quantumcomputing.stackexchange",
"id": 2639,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-state, quantum-algorithms, bb84",
"url": null
} |
solar-system, gravity, newtonian-gravity
What happens is that any over-density expands at less than the Hubble rate and thereby grows. Galaxies (and larger structures) form from small relative over-densities that eventually grow large enough to withstand the overall expansion and instead collapse under their own gravity to form bound objects, such as galaxy clusters, galaxies, star clusters, and stars. This implies that the Hubble flow has no bearing on the inner dynamics of such systems.
Of course, the number of days in a year was higher in the past than today, but that is only because the Earth is spinning down (due to tidal friction with the Moon), so that the days become longer.
If anything has had an effect on the semi-major axis of the Earth orbit (and hence on its period), then that is gravitational interactions with the other planets. However, weak interactions (secular perturbations) can only alter the orbital eccentricity and leave the semi-major axis unaltered. | {
"domain": "astronomy.stackexchange",
"id": 169,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "solar-system, gravity, newtonian-gravity",
"url": null
} |
electromagnetism, electromagnetic-radiation, waves
In a region empty of electric charge, we have, from Maxwell's equations:
$$\nabla \cdot \vec E = \nabla \cdot \vec B = 0$$
Since you don't yet know vector calculus, let's rewrite these divergence equations as so:
$$\frac{\partial E_x}{\partial x} + \frac{\partial E_y}{\partial y} + \frac{\partial E_z}{\partial z} = 0 $$
$$\frac{\partial B_x}{\partial x} + \frac{\partial B_y}{\partial y} + \frac{\partial B_z}{\partial z} = 0 $$
Now, assume an electromagnetic wave is propagating in the $z$ direction so that the space and time variation of the field components are of the form
$$\cos(kz - \omega t)$$
Since the spatial variation is zero in the $x$ and $y$ directions, our equations become
$$\frac{\partial E_z}{\partial z} = 0$$
$$\frac{\partial B_z}{\partial z} = 0$$
Which means that electric and magnetic field components in the $z$ direction, the direction of propagation, must be constant with respect to $z$. | {
"domain": "physics.stackexchange",
"id": 90063,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electromagnetism, electromagnetic-radiation, waves",
"url": null
} |
optics, experimental-physics, fiber-optics, optical-materials, anderson-localization
My question is why is absorption, fluorescence, etc... not an issue in the 2D systems experimentally, when it is an issue in the 3D systems?
Is it somehow related to that the investigated 3D materials are powders, and 2D systems are solids?
Any related comment/answer is highly appreciated! I think the answer was more simple than I anticipated. The point is that in to enable 3D Anderson localization of light, the strength of disorder must be larger than some critical value. This has limited the current search to materials with large refractive indexes, such as powdered GaAs, GaP, TiO2 etc, which all have exhibited absorption, fluorescence, and other non-linear effects. Simply put, there are not that many availabe candidates. | {
"domain": "physics.stackexchange",
"id": 83898,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "optics, experimental-physics, fiber-optics, optical-materials, anderson-localization",
"url": null
} |
# Conversion from octal numerical system to binary numerical system
I know that in order to convert a numeral in base-8 to a numeral in base-2 I can write each octal digit as a binary word of 3 bits.
I know that 2^3 = 8 that is exactly the dimension of the base of the octal system.
I just cannot understand the fundamental reason why it works. Is it just a coincidence?
Its not a coincidence. It is a general result for any number represented in a positive base $$b$$, its representation in base $$b^k$$ for some positive integer $$k$$, is simply grouping $$k$$ digits in its base $$b$$ representation starting from the least significant digit to the most significant digit.
Take base $$10$$ for example.
$$427428$$ in base $$10$$ is $$(4,2,7,4,2,8)$$.
$$427428$$ in base $$10^2$$ is $$(42,74,28)$$.
$$427428$$ in base $$10^3$$ is $$(427,428)$$.
You can now find an analogy to your problem.
Edit: Proof for the above claim | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9817357189762611,
"lm_q1q2_score": 0.8116124996338693,
"lm_q2_score": 0.8267117962054048,
"openwebmath_perplexity": 194.67739357133144,
"openwebmath_score": 0.7932136058807373,
"tags": null,
"url": "https://cs.stackexchange.com/questions/113364/conversion-from-octal-numerical-system-to-binary-numerical-system"
} |
The pumping lemma implies that there is a sequence like $x_n = c+b(r^{dn}-1)/(r^d-1)$ for some $b,c,d$ such that each $x_n$ is a power of $k$. So $\log_k(x_n)=dn \log_k(r) + const + o(1)$ is always an integer, so $\log_k(r)$ is rational.
Here's an explanation of that formula for $x_n$. The pumping lemma gives strings $u,v,w$ such that every string $x_n=u v^n w$ is a power of $k$. Interpreting these strings as numbers and writing $d$ and $e$ for the lengths of $v$ and $w$ respectively, $x_n = u r^{dn+e} + v r^{d(n-1)+e} + v r^{d(n-2)+e} + \dotsb + v r^e + w$ is a power of $d$. So $x_n-x_{n-1} = (u r^d - u + v) r^{d(n-1)+e}$. Writing $b=(u r^d - u + v)r^e$ and $c=x_0-b$ we have $x_n=c+b(r^{dn}-1)/(r^d-1)$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9719924785827002,
"lm_q1q2_score": 0.8013707829311804,
"lm_q2_score": 0.8244619177503205,
"openwebmath_perplexity": 152.45336897009273,
"openwebmath_score": 0.9387757778167725,
"tags": null,
"url": "https://cstheory.stackexchange.com/questions/2083/proving-the-set-of-powers-of-2-over-ternary-alphabet-to-be-non-regular"
} |
java, beginner, datetime
In many cases it's better to use positive names for variables because that avoids double negation.
Use stderr not stdout for error messages.
Your error messages are printed to stdout (Java: System.out). That hampers with automation. Error messages should be printed to stderr instead (Java: System.err).
Write small methods
For example, the code that determines the number of days in a month could be extracted in a method of its own.
Ideally, methods with more than 5 lines are extremely rare. "Braces are an opportunity to extract." (Robert "Uncle Bob" C. Martin)
Make Variables final
Well, you don't need to write final everywhere in Java code. I do, others don't. The point is, avoid re-assigning variables. Instead, write smaller methods where the scope of a variable is so small that you never need to re-assign the variable.
Use meaningful variable names. | {
"domain": "codereview.stackexchange",
"id": 14448,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, beginner, datetime",
"url": null
} |
quantum-mechanics, electromagnetism, double-slit-experiment, interference, diffraction
Title: If outside a cylindrical solenoid exist an electrical field what does that mean to the Aharonov-Bohm Effect? To the question "What is the electric field outside a cylindrical solenoid when inside is turned on a magnetic field" the answer is that outside exists a electric field. Does that mean that the fringes shift in the double slit experiment with electrons could be explained with electromagnetic fields and it is not necessary (but of course possible) to explain it with quantum mechanics? This is what the author of http://arxiv.org/abs/1407.4826 seems to imply. I have no idea if this is correct or not, sorry. | {
"domain": "physics.stackexchange",
"id": 15136,
"lm_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, electromagnetism, double-slit-experiment, interference, diffraction",
"url": null
} |
mathematical-physics, notation, integration, complex-numbers, dirac-delta-distributions
Title: Principal value of $1/x$ and few questions about complex analysis in Peskin's QFT textbook When I learn QFT, I am bothered by many problems in complex analysis.
$$\frac{1}{x-x_0+i\epsilon}=P\frac{1}{x-x_0}-i\pi\delta(x-x_0)$$
I can't understand why $1/x$ can have a principal value because it's not a multivalued function. I'm very confused. And when I learned complex analysis, I've not watched this formula, can anybody tell me where I can find this formula's proof.
$$\frac{d}{dx}\ln(x+i\epsilon)=P\frac{1}{x}-i\pi\delta(x)$$
And I also find this formula. Seemingly $f(x)$ has a branch cut, then
$$f(z)=\frac{1}{\pi}\int_Z^{\infty}dz^{\prime}\frac{{\rm Im} f(z^{\prime})}{z^{\prime}-z}$$
Can anyone can tell the whole theorem and its proof, and what it wants to express. | {
"domain": "physics.stackexchange",
"id": 12755,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "mathematical-physics, notation, integration, complex-numbers, dirac-delta-distributions",
"url": null
} |
neuroscience, neurophysiology, central-nervous-system, reflexes
Title: How are reflexes suppressed? What neurophysiological process keeps reflex arcs in check? For example, the withdrawal reflex causes the hand to jerk back when the fingers touch something painfully hot incidentally. However, that reflex can be voluntarily suppressed when one deliberately touches that same hot object on purpose. What neural process is involved in conscious suppression of reflexes? Short answer
The pain withdrawal reflex can only be suppressed when touching something painful on purpose. Deliberate, conscious contraction of the extensor muscle before reflex initiation can prevent the contraction of the flexor muscles once the reflex is started.
Background | {
"domain": "biology.stackexchange",
"id": 4895,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "neuroscience, neurophysiology, central-nervous-system, reflexes",
"url": null
} |
python, python-3.x, postgresql
26.02.2019 11:15:03: Running stockitem processor
26.02.2019 11:15:04: No new stocks were found
26.02.2019 11:15:04: Catched 0 exceptions
26.02.2019 12:30:17: Runcode: admin
26.02.2019 11:30:17: Initialising stockitem processor
26.02.2019 11:30:17: Running stockitem processor
26.02.2019 11:30:18: No new stocks were found
26.02.2019 11:30:18: Catched 0 exceptions
26.02.2019 12:45:04: Runcode: admin
26.02.2019 11:45:04: Initialising stockitem processor
26.02.2019 11:45:05: Running stockitem processor
26.02.2019 11:45:06: No new stocks were found
26.02.2019 11:45:06: Catched 0 exceptions
26.02.2019 13:00:01: Runcode: admin A couple of things jump out immediately:
You are only inserting data from lines with the string "Stock:" and this word occurs in exactly the same position in each line. Instead of asking for a search of the line you could check that a specific slice be checked.
# setup outside read loop
stock_str = " Stock: "
stock_pos = 21
stock_end = stock_pos + len(stock_str) | {
"domain": "codereview.stackexchange",
"id": 35188,
"lm_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, postgresql",
"url": null
} |
c, data-visualization, ascii-art
Title: Print the length of words as a vertical histogram I thought I'd give it a shot. What I came up with is from a culmination of my last two submissions, incorporating most of the feedback from this community, including better naming of variables, initialization, and making my program a bit more user-friendly. I'm not sure which optimizations I can make or if there are any issues with my code.
Any feedback is welcome!
#include <stdio.h>
/* print the length of words as input to a histogram with vertical bars */
int main(void) {
int c, i, j;
int word_length = 0;
int max_word_frequency = 0;
int histogram[10] = {0}; | {
"domain": "codereview.stackexchange",
"id": 15626,
"lm_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, data-visualization, ascii-art",
"url": null
} |
javascript, php, jquery, css, chess
Ideally those would be handled - perhaps in Index.php with a try/catch that may set the value of an error variable and the view would display that error message instead of the board.
PHP mixed within HTML
Generally it is best to separate the business logic (PHP) from the view (HTML). Using a template engine could help for this aspect - e.g. Smarty, Twig, etc. For more information on this topic, prefer to this article.
Form submission method
Did you consider using post for the form method? If the form was submitted as POST requests, then the form variables would not be in the query string, and the user might be less apt to modify them. The effect would be that on the server side $_POST would need to be used instead of $_GET.
More Specific points
PHP
Declaring Instance/Member variables
The class definitions appear to use the PHP 4 style declarations for instance variables (i.e. var). Note that while support of this syntax isn't currently deprecated, it may be in the future: | {
"domain": "codereview.stackexchange",
"id": 31987,
"lm_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, php, jquery, css, chess",
"url": null
} |
algorithms, optimization, time-complexity
The one twist in your problem statement is the "create new source". We can model this in the assignment problem by adding $N$ extra sources, one per destination. The $i$th extra source is connected (only) to the $i$th destination. Thus, "creating" a source for destination $i$ is equivalent to connecting it to the $i$th extra source. In other words, instead of treating it as cost 100 to create a new source for destination 1, just eagerly create a new source for destination 1, and treat it as costing 100 if destination 1 uses that source (and no other destination is allowed to use that source; i.e., the cost is $\infty$ for all other destinations). | {
"domain": "cs.stackexchange",
"id": 8719,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "algorithms, optimization, time-complexity",
"url": null
} |
javascript, node.js, promise, express.js
resolve(token);
});
};
var getUser = function(token) {
return new B_Promise(function(resolve, reject) {
jwt.verify(token, req.app.config.api.secret, function(err, decoded) {
if (err) {
return reject(err);
}
resolve(decoded);
});
});
};
var getEvents = function(user) {
return new B_Promise(function(resolve, reject) {
req.app.db.getConnection(function(err, connection){
if (err) {
return reject(err);
}
/* jshint multistr: true */
connection.query('SELECT e.* FROM events e \
INNER JOIN event_to_groups etg ON e.id=etg.event_id \
INNER JOIN user_to_groups utg ON utg.group_id=etg.group_id \
WHERE utg.user_id=?', user.id, function(err, events) {
if (err) {
return reject(err);
}
results.events = events;
resolve();
}); | {
"domain": "codereview.stackexchange",
"id": 18139,
"lm_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, promise, express.js",
"url": null
} |
qkd
Eve sends random mixture of states :
$$ a|00\rangle+\; b|11\rangle+\; c|++\rangle+\; d|--\rangle \quad \text{where} \; |a|^2+|b|^2+|c|^2+|d|^2=1 $$
Then for Ekert 91 protocol, we can consider the case when Alice sent state which collapsed into $|00\rangle$.
Then Bob will receive state " $a |00\rangle + b |11\rangle + c |++\rangle + d |--\rangle$ " from Eve
Since Bob need to get result $|0\rangle$ from Bob's qubit measurement so that Bob's bit not be discarded,
The correlated collapsed state will be the following :
$$ a|00>+\; \frac{c}{\sqrt2}(\;|00>+\; |10>)+\; \frac{d}{\sqrt2}(\;|00>-\; |10>) \; \cdots (*) \quad \text{which} \; \text{must} \;\text{be} \;\text{normalized}$$
So I stuck at the point averaging out available arbitrary $a,b,c,d$ to get the possibility of Bob getting result $|0\rangle$
However, Now I'm curious about " Did I understood the phrase (Eve send a random mixture of qubit pairs) properly "
My questions are | {
"domain": "quantumcomputing.stackexchange",
"id": 3646,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "qkd",
"url": null
} |
matrices, mathematical-foundations
product-user rating table
between places distance table
bitmap images
Modelling things with matrix allow you to see the problem in different perspective. And allow you to see what it might actually mean to apply some matrix operations to it.
For example, you might notice that matrix multiplication on 'distance table' actually gives you a transitive distances.
Or that rank-factorization of product-user rating table actually provides a mean to categorize users into groups that have the same taste.
Or that know eigen vectors helps in understanding the eigen faces that one corner stone in face recognition. | {
"domain": "cs.stackexchange",
"id": 3061,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "matrices, mathematical-foundations",
"url": null
} |
Series (2) converges. The partial sums are $1, \frac{1}{2}, 1, \frac{3}{4}, 1, \frac{3}{4}, 1,\frac{7}{8}, 1,\frac{7}{8}$, and so on. It is clear that the partial sums approach $1$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9793540704659681,
"lm_q1q2_score": 0.8284771617504657,
"lm_q2_score": 0.8459424295406088,
"openwebmath_perplexity": 258.2424459872029,
"openwebmath_score": 0.8625534176826477,
"tags": null,
"url": "https://math.stackexchange.com/questions/880980/why-these-two-series-are-convergent-or-divergent"
} |
lie-algebra, representation-theory
Title: Lie Algebra Generators We know that rotations are performed via real and orthogonal matrices, $O^{T}=O^{-1}$. We can write $O$ as, (The proper rotations have unit determinant)
$$O = \exp(A),$$
where $A^{T}=-A$. In three space dimensions a real anti-symmetric matrix will require three independent entries.
$$A_{ab} = \epsilon_{abc}\theta_c.$$
This looks like $\vec{M}\cdot\vec{\theta}$, where the matrix elements of the generators $M_c$ are given as
$$(M_c)_{ab}=\epsilon_{abc}.$$
Let us remember:
$$[t_a,t_b]= i\,\,f_{abc}t_c.$$
Where $f$ is structure constant. We know that $f$'s should satisfy Jacobi identity
$$f_{bcm}f_{mah} + f_{abh}f_{hcm} + f_{cah}f_{hbm} = 0.$$
We also know that:
$$t_a\,t_b - t_b\,t_c - i\,f_{abc}t_c = 0.$$ | {
"domain": "physics.stackexchange",
"id": 12510,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "lie-algebra, representation-theory",
"url": null
} |
python, array
>>> s[4:] = True; s
<SparseBitArray of length 20, [(2, 3), (4, 20)]>
>>> s[:10] = False; s
<SparseBitArray of length 20, [(10, 20)]>
>>> s[:] = False; s
<SparseBitArray of length 20, all bits cleared>
>>> s[:] = True; s
<SparseBitArray of length 20, all bits set>
"""
if isinstance(key, slice):
start, step, end = key.start, key.step, key.stop
if start is None: start = 0
if end is None: end = len(self)
if step not in [None, 1]: raise ValueError("Custom steps not allowed: "+repr(key))
contained_by, edge_overlaps, contains = self._find_overlapping_ranges(start, end)
if contains:
if not value:
self.set_ranges.remove(contains)
self.set_ranges.append((contains[0], start))
self.set_ranges.append((end, contains[1]))
return
if value: | {
"domain": "codereview.stackexchange",
"id": 2571,
"lm_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",
"url": null
} |
fourier-transform, power-spectral-density, autocorrelation, fourier-series, periodic
$$\text{If } x(t) = \sum_{n=-\infty}^\infty c_n\exp(j2\pi nf_0t), ~~\text{then }
R_x(\tau) = \sum_{n=-\infty}^\infty |c_n|^2\exp(j2\pi nf_0\tau). \tag{6}$$ | {
"domain": "dsp.stackexchange",
"id": 9447,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fourier-transform, power-spectral-density, autocorrelation, fourier-series, periodic",
"url": null
} |
neural-network, regression, decision-trees, linear-regression
Title: When is a neural network better "traditional" models like decisions trees and lassos? There's a whole theory of statistical inference based off calculus studying consistency, efficiency, robustness, BLUE, unbiasedness of linear models (Gaussian,Exponential, Chi-square, F-distribution, etc)... that make up regression models.
When is a neural network better than these traditional models based off calculus that are used regression-analysis? Is there a whole mathematical theory including robustness, Rao-blackwell stuff, consistency, sufficency dedicated to them that someone like Wackerly/HOFF writes about in a book?
Are neural networks not explainable by calculus as logistic regression is explainable as the maximum likelihood estimator?
What's the mathematics behind neural networks or is that more CompSci theory? | {
"domain": "datascience.stackexchange",
"id": 4299,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "neural-network, regression, decision-trees, linear-regression",
"url": null
} |
classical-mechanics
[EDIT following OP comment]
I'm assuming the rigid elastic rough hard sphere model which is described by S Chapman and TG Cowling, Mathematical Theory of Nonuniform Gases (3rd edition, Cambridge University Press, 1970).
In this model, there are no internal degrees of freedom of the spheres: each sphere just has its linear and angular momenta, that's all. Also, I've assumed (as is common) that they behave kinematically as spherical tops, with a scalar moment of inertia.
I can only give a simplified argument in the 2D case in favour of associating the energy conservation with the "perfectly rough" condition, i.e. reversal of the relative velocity of the point of impact. For the 3D case I recommend that book, or papers such as JW Lyklema Physica A, 96, 573 (1979).
We can write an equation for the change of kinetic energy $\Delta K$
$$
2\Delta K = m({v_x'}^2-v_x^2) + m({v_y'}^2-v_y^2) + I({\omega'}^2-\omega^2)
$$ | {
"domain": "physics.stackexchange",
"id": 53202,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "classical-mechanics",
"url": null
} |
• Actually, $a_0=1$ and $a_1=\frac{1-\sqrt{5}}{2}$ is one of the combinations that will make $\lim_{n\rightarrow\infty}\frac{a_n}{a_{n-1}}=\frac{1-\sqrt{5}}{2}$ (see Melody's answer). Multiplying both sides by x (if $x\neq 0$) shouldn't give illogical answers. Whether they have actual/physical meaning or not is another matter. – TheAverageHijano Nov 16 '18 at 15:48
• That is true, but my answer says integers. If you take $a_0=1$ , and round off the values to the nearest integer, you get the sequence: $1,-1,0,-1..$ and here the limit suddenly tends to negative infinity because of the third term. – AryanSonwatikar Nov 17 '18 at 2:56
• Also, I'm not well versed with matrices and vectors so Melody's answer is obscure for me. – AryanSonwatikar Nov 17 '18 at 3:00
• Also, for the sequence you get, the Fibonacci-ness is followed only upto the fourth term after which if we follow the ratio and if we follow the Fibonacci-ness we get two different sequences. – AryanSonwatikar Nov 17 '18 at 4:21 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9902915220858951,
"lm_q1q2_score": 0.8568240754013672,
"lm_q2_score": 0.865224084314688,
"openwebmath_perplexity": 281.3315000520823,
"openwebmath_score": 0.930814802646637,
"tags": null,
"url": "https://math.stackexchange.com/questions/3000878/does-a-n-a-n-1-converge-to-the-golden-ratio-for-all-fibonacci-like-sequenc/3000901"
} |
catkin, ros-kinetic, ubuntu, rosserial-arduino, rosserial
^
/home/mirzam/cmaketut_ws/build/helloworld/ros_lib/ros/node_handle.h:448:8: note: template argument deduction/substitution failed:
/home/mirzam/cmaketut_ws/src/helloworld/firmware/servernode.cpp:22:126: note: mismatched types ‘ros::ServiceServer<MReq, MRes, ObjT>’ and ‘const char [12]’
ros::ServiceServer<std_srvs::Empty::Request, std_srvs::Empty::Response> service = n.advertiseService("get_nothing", &callback);
^
make[6]: *** [CMakeFiles/hello.dir/servernode.cpp.obj] Error 1
make[5]: *** [CMakeFiles/hello.dir/all] Error 2
make[4]: *** [CMakeFiles/hello.dir/rule] Error 2
make[3]: *** [hello] Error 2
make[2]: *** [CMakeFiles/helloworld_firmware_hello] Error 2
make[1]: *** [CMakeFiles/helloworld_firmware_hello.dir/all] Error 2
make: *** [all] Error 2 | {
"domain": "robotics.stackexchange",
"id": 32093,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "catkin, ros-kinetic, ubuntu, rosserial-arduino, rosserial",
"url": null
} |
c#, performance, php
// return keys as an array
return array(
'private' => $privKey,
'public' => $pubKey
);
}
Save the results to private.txt and public.txt
PHP: Encrypt using Public key (public.txt)
// replace this line with the one from http://pastebin.com/6Q2Zb3j6
$output = '';
echo encrypt($data, 'public.txt');
// encrypt string using public key
function encrypt($string, $publickey, $chunkPadding = 16) {
$encrypted = '';
// load public key
$key = file_get_contents($publickey);
$pub_key = openssl_pkey_get_public($key);
$keyData = openssl_pkey_get_details($pub_key);
$chunksize = ($keyData['bits'] / 8) - $chunkPadding;
openssl_free_key( $pub_key );
// split string into chunks
$chunks = str_split($string, $chunksize);
// loop through and encrypt each chunk
foreach($chunks as $chunk) {
$chunkEncrypted = ''; | {
"domain": "codereview.stackexchange",
"id": 23650,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, performance, php",
"url": null
} |
homework-and-exercises, electrostatics, electricity, potential
Title: A question about electric potential I want to ask about the interpretation of electric potential as it relates to this simple problem : " "A $0.800$ mm diameter ball bearing has $1.50 \times 10^9$ excess electrons. What is the ball bearing's potential?"
The electric potential is the amount of work needed to move a unit of charge from one point to another within an electric field, without producing an acceleration. What does it then mean to ask, 'what is the potential of an object'? In this case, the potential is easily calculated by $U=Fr$, where $r$ is the radius of the ball. Is this the amount of work needed to move a charge from the center of the sphere to the edge, from $x=0$ to $x=r$? Nothing is said regarding charge distribution in the ball, so I don't think we can say much about the electric field either. | {
"domain": "physics.stackexchange",
"id": 67556,
"lm_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, electricity, potential",
"url": null
} |
c, stack
Note that while modern computers have plenty of memory, users might artificially constrain it for certain applications. For example, I might want to set the memory limit for a server process that handles simple requests to 10 MiB to prevent denial of service attacks that send maliciously crafted queries that exploit worst-case characteristics of my algorithm. Now imagine what happens when your code asserts on malloc to succeed and the program was compiled with NDEBUG. The allocation will fail but instead of having defeated the DoS attack, we have provided the attacker with a way to corrupt memory!
Consider a “constructor” that creates a zero-initialized non-empty array
If I want a zero-filled DynArr of size n, I currently have to do this.
DynArr * array = DynArr_new(n);
while (DynArr_size(array) != n) {
DynArr_push(array, 0);
} | {
"domain": "codereview.stackexchange",
"id": 19541,
"lm_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, stack",
"url": null
} |
cosmology, dark-matter, gravitational-lensing, galaxy-rotation-curve
We know that dark matter “is there” regarding it’s gravitational interactions with matter but then I believe it would behave somehow different from the interactions among that “ordinary” matter itself, in terms of these gravitational effects, so that we could be able to pinpoint it. My logic can be wrong for sure, but it might give you some insight as you kindly help me to understand it. The percentage of dark matter as a fraction of the energy content of the universe is determined by fitting the standard model of cosmology, the Lambda-CDM model, to precise observations of the anisotropies of the temperature of the cosmic microwave background. The most recent value of 25.89% comes from observations done by the European Space Agency’s Planck spacefraft from 2013 to 2015. The instruments on this spacecraft were capable of measuring the CMB temperature to just a few parts per million! | {
"domain": "physics.stackexchange",
"id": 55827,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "cosmology, dark-matter, gravitational-lensing, galaxy-rotation-curve",
"url": null
} |
astronomy, kinematics, galaxies, experimental-technique, data-analysis
The data sources I use for my experiments are products of some data reduction pipeline. Why the deconvolution of the PSF is not part of the data-reduction step? Is it because of what I mentioned above? ie: The deconvolution is an ill-posed procedure and it may affect (in a bad way) the data.
I am not very familiar with the deconvolution procedure but so far I have found that the Richardson-Lucy technique is a method for deconvolving with a known PSF. Are there other better techniques that are proven to give better results? Without having had to deal with that problem myself, I'd say that the second solution sounds better. Whenever the word "deconvolution" comes up, some warning signal in me goes off. Also, how much of a gain would it give in computational time, compared to the possible errors and uncertainties it could introduce in your work? I mean, if it was something you had to run many times over as part of some pipeline or something, speed could be essential. | {
"domain": "physics.stackexchange",
"id": 8139,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "astronomy, kinematics, galaxies, experimental-technique, data-analysis",
"url": null
} |
fft, audio, window
0 - Zero: the exponential window, used in the "exponentially-weighted moving average filter" (EWMA, see Is there a technical term for this simple method of smoothing out a signal?)
1 - First, for "real-time" applications that can be bufferized, or offline needs, you can first perform an extension trick. It is common to preserve a little data before the time sample when you actually need the data. This happens with triggered frame acquisition: you start acquiring "useful data" after a threshold is crossed, but your have a custom buffer for the data before.
Hence, you can extend the data frame buffer "to the left", with real data, or by symmetry, and then you can use longer (and more classical) windows (symmetric or not), so that they take off when your signal is not interesting, and "start" where you want to analyze. | {
"domain": "dsp.stackexchange",
"id": 7740,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fft, audio, window",
"url": null
} |
java
(I have taken the liberty to change Float to float to eliminate some auto-boxing.)
Using interfaces or lambdas is still ok, but I can't help but feel that these will be overblown solutions for a small piece of boolean logic. As illustrated, exactMatch is used as a secondary condition after name.contains(key) since contains() is the encompassing condition for both. If an exact match is not required, the primary condition will satisfy, else we will also perform name.equals(key).
The downside is that two comparisons will be done for equals(), so if you have some really strict performance ceiling and this is indeed one of the last bottlenecks to eliminate, then you should just use a simpler if statement to switch between the comparisons to perform.
Step 2 | {
"domain": "codereview.stackexchange",
"id": 12088,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java",
"url": null
} |
2. ### Maths
In triangle ABC, D is the midpoint of AC and E is the midpoint of AB. BD and CE are perpendicular to each other and intersect at the point G. If AB=7 and AC=9, what is the value of BC^2?
3. ### Math, please check work
find the other endpoint of a line segment with the given midpoint and one endpoint. Endpoint: (0,0) midpoint: (4, -3) I would Double the midpoint and add on the endpoint The other endpoint would be (8, -6) is this correct?
4. ### geometry
Triangle ABC, AB=8, BC=10, and AC=12, M is the midpoint of AB, and N is the midpoint of BC. What is the length of MN? | {
"domain": "jiskha.com",
"id": null,
"lm_label": "1. Yes.\n2. Yes.",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9425067211996142,
"lm_q1q2_score": 0.8316941994784816,
"lm_q2_score": 0.8824278710924295,
"openwebmath_perplexity": 1475.452208179878,
"openwebmath_score": 0.625250518321991,
"tags": null,
"url": "https://www.jiskha.com/questions/595824/if-xc-cy-then-c-is-the-midpoint-of-xy"
} |
sorting, sorting-network, stable
Title: Is the bitonic sort algorithm stable? I was wondering, is the bitonic sort algorithm stable? I searched the original paper, wikipedia and some tutorials, could not find it.
It seems to me that it should be, as it is composed of merge / sort steps, however was unable to find answer anywhere.
The reason why I'm asking - I was comparing this particular implementation of bitonic sort to the sort implemented in the C++ standard library, for array length 9 it requires 28 comparison / swap operations, while the standard library sort (which is unstable) requires 25. The three extra cswaps do not seem enough to make the sort stable. No, bitonic sort is not stable.
For this post I will denote numbers as 2;0 where only the part before the ; is used for comparison and the part behind ; to mark the initial position.
Comparison-exchanges are denoted by arrows where the head points at the desired location of the greater value. | {
"domain": "cstheory.stackexchange",
"id": 4975,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "sorting, sorting-network, stable",
"url": null
} |
doppler-effect, radar
What is wrong with this reasoning? Your reasoning is logically right even for monostatic radar when detecting a moving target. As for your question, you need to note that the radar equation is merely used to calculate the power received from the target to the receiver antenna, in order to calculate the maximum detection range of the radar given its minimum acceptable SNR: (The $A_{eff}$ formula is incorporated in this equation)
$$P_r = {{P_t G_t G_r \sigma \lambda^2}\over{{(4\pi)}^3 R_t^2R_r^2}}$$
you can see that power drops with $1/R^4$ and signals at the receiver are usually exceedingly attenuated.
Now the doppler frequency of the reflected signal is:
$$f_D \approx \frac{2V}{c}f_0\rightarrow \lambda'=\frac{c}{f_0+f_D}\approx \lambda_0(1-\frac{2V}{c})$$
The maximum possible speed that you can think of when designing a radar is much lower than 20 Mach (around 7 km/s) even for ballistic missile detection. A speed of 15 km/s gives $\dfrac{2V}{c}=10^{-4}$ | {
"domain": "physics.stackexchange",
"id": 39875,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "doppler-effect, radar",
"url": null
} |
javascript, php, mysql, ajax, json
Reasons to use MVC or MV* patterns is
Portability.
The files, especially the views and models, can be plucked out of the architecture, and be used elsewhere in the system without modification.
Models are simply function declarations one can just plug in the controller and call their functions. Views are simply layouts that, when plugged with the right values, display your data. They can be used and reused with little or no modification unlike with mixed code.
Purpose-written code and Readability
You would not want your HTML mixed with the logic, nor the data gathering mechanism. This goes for all other parts of your code. For example, when you edit your layout, all you want to see on your screen is your layout code, and nothing more. | {
"domain": "codereview.stackexchange",
"id": 2858,
"lm_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, php, mysql, ajax, json",
"url": null
} |
quantum-mechanics, electromagnetic-radiation, visible-light, atomic-physics, material-science
Application of high voltage, via an appropriate high voltage power supply, results in a mixture of excited hydrogen atoms and molecules. Both exist in the discharge and both emit light as they continually cycle around their respective excitation and de-excitation pathways.
This figure shows my photographs of the energized hydrogen discharge tube.
On the left is the raw output. To my eyes, it is quite noticeably red hued. On the right, a filter has been used to attenuate light at wavelengths longer than 600 nm. The light transmitted through the filter is, to my eyes, cyan hued.
Others may see the colors differently, but no matter: we have spectrometers, spectrographs, and the like. So, collecting light from the energized hydrogen discharge tube, and dispersing it using one of my homemade echelle spectrographs results in the following two dimensional spectrum (an echellogram): | {
"domain": "physics.stackexchange",
"id": 96095,
"lm_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, electromagnetic-radiation, visible-light, atomic-physics, material-science",
"url": null
} |
of composite shapes word, Area ws answers, Practice a 10 3 composite figures answers, Area of. 2- Place Value Lesson 1. area of the base of the triangle with the length of the poster. Lesson 3 Homework Practice Area of Composite Figures Find the area of each figure. Figure (1) is a plot, with its caption, of power and efficiency of a gyroklystron as calculated by simulation, and the experimental results taken from (2). Answers will vary. 1 _ No; 51 5. Sample writing items for grades 3 - 8 revising and editing are now available on the new Reading Language Arts STAAR Sample Items page. 8 ASSESSMENT ENRICHMENT/RETEACHING Key: Power Standard * Assessed Standard Strikethrough: Topic not taught or assessed this quarter ** Dates to be determined at school site LAUSD Mathematics Program Instructional Guide, Grade 5. Lesson 10-9 Surface Area. 2 Reflections 11. Each answer shows how to solve a textbook problem, one step at a time. Number & Operations - Links to previous number and operations | {
"domain": "asdpallavolorossano.it",
"id": null,
"lm_label": "1. Yes\n2. Yes",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.959762057376384,
"lm_q1q2_score": 0.8119034559170478,
"lm_q2_score": 0.8459424392504908,
"openwebmath_perplexity": 2428.5326937190143,
"openwebmath_score": 0.3937196135520935,
"tags": null,
"url": "http://jgos.asdpallavolorossano.it/lesson-3-reteach-area-of-composite-figures-answer-key-page-123.html"
} |
python, python-3.x, recursion, xml
I dislike 'polluting' my class with a private static method just to help out a specific method. However, if this is considered Pythonic, I'll happily continue down this path. I think the code could be made better by keeping all of the XML tree-building code together. The recursive traversal of .sub_scores could be done using a generator function.
Additionally, you might want to reduce the punctuation noise by setting XML attributes using keyword arguments.
class Scorer:
def generate_report(self, score):
r = etree.Element('report', user=getpass.getuser(), time=timestamp())
etree.SubElement(r, 'summary', tests=score.total(), …)
etree.SubElement(r, 'results', file=self.results_path)
samples = etree.SubElement(r, 'samples')
for sample in self._samples(score):
etree.SubElement(samples, 'sample', sample.report_attr())
return r | {
"domain": "codereview.stackexchange",
"id": 22705,
"lm_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, recursion, xml",
"url": null
} |
ros, ros-melodic, joy
Title: Logitect F710 wireless range 10m max: joy limitation?
Hi, I am currently the ROS joy packaging for Logitect GamePad F710 to control my robocars. However, it seems it works within 10 meters only. Is this a hardware or a ROS software problem?
Originally posted by AutoCar on ROS Answers with karma: 102 on 2021-06-30
Post score: 0
Original comments
Comment by jayess on 2021-06-30:
Sorry to close your question, but as is it appears to not be about ROS (1 or 2) and is instead about hardware. If you can update your question to be on-topic then I'll happily reopen it for you. Otherwise, you can try out another forum that will be more appropriate for this type of question such as https://robotics.stackexchange.com/
Comment by AutoCar on 2021-06-30:
I have revised it. Could you approve?
I am currently the ROS joy packaging for Logitect GamePad F710 to control my robocars. However, it seems it works within 10 meters only. Is this a hardware or a ROS software problem? | {
"domain": "robotics.stackexchange",
"id": 36612,
"lm_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, joy",
"url": null
} |
ros
Originally posted by Ryan with karma: 3248 on 2012-02-13
This answer was ACCEPTED on the original site
Post score: 2
Original comments
Comment by Haikal Pribadi on 2012-02-14:
Thanks for the input, Ryan. I think I'm going to try the first one. As the firmware for the robot is given from Parallax, i'm going to start off with a little serial port programming to communicate to the board and call it the driver node.
Comment by Haikal Pribadi on 2012-02-14:
I'm planning to build the functions based on the TurtleBot SDK source code, cause I believe they should have really similar behavior. However, is that allowed? if it is, do you happen to know where the source code is hosted? i'm sure it's in an svn or git repo somewhere, i just cant find the link..
Comment by Ryan on 2012-02-14:
Yes, the link to the source is in Section 1 of those links I posted. | {
"domain": "robotics.stackexchange",
"id": 8205,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros",
"url": null
} |
roscore
Title: How to Log connections
Hi,
How can I log ROS TCP connection creations and destructions?
I'm trying to move all my clients to persistent connections to avoid recreating too many TCP sockets (to avoid they dangle for a couple of minutes), but I still have many TIME_WAIT connections (for which I cannot see to which process they belong with netstat nor lsof -i)
Maybe enabling logs for roscore?
We have diamondback but we're migrating soon to electric.
thanks
Originally posted by Daniel Pinyol on ROS Answers with karma: 41 on 2012-02-16
Post score: 0
Maybe it helps to set the loggerlevel of roscpp or similar to DEBUG.
Originally posted by dornhege with karma: 31395 on 2012-02-16
This answer was ACCEPTED on the original site
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 8266,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "roscore",
"url": null
} |
c, parsing, json
where the helper function:
static int json_parse_helper(const char** cursor, size_t* length, char* new_string) {
// ...
}
parses a JSON string of at most *length bytes into new_string and writes the actual length of the parsed string into *length, or, if new_string == NULL, just determines the length of the string without actually storing the decoded output anywhere.
Number parsing
Your current json_parse_value() implementation treats numbers as the default case, and simply feeds anything that doesn't being with ", [, {, n, t or f into the C standard library function strtod().
Since strtod() accepts a superset of valid JSON number literals, this should work, but can make your code sometimes accept invalid JSON as valid. For example, your code will accept +nan, -nan, +inf and -inf as valid numbers, and will also accept hexadecimal notation like 0xABC123. Also, as the strtod() documentation linked above notes: | {
"domain": "codereview.stackexchange",
"id": 28182,
"lm_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, parsing, json",
"url": null
} |
deep-learning, natural-language-processing, math, gradient-descent
The Jacobian matrix is an $N \times M$ matrix with one partial derivative for each combination of inputs and outputs (i.e. $f_i$).
If you want to optimize a multi-variable vector-valued function, you can make use of the Jacobian, in a similar way that you make use of the gradient in the case of multi-variable functions, but, although I've seen it in the past, I can't provide now a concrete example of an application of the Jacobian (but the linked slides probably do that). | {
"domain": "ai.stackexchange",
"id": 1973,
"lm_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, natural-language-processing, math, gradient-descent",
"url": null
} |
lagrangian-formalism
Nature is thrifty in all its actions.
Obviously, some word had to be constructed or borrowed to describe the new quantity whose importance was previously unknown to the humans (and remains to be unknown to most humans even today).
Note that the word "actions" appeared as the only noun of the quote in the context of these minimization problems, so it became known as Wirkung ($W$) in German and action ($S$) in English. I am actually not sure why the letter $S$ was chosen.
There have been claims that Leibniz had found the principle as early as in 1707.
Maupertuis also wrote: | {
"domain": "physics.stackexchange",
"id": 553,
"lm_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",
"url": null
} |
ros, python, moveit, tutorial, moveit-commander
"robot_moveit_config" is name of your package you setuped in setup_assistant. If it still does not work you can send me your "robot_moveit_config" and I could try to move robot on my own using python | {
"domain": "robotics.stackexchange",
"id": 25475,
"lm_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, python, moveit, tutorial, moveit-commander",
"url": null
} |
quantum-field-theory, hilbert-space
In favor of possibility (1): in non-relativistic quantum mechanics, I could always define angular momentum operators $L_i = \epsilon_{ijk}x_j p_k$ which obey the algebra for $SU(2)$, even if the Hamiltonian is not Lorentz invariant, so it seems I could always construct a unitary representation of rotation operators by exponentiating these.
My questions are: | {
"domain": "physics.stackexchange",
"id": 69841,
"lm_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, hilbert-space",
"url": null
} |
c, pointers
Function naming
__memmove is poorly named. To avoid a conflict with the standard library memmove you've added double underscore, which is a convention to indicate a private and internal API. You've also changed the semantics in the process, especially regards the internal allocation, which guarantees that memcpy could have been used (as destinstation will never overlap source).
Personally I'd find a completely different name that more accurately describes what its doing (e.g. strncpyWithDelimiter).
It's not a great name for the standard library as it happens, it differs from memcpy only in that it allows for the source and destination addresses to overlap. But then the standard C is litered with poorly named functions in part due to its age.
substr seems to be doing almost exactly the same but without the delimiter.
caseProblem assumptions | {
"domain": "codereview.stackexchange",
"id": 43571,
"lm_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, pointers",
"url": null
} |
java, object-oriented, virtual-machine
(Note: RoxByte is just my custom implementation of a byte)
public enum Operation implements AddressedValueInstruction {
/** Shift all bits in byte left by one place, setting flags based on the result */
ASL((a,r,m,v) -> {
final RoxByte newValue = a.asl(v);
r.setFlagsBasedOn(newValue);
return newValue;
}), | {
"domain": "codereview.stackexchange",
"id": 32458,
"lm_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, virtual-machine",
"url": null
} |
### Expected Value in Terms of the Quantile Function
If $$X$$ has a continuous distribution with support on an interval of $$\R$$, then there is a simple (but not well known) formula for the expected value of $$X$$ as the integral the quantile function of $$X$$. Here is the general result:
Suppose that $$X$$ has a continuous distribution with support on an interval $$(a, b) \subseteq \R$$. Let $$F$$ denote the cumulative distribution function of $$X$$ so that $$F^{-1}$$ is the quantile function of $$X$$. If $$g: (a, b) \to \R$$ then (assuming that the expected value exists), $\E[g(X)] = \int_0^1 g\left[F^{-1}(p)\right] dp, \quad n \in \N$
Proof | {
"domain": "libretexts.org",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9933071478869498,
"lm_q1q2_score": 0.8002402095651502,
"lm_q2_score": 0.8056321866478978,
"openwebmath_perplexity": 125.24691044188918,
"openwebmath_score": 0.9755764603614807,
"tags": null,
"url": "https://stats.libretexts.org/Bookshelves/Probability_Theory/Probability_Mathematical_Statistics_and_Stochastic_Processes_(Siegrist)/04%3A_Expected_Value/4.02%3A_Additional_Properties"
} |
c, linked-list, memory-management
.Prev not needed
A double linked list is needed when loops exist going "left" or "right". That is not the case here. Loops only move "right" with .Next.
Should the previous node need to be remembered for later use, simply record it as the loop proceeds to the "right". Code never needs to know the Nth previous node, hence .Prev is not needed.
Security
In main(), code has strcpy(object_address->Name, Name); object_address->Score = Score;. This obliges typedef struct { ... } Object; to be exposed to main(). A secure approach would have an opaque declaration in Object.h for all to see
typedef struct Object Object; | {
"domain": "codereview.stackexchange",
"id": 32013,
"lm_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",
"url": null
} |
quantum-mechanics, wavefunction, schroedinger-equation, terminology, hydrogen
Title: What's the difference between the "Radial Distribution Function" and the "Radial Density Function"? We're currently learning about applying the TISE to one-electron (hydrogen) atoms in my intro to QM class. While reading about it in the textbook, I was a bit confused about radial probability density and distribution functions; mainly as my textbook uses them somewhat interchangeable (which I don't necessarily think is advised). Thus, I was wondering if I could receive some answers regarding to the following.
What is the difference between a radial distribution function and a radial density function? I checked a similar question What is a good definition for Radial Probability Density?. but am still confused between the actual difference between them. For example, when would I use one vs. the other? Why? | {
"domain": "physics.stackexchange",
"id": 94346,
"lm_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, wavefunction, schroedinger-equation, terminology, hydrogen",
"url": null
} |
0 < t≤2Π. Graphing Calculator Polar Curves Derivative Calculator Integral Calculator Formulas and Notes Equation Calculator Algebra Calculator Parametric Equation Grapher Enter the Parametric Curve. Then write a second set of parametric equations that represent the same function, but with a faster speed and an opposite orientation. Graph the parametric equations $x=5\cos t$ and $y=2\sin t$. Especially if you're a student, teacher or engineer, this app is made with you in mind! Graphing Parametric Equations by Plotting Points. Graphing 3D Parametric Equations. Example 3: Graphing Parametric Equations and Rectangular Form Together. Section we will use the same Cartesian coordinates that we are careful in the! Calculator Integral Calculator Formulas and Notes equation Calculator Algebra Calculator parametric equation as... Graph of any point on the circle if we know the radius and the subtended angle is, 3 and. Online calculators find the coordinates of any function can be represented by | {
"domain": "kenlauguico.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9770226341042414,
"lm_q1q2_score": 0.8361859491955482,
"lm_q2_score": 0.8558511543206819,
"openwebmath_perplexity": 926.7117702167582,
"openwebmath_score": 0.8039703369140625,
"tags": null,
"url": "http://finetune.kenlauguico.com/di8y2x/q1zcpe.php?a9ded0=parametric-equation-grapher"
} |
electromagnetism, fluid-dynamics, vectors, mathematics, differentiation
$$\nabla\cdot B = (\partial_x\partial_y -\partial_y\partial_x)A_z + (\partial_y\partial_z -\partial_z\partial_y)A_x + (\partial_z\partial_x -\partial_x\partial_z)A_y.$$
If the partial derivatives commute acting on $\mathbf{A}$ then the divergence of $\mathbf{B}$ vanishes, and there is no magnetic charge density. But suppose we want a theory with magnetic monopoles ---the commutation of partial derivatives needs to break down somewhere.
So one possibility might be to take the vector potential to be the continuous function appearing in Kyle Kanos's answer
$$A_x=A_y=0$$$$A_z=\frac{xy(x^2-y^2)}{x^2+y^2},$$
Here the partial derivatives commute everywhere except the origin, where you get only a finite difference (not like a delta function). So this is interesting but not physically relevant since the Lebesgue integral of the magnetic charge density over any finite volume is still zero.
Instead the magnetic monopole is described by the vector potential of a Dirac string: | {
"domain": "physics.stackexchange",
"id": 24196,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electromagnetism, fluid-dynamics, vectors, mathematics, differentiation",
"url": null
} |
ros-kinetic
Originally posted by pedroexe on ROS Answers with karma: 50 on 2020-08-17
Post score: 1
Original comments
Comment by Josh Whitley on 2020-08-20:
@TakaHoribe can you comment on this?
I asked my colleague who is familiar with this algorithm and compared the original paper. Yes, it is a bug. As you say, this line should be fixed to replace height_threshold with general_height_threshold.
Our team is taking this issue, so will be fixed soon.
Thank you very much for your report and sorry for the late response.
Originally posted by TakaHoribe with karma: 181 on 2020-11-17
This answer was ACCEPTED on the original site
Post score: 2
Original comments
Comment by pedroexe on 2020-11-20:
Great! Thanks for confirming. | {
"domain": "robotics.stackexchange",
"id": 35423,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros-kinetic",
"url": null
} |
bioinformatics, genomics, data
Using exome data for copy number is happening a lot nowadays. The number of reads is used as a proxy for how many copies exist, and the balance of alleles at any given gene tells you whether there has been loss of heterozygosity. Of course, with exome data, you aren't getting truly genomic data. But there is enough coverage using the exome to pick up the big events.
CNV data: Copy number analysis is now conventionally done using a high density SNP (single nucleotide polymorphism) array. These are designed to be biallelic, and come in two types. First are the copy number SNPs, which are designed to give the best information about copy number. Then there are the genotyping SNPs, which give information about loss of heterozygosity. Often, SNP array data is higher quality, but this is determined by your platform. Newer platforms have extremely high coverage of the genome and can allow you to really pick out focal changes. | {
"domain": "biology.stackexchange",
"id": 5759,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "bioinformatics, genomics, data",
"url": null
} |
newtonian-mechanics, conservation-laws
If the two arms rotate in the same sense (clockwise or anticlockwise) then the angle between their directions (the phase difference $\phi$) is fixed. The resultant force on the plate is constant in magnitude but its direction rotates. The magnitude of this force is maximum when $\phi=0^{\circ}$ and zero when $\phi=180^{\circ}$. The CM of the plate moves in a circle. If there is a torque (ie $\phi \ge 90^{\circ}$ then it changes magnitude and sense (clockwise/anticlockwise) as the arms rotate. Because of this the plate oscillates, turning clockwise then anticlockwise.
If the arms rotate in opposite senses then the angle between them $\phi$ must change. The resultant force on the plate therefore changes in magnitude as well as direction. However, the direction is always in a straight line, so the CM of the plate oscillates along a straight line. This line will be the direction in which they are parallel or anti-parallel. | {
"domain": "physics.stackexchange",
"id": 42534,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "newtonian-mechanics, conservation-laws",
"url": null
} |
a velocity of 9 m s − 1. 10) A ball is thrown vertically upward with a velocity of 15 m s‐1. To determine this number, let’s set ½ * g * t^2 equal to 16 * t^2. If that happened, it would violate the conservation of energy. What is the initial velocity of the ball in feet per second? b. A ball of mass 200 g is thrown vertically upwards with velocity of 5ms-1. (a) what will the ball\'s speed be when it returns to its starting point? (b) how long will the ball take to reach its starting point? Solution. Say a ball is thrown vertically upward with some velocity say v1, which we will consider as the initial velocity for the upward path. Acceleration due to gravity. 10 m/s upward b. Assuming g = 10 m/s2, calculate its speed on reaching the ground and the height of the table. Use a ( t ) = – 32 feet per second per second as the acceleration due to gravity. Wellif it went 4. The distance s (in feet) of the ball from the ground after t seconds is s(t)=96t-16t^2 a. If the maximum height is 5m, | {
"domain": "rafbis.it",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.97997655637136,
"lm_q1q2_score": 0.8034762436076371,
"lm_q2_score": 0.8198933315126791,
"openwebmath_perplexity": 291.6829872560798,
"openwebmath_score": 0.680266797542572,
"tags": null,
"url": "http://rafbis.it/vxwu/a-ball-is-thrown-vertically-upward-such-that-its-initial-velocity-is-100.html"
} |
ros, roscore, rosmaster, ros-kinetic
Originally posted by pavel92 on ROS Answers with karma: 1655 on 2018-08-21
Post score: 2
Original comments
Comment by PeteBlackerThe3rd on 2018-08-21:
If this definitely isn't a 'proper' method but you could use a system call to ifconfig <NIC_name> to find out if your wi-fi connection is down very quickly.
Comment by gvdhoorn on 2018-08-22:
An alternative to checking (but something that might actually be better): a multimaster setup.
Seems like ros::master::check () would be one way to go.
API
techno74 asking and answering a similar question.
A similar function for python is mentioned in the previous question.
rosgraph.is_master_online()
Originally posted by Reamees with karma: 591 on 2018-08-22
This answer was ACCEPTED on the original site
Post score: 1 | {
"domain": "robotics.stackexchange",
"id": 31594,
"lm_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, roscore, rosmaster, ros-kinetic",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.