text stringlengths 1 1.11k | source dict |
|---|---|
graph-theory, lo.logic, graph-isomorphism, descriptive-complexity, finite-model-theory
Number variables in $N^A = \{ x \in \mathbb{N} \mid 0 \leq x \leq |A|-1\}$
Vertex variables (the old type) in $A$
Additionally, we have the natural ordering on the numbers. Furthermore, we introduce
$$ \#x.\varphi \in N^A$$
which represent the numeric value how many $x \in A$ satisfy $A \models \varphi(x)$.
Libkin's way is at least as expressive as Grädel's way, since for
$\exists^{\geq m} x \varphi(x)$ we write
$$ \#x.\varphi \geq m.$$ | {
"domain": "cstheory.stackexchange",
"id": 2748,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "graph-theory, lo.logic, graph-isomorphism, descriptive-complexity, finite-model-theory",
"url": null
} |
javascript, regex
I replace , because i dont want miss text that user wrote. ,
example: value : This is name 1234 ===> result : This is name Firstly, regular expression constants are better be placed outside of component function. Otherwise they get recreated each change event.
Second, is there a purpose of changing value? If we enter the if statement, we will not change the state, so it will affect nothing. And we don't need to return value; in the end, too.
Third, in current configuration there is no need to have regex2, because if we get a string \u0600\u06F0, which is a letter and a number (if I understand correctly), we will remove the number later. If it's \u06F0\u0600, a reversed one, we won't remove it. Though anyway, in the end it doesn't matter, because operations inside the if statement won't change the state. | {
"domain": "codereview.stackexchange",
"id": 42694,
"lm_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, regex",
"url": null
} |
electrostatics, electric-fields
Title: Why we can't take vertical cylinder as Gaussian surface to calculate the electric field of an uniformly charged infinite sheet? To calculate the electric field due to an uniformly charged infinite sheet, we take a horizontal cylinder as Gaussian surface. But why we can't take a vertical cylinder to do the same? When constructing a Gaussian surface, our main goal is to take advantage of the inherent symmetry of the charge distribution.
For an infinite sheet aligned in the $x-z$ plane, there is symmetry along the $x$ and $z$ directions. In other words, we cannot expect any physical characteristics of the system to depend on $x$ or $z$. This includes the $\mathbf{E}$ field generated by the sheet. This symmetry, along with the fact that $\mathbf{E}$ is conservative, allows us to deduce that $\mathbf{E}$ can only have a $y$ component.
Now, the Gaussian surface must take advantage of this symmetry we've identified. The choice of a horizontal cylinder does this as follows. | {
"domain": "physics.stackexchange",
"id": 78823,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electrostatics, electric-fields",
"url": null
} |
java, object-oriented, design-patterns, iterator
If not x.hasCurrent(), does x.getCurrent() return null, or throw an exception, or what?
Depending on 1 (particularly if it doesn't throw an exception), .getCurrent() sounds more like a read-only property, in which case just call it .current(). (or maybe even just .value)
.generateNext() specifically doesn't make anything (because we're supposing that would be expensive); it changes the thing in question. Therefore maybe call it .mutate() or .becomeNext()
A void return is usually a wasted opportunity, even if just for a little extra debugging context. Exactly what will be best to return here depends on exactly how this is going to be used. Returning boolean success might save you a call to .hasNext(); returning T might save you a call to .current(). Probably boolean is better, but it's hard to say. | {
"domain": "codereview.stackexchange",
"id": 37814,
"lm_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, design-patterns, iterator",
"url": null
} |
Correcting the first mistake, the equation should have been 25 * 10^5 = (x/10^2)*10^10.
Correcting the second mistake, the next line should have been 25 * 10^5 = x * 10^8. If you solve this equation, you'll get x = 25/1000 = 1/40, which is the correct answer.
_________________
# Scott Woodbury-Stewart
Founder and CEO
Scott@TargetTestPrep.com
202 Reviews
5-star rated online GMAT quant
self study course
See why Target Test Prep is the top rated GMAT quant course on GMAT Club. Read Our Reviews
If you find one of my posts helpful, please take a moment to click on the "Kudos" button.
Re: 2.5 million is what percent of 10 billion? [#permalink] 21 Mar 2020, 15:18 | {
"domain": "gmatclub.com",
"id": null,
"lm_label": "1. Yes\n2. Yes",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9489172630429475,
"lm_q1q2_score": 0.8027293823026759,
"lm_q2_score": 0.8459424373085146,
"openwebmath_perplexity": 7642.872539215317,
"openwebmath_score": 0.4491523802280426,
"tags": null,
"url": "https://gmatclub.com/forum/2-5-million-is-what-percent-of-10-billion-318851.html"
} |
quantum-mechanics, angular-momentum, group-theory, representation-theory, lie-algebra
Title: Physical motivation behind the relationship between spin, $SO(3)$, and angular momentum I am only focusing on non-relativistic quantum mechanics in this post. My current understanding is that a particle of spin $\ell$ can be described as an element of the tensor product $L^2(\mathbb{R^3}) \otimes V$ where $V$ is a vector space of dimension $2\ell + 1$ carrying a representation of the Lie group $SO(3)$. | {
"domain": "physics.stackexchange",
"id": 100244,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, angular-momentum, group-theory, representation-theory, lie-algebra",
"url": null
} |
type-theory, type-checking, type-inference
We then want an equivalent formulation that indicates how we are supposed to carry out type checking. This is sometimes called "algorithmic style".
One particular kind of algorithmic style are the "syntax directed rules" – by which we mean that we can tell which rule to use by analyzing the syntax of the term $t$ that we are trying to typecheck. This is good because it tells you how to implement typechecking. Most of the time most declarative rules are already syntax-directed – but in interesting cases there are always a couple that are not.
It takes experience to know how to design an algorithmic style that correspond to a given declarative style. In fact, figuring out a good type-checking algorithm for a new type system may be quite challenging and publication-worthy.
A popular way to formulate type systems in algorithmic style is to split the relation "$t$ has type $A$" into two: | {
"domain": "cs.stackexchange",
"id": 19546,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "type-theory, type-checking, type-inference",
"url": null
} |
c#, unity3d
Title: Object pooling for a top down shooting game - Revision #1 After the advise from this code review I have come up with the following changes. I'll go in the same order as my previous post. This post is mainly for an updated version so that others can see the previous posts suggestions. If I have made any mistakes please let me know.
ObjectPoolManager.cs:
public class ObjectPoolManager : MonoBehaviour {
#region Objects to Pool
[SerializeField] private GameObject bulletObj;
[SerializeField] private GameObject bulletPool;
[SerializeField] private ObjectPool bullets;
[SerializeField] private GameObject asteroidObj;
[SerializeField] private ObjectPool asteroids;
[SerializeField] private GameObject asteroidPool;
public ObjectPool Bullets { get { return bullets; } }
public ObjectPool Asteroids { get { return asteroids; } }
#endregion
[SerializeField] private string PrefabsDirectory = "Prefabs"; | {
"domain": "codereview.stackexchange",
"id": 14479,
"lm_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#, unity3d",
"url": null
} |
recursion, functional-programming, erlang
First, we can see that the third numbers, the function results, are identical to those for the original code. This means that either the new code is also correct, or both versions are incorrect.
As you can see the execution times are greatly reduced from the original code for all values of N greater than 4. For the smaller values, the original code is faster because it doesn't have any caching overhead. But for the larger values, each increment in N results in only a small increase in execution time. For N of 12, the run time is only 2.68ms, which is roughly 28000 times faster than the original code. With the revised code, calculating N=100 takes only 2.8 seconds:
{100,{2792880,1791977497884763591097926128926348807126038292969051375074848031878536740320}} | {
"domain": "codereview.stackexchange",
"id": 15781,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "recursion, functional-programming, erlang",
"url": null
} |
than one logarithm on either side of the equal sign then the problem can be simplified. M11GM-Id-1 2. In real life, yes, logs are indispensible to. Logarithmic Functions Their Graphs And Applications¶ Rewriting exponentials into logarithms and logarithms into exponentials using common log, natural log, and logarithms of other bases ¶ Source : I made these up. Get your real rate today. Practical Applications of Mathematics in Everyday Life. y = log b x. it looks like meeting people in real life was actually working for them. This lesson builds on students' prior work with logarithmic functions. We explain Exponential Functions in the Real World with video tutorials and quizzes, using our Many Ways(TM) approach from multiple teachers. Explain how absolute value would be used to express that number in this situation. Jun 14, 2020 - Logarithms - Real Life Applications Quant Video | EduRev is made by best teachers of Quant. This video is highly rated by Quant students and has been viewed | {
"domain": "coroilcontrappunto.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.984093606422157,
"lm_q1q2_score": 0.8422376417795499,
"lm_q2_score": 0.8558511469672594,
"openwebmath_perplexity": 1085.9298730210649,
"openwebmath_score": 0.36487436294555664,
"tags": null,
"url": "http://irmj.coroilcontrappunto.it/application-logarithms-real-life.html"
} |
python, performance, python-3.x, numpy, simulation
Parameters
----------
population_size : int
The number of cells.
cell_size : int
The maximal number of replicators of cells at which cell division takes place.
replication_rate_p : float
The fitness (replication rate) of the parasites
relative to the fitness (replication rate) of the enzymes.
Example
-------
$ replication_rate_p = 2
This means that the parasites' fitness is twice as that of the enzymes.
mutation_rate : float
The probability of mutation during a replication event.
gen_max : int
The maximal number of generations.
A generation corresponds to one outer while cycle.
If the system extincts, the number of generations doesn't reach gen_max.
Yield
-------
generator object
Contains data on the simulated system.
"""
def population_stats(population):
"""
Calculate statistics of the system. | {
"domain": "codereview.stackexchange",
"id": 37631,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, performance, python-3.x, numpy, simulation",
"url": null
} |
c++, programming-challenge, interview-questions
int main()
{
Strings obj;
std::string str;
std::cout << "Enter String\n";
std::getline(std::cin, str);
bool res = obj.isAllUnique(str);
if (res == true)
{
std::cout << "There are unique characters in string\n";
}
else
{
std::cout << "There are no unique characters in string\n";
}
} People are very eager to present their own solutions, so let me attempt an actual review of your code: | {
"domain": "codereview.stackexchange",
"id": 31471,
"lm_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++, programming-challenge, interview-questions",
"url": null
} |
newtonian-mechanics, rotational-dynamics, projectile, drag, lift
Note : To visualise the direction of magnus force in the case of upward motion , look at the same animation by rotating your screen (if possible otherwise just imagine the image to be rotated in clockwise direction) by $90°$.
Hope it helps ☺️. | {
"domain": "physics.stackexchange",
"id": 71658,
"lm_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, rotational-dynamics, projectile, drag, lift",
"url": null
} |
java, android, asynchronous, thread-safety, promise
/**
* Identity function that returns the {@code Promise<T>} argument.
*
* @param value the {@code Promise} of type {@code T} which will be returned
* @param <T> the type of the returned {@code Promise}
* @return the {@code Promise<T>}
*/
public static <T> Promise<T> resolve(final Promise<T> value) {
return value;
}
/**
* Returns a {@code Promise<T>} that is rejected with {@code Throwable value}.
*
* @param value the {@code Throwable} with which the returned {@code Promise} will be rejected
* @param <T> the type of the returned {@code Promise}
* @return the {@code Promise<T>}
*/
public static <T> Promise<T> reject(final Throwable value) {
return new Promise<>(new Executor<T>() {
@Override
public void execute(final Action<T> action) {
action.reject(value);
}
});
} | {
"domain": "codereview.stackexchange",
"id": 38248,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, android, asynchronous, thread-safety, promise",
"url": null
} |
java, gui, hangman
if(secretWord.contains(l)){
// Searches through secretWord & notes down all letters that equal the user's guess
for(int i=0; i<secretWord.length(); i++){
if(secretWord.charAt(i) == l.charAt(0))
changeBool.add(i);
}
// Changes the boolean value for those letters @ their corresponding indexes
for(Integer idx : changeBool)
lettersRevealed[idx] = true;
}else{
guessesRemaining--;
HangmanGUI.drawGuessesRemaining();
}
}
// winSequence - when the user has correctly guessed the secret word
static void winSequence(){
playAgain("Well done! You guessed " + secretWord + " with " + guessesRemaining + " guesses left!\n" +
"Would you like to play another game of hangman?");
}
} | {
"domain": "codereview.stackexchange",
"id": 12311,
"lm_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, gui, hangman",
"url": null
} |
php, classes, pdo, formatting
return $this->_connection->lastInsertId($column);
} elseif ($this->_returnMethod == 3) {
return TRUE;
}
} catch (PDOException $error) {
if ($this->_returnMethod == 1 || $this->_returnMethod == 2) {
return NULL;
} elseif ($this->_returnMethod == 3) {
return FALSE;
}
}
} else {
throw new Exception('Database connection not available.');
return FALSE;
}
} else {
throw new Exception('Invalid SQL string.');
return FALSE;
}
}
} | {
"domain": "codereview.stackexchange",
"id": 5811,
"lm_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, classes, pdo, formatting",
"url": null
} |
ros, message, trajectory-msgs, ros-industrial
Implement the whole Simple Message protocol (de)serialisation and TCP/IP connection management in Matlab script, or
Wrap the existing simple_message library inside a Simulink S-Function. Simple Message is just C++, and should be reasonably easy to port to Windows (if needed). The existing code will handle the connection and (de)serialisation for you, all you need to do is provide a few callbacks which will be called when a message is received. | {
"domain": "robotics.stackexchange",
"id": 19743,
"lm_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, message, trajectory-msgs, ros-industrial",
"url": null
} |
downsampling, aliasing, decimation
An easy way to see this more intuitively and experimentally is to create samples of Additive White Gaussian Noise (AWGN) of variance $\sigma^2$ and sampling rate $f_s$ and add that to a mean DC level $\sqrt{E}$ as used to transmit one bit as a "1". (similarly a level of $-\sqrt{E}$ would be used to transmit one bit as a "0"). The total noise power prior to any further processing is the variance of the AWGN, and the total signal power is the DC level squared such that the SNR in dB is given by $10Log_{10}(E/\sigma^2)$. However if we used $N$ successive samples to transmit each bit, the data rate would be less, and therefore the occupied bandwidth will be less, but the receiver could then average those $N$ samples prior to deciding if a 1 or 0 was transmitted. Averaging as a filter reduces the noise, and specifically the variance of the noise as AWGN after a moving average of $N$ samples would go down by $N$. Such averaging would also reduce the power of signals at higher frequencies | {
"domain": "dsp.stackexchange",
"id": 12487,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "downsampling, aliasing, decimation",
"url": null
} |
constructed $\mathbb{N}$ before (?). What Number Set Contains The Subset of Complex Numbers? Examples: 1 + i, 2 - 6i, -5.2i, 4. It is important to note that if z is a complex number, then its real and imaginary parts are both real numbers. Notational conventions. Milestone leveling for a party of players who drop in and out? Real numbers $$\mathbb{R}$$ The set formed by rational numbers and irrational numbers is called the set of real numbers and is denoted as $$\mathbb{R}$$. generating lists of integers with constraint. Read More -> The number {3} is a subset of the reals. For example, the set $\mathbf{C}^{2}$ is also a real vector space under the same addition as before, but with multiplication only by real scalars, an operation we might denote $\cdot_{\mathbf{R}}$. Can you put laminate flooring in a mobile home? Bundle: Elementary Algebra + Math Study Skills Workbook (4th Edition) Edit edition. Complex. Complex numbers can be represented as points on a “complex plane”: the | {
"domain": "com.au",
"id": null,
"lm_label": "1. Yes\n2. Yes",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9719924810166349,
"lm_q1q2_score": 0.8682900169335366,
"lm_q2_score": 0.8933093968230773,
"openwebmath_perplexity": 267.5919787374287,
"openwebmath_score": 0.7106465101242065,
"tags": null,
"url": "https://www.weddingsupplierswa.com.au/viz6m3yu/is-real-number-a-subset-of-complex-number-489fe3"
} |
energy, electromagnetic-radiation, photons
So anyway, electrical wires are the better, cheaper, and more efficient solution, except when they are literally impossible (like recharging drone airplanes, see link at top). | {
"domain": "physics.stackexchange",
"id": 26947,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "energy, electromagnetic-radiation, photons",
"url": null
} |
beginner, strings, haskell
Teh Codez
import Data.Map
import Data.Strings
type Dictionary = [(String, String)]
lolcatDictionary =
[
(" A ", " "),
("CAN I", "I CAN"),
("MORE", "MOAR"),
("CHEESEBURGER", "CHEEZBURGER"),
("HAVE", "HAS"),
("HI", "HAI"),
("GHOST", "GOAST"),
("FEET", "FEAT"),
("MOAN", "MOWN"),
("CROWD", "CROUD"),
("NOTHING", "NUTHING"),
("MY", "MAI"),
("THEM", "DEM"),
("THESE", "THEES"),
("YOU", "YU"),
("LET ME", "LEMME"),
("KITE", "KIET"),
("CAT", "KAT"),
("CATS", "KATS"),
("KITTEN", "KITTEH"),
("KITTY", "KITTEH"),
("KITTENS", "KITTEHS"),
("LIKE", "LIEK"),
("COME", "COEM"),
("CAME", "CAEM"),
("BAKE", "BAEK"),
("PLATE", "PLAET"),
("SOME", "SUM"),
("CAKE", "CAEK"),
("PLEASE", "PLZ")
] | {
"domain": "codereview.stackexchange",
"id": 20424,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "beginner, strings, haskell",
"url": null
} |
navigation, gmapping
Anything I should change to get the required tf?
Update 2
This is how I run gmapping now. I still get the same warning.
rosparam set /base_frame "/base_link"
rosrun tf static_transform_publisher 0 0 0 0 0 0 base_link base_laser 100
rosrun gmapping slam_gmapping scan:=base_scan
rosbag play gmapping_data.bag
Now the tf is map -> odom -> base_link -> base_laser
Update 3
Set the debug level of ros.gmapping.message_filter in slam_gmapping node to "Debug". I get this message now
[DEBUG] [1299740216.768663556, 1299651571.155978846]: MessageFilter [target=/odom ]: Removed oldest message because buffer is full, count now 5 (frame_id=laser, stamp=1299651570.618031)
[DEBUG] [1299740216.768820286, 1299651571.155978846]: MessageFilter [target=/odom ]: Added message in frame laser at time 1299651571.154, count now 5
Originally posted by Aravindhan K Krishnan on ROS Answers with karma: 125 on 2011-03-08
Post score: 1 | {
"domain": "robotics.stackexchange",
"id": 5006,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "navigation, gmapping",
"url": null
} |
c#, beginner, calculator
Console.WriteLine($"Addition Result: {result.ToString("0.00")}");
Or
Console.WriteLine($"Addition Result: {result:0.00}");
More Reading
To learn more, I found a decent post here on CR 'Welcome to Buzzway Subs'. I recommend reading the original code, AND then follow up by reading the good advice in the answers. | {
"domain": "codereview.stackexchange",
"id": 31927,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, beginner, calculator",
"url": null
} |
openi-tracker, ros-groovy, ubuntu-precise, ubuntu
Title: openni_tracker failed because of InitFromXml failed
Hello ,I am a new user of ROS openni.
Now I'm using ubuntu 12.04 and my ROS dist is groovy.
when I run the command rosrun openni_tracker openni_tracker,the only thing I got is a error message:
InitFromXml failed: Can't create any node of the requested type!
I followed several solutions on the ROS community,still get the same error message
I googled a lot ,but not a correct solution for me.Any help will be appreciated ,It really drives me crazy.
Originally posted by WIZARD1 on ROS Answers with karma: 1 on 2013-01-27
Post score: 0
Original comments
Comment by WIZARD1 on 2013-01-27:
just like this link http://answers.ros.org/question/9737/openni_tracker-initfromxml-failed-cant-create-any-node-of-the-requested-type/.But It won't help
Comment by WIZARD1 on 2013-03-02:
Can anybody help me?
You should install install NITE-Bin-Dev, as for me , I install NITE-Bin-Dev-Linux-x64-v1.5.2.21
Then run the install.sh in it.
Hope it helps. | {
"domain": "robotics.stackexchange",
"id": 12595,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "openi-tracker, ros-groovy, ubuntu-precise, ubuntu",
"url": null
} |
To Find The Ta for free to your devices. the taylor series expansion for cos(x) is sum from n=0 –> inf (((-1)^n)*x^(2n))/((2n)!) I have included the code …. The output data type is fixdt(1,16,14) because the output fraction length equals the input word length – 2. Then if h = t 1 - t 0, then y 1 = y 0 + h K 0 is Euler's approximation of y(t 1). For teaching purposes, we advocate using MATLAB to implement your first FE code. When this interval is the entire set of real numbers, you can use the series to find the value of f(x) for every real value of x. Creating Taylor Series in MATLAB. using Taylor series method, `(del^2f)/(delx^2) Taylor series and Matlab code. Log in to use MATLAB online in your browser or download MATLAB on your computer. Multicomplex Taylor series expansion (MCTSE) is a numerical method for calculating higher-order partial derivatives of a multivariable real- valued and complex-valued analytic function based on Taylor series …. com Download from so many Matlab finite | {
"domain": "buxtehuder-wollhaus.de",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.96741025335478,
"lm_q1q2_score": 0.8061667518708486,
"lm_q2_score": 0.8333245891029457,
"openwebmath_perplexity": 921.3362401111589,
"openwebmath_score": 0.7537301778793335,
"tags": null,
"url": "https://buxtehuder-wollhaus.de/taylor-series-approximation-matlab-code.html"
} |
quantum-mechanics, operators, schroedinger-equation, integration, eigenvalue
It's notable that this implication works only over the complex numbers, but not over e.g. the reals, and this is the reason that the standard definition of Hermiticity (which is for inner product spaces over arbitrary fields) directly uses the variant with two different vectors. | {
"domain": "physics.stackexchange",
"id": 86266,
"lm_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, operators, schroedinger-equation, integration, eigenvalue",
"url": null
} |
fourier-transform, image-processing, cross-correlation, phase, correlation
It's a bit hard to see, but there is a very high peak in the bottom-righthand corner of the image. No clear peak exists in the one dimensional version.
Why doesn't smoothing help? #1
What correlation is trying to do is to find "similar" variations in each image. If the underlying signals are sufficiently random, then this will work well: the correlation of white noise with itself gives a really nice peak at the origin, and close-to-zero elsewhere.
Smoothing a "random" image with a Gaussian will have the effect of smoothing out the correlation your expecting --- spreading the energy in any peaks over a wider area.
Smoothing has the opposite effect of "pre-whitening" the image. Pre-whitening (as the name suggests) tries to make the image more like white noise --- which has the best form if we are doing correlation-based detection (in that the peak is well-localized). | {
"domain": "dsp.stackexchange",
"id": 1828,
"lm_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, image-processing, cross-correlation, phase, correlation",
"url": null
} |
optics, electromagnetic-radiation, reflection
Title: Frustrated total internal reflection and evanescent waves - energy Total internal reflection (TIR) occurs at the boundary from an optically denser into an optically less dense medium; the boundary condition requires and evanescent wave to enter into the second medium. This wave is propagating only along (x) the boundary, and exponentially decaying normal (z) to it. Also, there's no net energy transport in z since the average of the Poynting vector vanishes. All the energy is therefore in the reflected wave. So far, so good.
If I now bring a second interface, again with an optically dense medium, close to this first one, I can convert the evanescent wave into a propagating wave (frustrated TIR). The energy transported by this propagating wave depends critically on the distance between the two surfaces, i.e. on the amount of energy picked up from the exponentially decaying wave. | {
"domain": "physics.stackexchange",
"id": 40473,
"lm_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, electromagnetic-radiation, reflection",
"url": null
} |
newtonian-gravity, resource-recommendations, planets, tidal-effect, moon
The problem is that I couldn't found values for more Solar System bodies, or any reference on how −Im$(k_2)$ changes in function of density, mass, composition, or structure. I only found values for $k_2$, but nowhere I looked I found −Im$(k_2)$. Is there a useful source somewhere where I can find a table of −Im$(k_2)$ values for the planets, or studies that estimate the number in function of the type of planet? The International Earth Rotation and Reference Systems Service (IERS) maintains a list of parameters, available online here. Chapters 6 and 7 contain values of $Im(k_2)$ as well as detailed calculations.
Note that in some cases the second Love number is real, and in others it is complex.
You can also consult the following paper for information:
Zhang, C. Z. "Love numbers of the Moon and of the terrestrial planets." Earth, Moon, and Planets 56.3 (1992): 193-207. | {
"domain": "physics.stackexchange",
"id": 94350,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "newtonian-gravity, resource-recommendations, planets, tidal-effect, moon",
"url": null
} |
newtonian-mechanics, forces, classical-mechanics, rotational-dynamics, precession
As to why you cannot find a mathematical determination:
A possible explanation for that is that the usual approximation does not take into account that the center of mass must drop a bit in order for the precessing motion to get going. A common approximation is to set up the calculation as if the spinning top starts precessing instead of pitching.
The following two resources provide all the information that is needed to understand gyroscopic precession.
A 2012 answer here on physics.stackexchange, by me, to the question: What determines the direction of precession of a gyroscope?
Paper by Svilen Kostov and Daniel Hammer: 'It has to go down in order to go around'.
Kostov and Hammer discuss how a spinning gyroscope responds to a torque, and they have performed a benchtop experiment to verify the expected behavior | {
"domain": "physics.stackexchange",
"id": 55271,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "newtonian-mechanics, forces, classical-mechanics, rotational-dynamics, precession",
"url": null
} |
kinect, opencv, openni, opencv2, cv-bridge
Originally posted by K_Yousif on ROS Answers with karma: 735 on 2013-02-17
Post score: 1
The solution was to remove the enc::MONO16 from the toCvVopy function imageOut_ = cv_bridge::toCvCopy(imageIn_) and then convert the image to type CV_U8C1 imageOut_->image.covertTo(imageOut_->image, CV_8UC1)
Originally posted by K_Yousif with karma: 735 on 2013-02-19
This answer was ACCEPTED on the original site
Post score: 1
Original comments
Comment by Median on 2013-03-11:
Can you please share the whole code? I have the exact same problem and your solution is not working. If I try to run toCvCopy without a 2nd argument I get the same exception (Unrecognized enconding).
Comment by Median on 2013-03-12:
I don't understand what ImageIn_ is .. is it a cv_bridge::CvImagePtr ??
Comment by K_Yousif on 2013-03-12:
imageIn_ is a sensor_msgs::ImageConstPt , imageOut_ is a cv_bridge::CvImagePtr
Comment by saips on 2014-08-19:
yup , this one works | {
"domain": "robotics.stackexchange",
"id": 12930,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "kinect, opencv, openni, opencv2, cv-bridge",
"url": null
} |
It seems that in set theory, variables are quantified only once. Otherwise, $$\Gamma$$ should be achieved from substitution of $$v_{j}$$ for FREE occurrences of $$v_{i}$$ in $$\Theta$$, which means that the substition should only take place the first time $$v_{i}$$ is met as a quantifier, and not for others included inside. Is it that in set theory, laws from first-order logic are relaxed so that each variable is assumed to be quantified only once?
• You are right. Really there is no variable, only "placeholders" - for example, you can write any not used letter in place of "$s$" in inner existence. Jan 16, 2021 at 3:02
Your formula is a perfectly acceptable and grammatical formula in first-order logic, and it is exactly as you say: the $$s$$ in $$Q(s)$$ is quantified by the the $$\exists s$$, while the $$s$$ in $$R(s)$$ is quantified by the $$\forall s$$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9637799420543365,
"lm_q1q2_score": 0.8229839817677237,
"lm_q2_score": 0.8539127510928476,
"openwebmath_perplexity": 214.42158292004112,
"openwebmath_score": 0.8369871377944946,
"tags": null,
"url": "https://math.stackexchange.com/questions/3987145/is-it-legitimate-to-quantify-a-variable-twice"
} |
c, generics, c11
---->
a ----> a
abc ----> cba
abcd ----> dcba
abcde ----> edcba
Review Goals:
Is this foolproof?
Can it be structured better?
Is the behavior of the code defined?
Have I missed any types? What should the default case be?
PS: Why do this? It served as a good exercise. This is Inflexible
It always allocates an output buffer on the heap, which the caller must free(). It cannot write to a buffer allocated by the caller. It cannot use a map function whose output type is different than the input type. It does not support user-defined types.
Be Aware of the Rules for Generic Types
The C17 Standard requires that, in a _Generic expression,
No two generic associations in the same generic selection shall specify compatible types. The type of the controlling expression is the type of the expression as if it had undergone an lvalue conversion [....] | {
"domain": "codereview.stackexchange",
"id": 45401,
"lm_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, generics, c11",
"url": null
} |
horizontal, vertical or oblique. Convert to Power 𝑛√ = 1 Logarithms 6. Math sheets for 6th graders for free, Homeschool printables on Bible Study Units for 7th and 10 grade, homogeneous differential equation+reduce order+example, excel square route, ti-83 adding exponents. A list of the most commonly used algebra formulas. Multiplication = + 2. CAD) and make yourself ³Ready² to receive calls from the Contact Ce. The logarithmic function y = log a x is defined to be equivalent to the exponential equation x = a y. Use your calculator to find approximate values for the following. branch format-patch Cheat Sheet Notation Useful Commands. Change an equation from LOGARITHMIC FORM to EXPONENTIAL FORM and vice versa 6. LOGARITHMS AND THEIR PROPERTIES Definition of a logarithm: If and is a constant , then if and only if. Keeping it in mind, gathered log file content type, names and location details for default McAfee logger settings. Sequences and Series Cheat Sheet 0B Arithmetic Sequences and | {
"domain": "collezionericordi.it",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9808759587767815,
"lm_q1q2_score": 0.8236748586908794,
"lm_q2_score": 0.8397339656668287,
"openwebmath_perplexity": 2595.4595773936344,
"openwebmath_score": 0.4468933343887329,
"tags": null,
"url": "http://ipyl.collezionericordi.it/logarithm-and-exponential-cheat-sheet.html"
} |
general-relativity, black-holes, angular-momentum, quantum-spin, event-horizon
Title: How can a black hole have spin? How is it possible, or even meaningful, to say that a black hole has spin? (Tangentially, if the singularity is assumed to be a point, it must have either zero or infinite angular momentum, in both cases violating conservation of momentum.) No information can be communicated out of the black hole about the singularity's spin, but even so, [to my admissibly limited knowledge] spacetime cannot be twisted, only bent. The event horizon itself is uniform and featureless, and has no properties except for size, which can only be indirectly observed as optical distortion. Magnetic field cannot escape from it. Given such restrictive conditions, what is there to suggest spin? As I am not allowed to comment for lack of reputation and cannot find a way to message I would like to point you to a reasonably recent source on the Kerr metric. I am by no means an expert but from what I have read and from what I understand the "Lines" of space time do twist and | {
"domain": "physics.stackexchange",
"id": 12201,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "general-relativity, black-holes, angular-momentum, quantum-spin, event-horizon",
"url": null
} |
python, python-3.x, django
Title: Model structure for Player Team and Match in football application I'm creating an application for foosball matches.
I have models like below:
class Player(models.Model):
match_amount = models.IntegerField(default=0)
wins = models.IntegerField(default=0)
avatar = models.ImageField(blank=True)
user = models.OneToOneField(
on_delete=models.CASCADE,
to=User,
primary_key=True,
related_name='player',
verbose_name=_('user'),
)
def __str__(self):
return self.user.get_full_name()
class Team(models.Model):
players = models.ManyToManyField(Player)
wins = models.IntegerField(default=0)
def __str__(self):
return "Team %s" % self.pk
class Match(models.Model):
date = models.DateField(default=now)
def __str__(self):
return "Match on %s" % self.date
class TeamMatch(models.Model):
team = models.ForeignKey(Team)
match = models.ForeignKey(Match) | {
"domain": "codereview.stackexchange",
"id": 24488,
"lm_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, django",
"url": null
} |
c++, algorithm, c++11, sorting, shuffle
// if there is more than one element in the vector, the element at [1] goes to [n-1]
// otherwise, we should have exited already
int index = 1;
int temp = nums[start_index];
// while we haven't looped back to the start
while ( index != start_index ) {
// move the next element
nums[previous_index] = nums[index];
previous_index = index;
// if index is in the left half of the array,
// we just move from double the index; e.g. 0 from 0, 1 from 2, 2 from 4, etc.
// otherwise, we count index spaces back from n-1, double it, and add 1
// e.g. n-1 from 1, n-2 from 3, n-3 from 5, etc.
// (n-1 - index) * 2 + 1 == (n - index) * 2 - 1
index = ( index < middle ) ? 2 * index : (n - index) * 2 - 1;
}
nums[previous_index] = temp;
} | {
"domain": "codereview.stackexchange",
"id": 12518,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, algorithm, c++11, sorting, shuffle",
"url": null
} |
c#, performance, api, .net-datatable, json.net
}
public class dataPull
{
public int a { get; set; }
//Remaining get set statements
public List<Dictionary<string, string>> cc { get; set; }
}
} You can pass all of the properties of your dataPull class in a single line which will also pass any future properties you decide to add to your object, using Reflection:
var values = data.GetType().GetProperties().Select(p => p.GetValue(data))
.Concat(new object[] {gg, ff, ee, dd});
SQLHelperTable.Rows.Add(ro.Alpha, values); | {
"domain": "codereview.stackexchange",
"id": 26018,
"lm_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, api, .net-datatable, json.net",
"url": null
} |
navigation, mapping, costmap, roscpp, costmap-2d-ros
Given below is my configuration files:
common_costmap.yaml
obstacle_range: 1.0
raytrace_range: 3.0
robot_radius: 0.376
inflation_radius: 0.45
max_obstacle_height: 0.9
observation_sources: point_cloud_sensor
point_cloud_sensor: {sensor_frame: camera_link, data_type: PointCloud, topic: /pointcloudoutput, marking: true, clearing: true, max_obstacle_height: 0.85}
local_costmap.yaml
local_costmap:
global_frame: /odom
robot_base_frame: /base_link
update_frequency: 5.0
publish_frequency: 2.0
static_map: false
rolling_window: true
width: 6.0
height: 6.0
resolution: 0.05
global_costmap.yaml
global_costmap:
global_frame: /odom
robot_base_frame: /base_link
update_frequency: 5.0
static_map: false
rolling_window: true | {
"domain": "robotics.stackexchange",
"id": 17165,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "navigation, mapping, costmap, roscpp, costmap-2d-ros",
"url": null
} |
# subtract shape-(5, 1, 3) with shape-(1, 6, 3)
# produces shape-(5, 6, 3)
>>> diffs = x.reshape(5, 1, 3) - y.reshape(1, 6, 3)
>>> diffs.shape
(5, 6, 3)
It is important to see, via broadcasting, that diffs[i, j] stores x[i] - y[j]. Thus we need to square each entry of diffs, sum over its last axis, and take the square root, in order to produce our $$M \times N$$ Euclidean distances:
# producing the Euclidean distances
>>> dists = np.sqrt(np.sum(diffs**2, axis=2))
>>> dists.shape
(5, 6)
Voilà! We have produced the distances in a vectorized way. Let’s write this out formally as a function:
def pairwise_dists_crude(x, y):
""" Computing pairwise distances using vectorization.
Parameters
----------
x : numpy.ndarray, shape=(M, D)
y : numpy.ndarray, shape=(N, D) | {
"domain": "pythonlikeyoumeanit.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.985936373783223,
"lm_q1q2_score": 0.8747272740523564,
"lm_q2_score": 0.8872045877523147,
"openwebmath_perplexity": 2337.0202310202303,
"openwebmath_score": 0.5890757441520691,
"tags": null,
"url": "http://www.pythonlikeyoumeanit.com/Module3_IntroducingNumpy/Broadcasting.html"
} |
The removal of any two points from $S^1$ results in a disconnected space, but if you remove two points from $\Bbb R^2$, you still have a connected space.
• Why do you say connectedness is "simpler" than compactness? – GEdgar May 12 '18 at 17:15
• I find it simpler, conceptually. YMMV. – G Tony Jacobs May 12 '18 at 17:19
Assume that $\mathbb{R}^2$ is homeomorphic to $S^1$. You already showed that $S^1$ is compact. Let $\mathcal{O}=\{O_i\}_{i\in I}$ be an open cover of $\mathbb{R}^2$ and $f: \mathbb{R}^2\to S^1$ a homeomorphism. Then $f(\mathcal{O})=\bigcup\limits_{i\in I}f(O_i)$ is an open cover for $S^1$, by compactness of $S^1$ it must contain a finite open subcover $\{f(O_{i_j})\}_{j=1}^k$. This gives,
$$\{f(O_{i_j})\}_{j=1}^k \supset S^1 \implies \{O_{i_j}\}_{j=1}^k\}\supset \mathbb{R}^2$$
which means that $\mathbb{R}^2$ is compact, contradiction. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9863631643177029,
"lm_q1q2_score": 0.8422680795521604,
"lm_q2_score": 0.853912747375134,
"openwebmath_perplexity": 145.73344171437094,
"openwebmath_score": 0.8360562920570374,
"tags": null,
"url": "https://math.stackexchange.com/questions/2778159/show-that-unit-circle-is-not-homeomorphic-to-the-real-line/2778164"
} |
of Cambridge Assessment Group Archives. The Rhombus. So I'm thinking of a parallelogram that is both a rectangle and a rhombus. Yes. Prove that quadrilateral MATH is a rhombus and prove that it is not a square. So MATH is a rhombus. In any rhombus, the diagonals (lines linking opposite corners) bisect each other at right angles (90°). For a quadrilateral to be a square, two things must be true: All four sides must be congruent. If a quadrilateral has four congruent sides and four right angles, then it’s a square (reverse of the square definition). This definition may also be stated as A quadrilateral is a square if and only if it is a rhombus and a rectangle. To verify if the given four points form a rhombus, we need to follow the steps given below. A square also fits the definition of a rectangle (all angles are 90°), and a rhombus (all sides are equal length). Every square has 4 right angles, so every square is a rectangle. That is, each diagonal cuts the other into two equal parts, | {
"domain": "travel2losangeles.us",
"id": null,
"lm_label": "1. Yes\n2. Yes",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9879462183543601,
"lm_q1q2_score": 0.8030692016388975,
"lm_q2_score": 0.8128673269042767,
"openwebmath_perplexity": 890.4419924473979,
"openwebmath_score": 0.8449695706367493,
"tags": null,
"url": "http://travel2losangeles.us/pentago-game-obgm/how-to-prove-a-rhombus-is-not-a-square-bfe754"
} |
javascript, jquery, html
<a href="javascript:void(0);" class="btn btn-small btnMoveDown" data-procedureid="121" data-sortorder="3"><span class="iconfa-double-angle-down">
</span>Move Down</a> | {
"domain": "codereview.stackexchange",
"id": 4559,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, jquery, html",
"url": null
} |
num FROM days -- left join other tables here to get counts, I'm using random group by days. For example, two-thirds plus four-thirds equals six-thirds. Average = Sum of terms / Number of terms. is 16 and sum of the next 3 terms is 128. Methods for Evaluating In nite Series Charles Martin March 23, 2010 Geometric Series The simplest in nite series is the geometric series. The sum of the first three terms of the sequence of terms common to the two given sequences is 3 times the second term of the sequence. The sum of geometric series refers to the total of a given geometric sequence up to a specific point and you can calculate this using the geometric sequence solver or the geometric series calculator. interval is [FIRST, LAST) NB. The sum of the members of a finite arithmetic progression is called an arithmetic series. Write a program in C++ to calculate the sum of the series (1*1) + (2*2) + (3*3) + (4*4) + (5*5) + + (n*n). Alternatively – put the first few terms of your sequence into | {
"domain": "audio-upgrade.pl",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9830850906978876,
"lm_q1q2_score": 0.8575916963243044,
"lm_q2_score": 0.8723473730188543,
"openwebmath_perplexity": 412.81979783464897,
"openwebmath_score": 0.7158166170120239,
"tags": null,
"url": "http://audio-upgrade.pl/sum-of-sequence-calculator.html"
} |
electromagnetism, electric-fields
But could you please elaborate this reason with providing reasonable equation? When the speed is pretty close to the speed of light then the look will be much different. How will you explain this case? E and B fields are elements of a second-rank tensor and hence their values in one inertial frame K' can be expressed in terms of the values in another inertial frame K. So, general Lorentz transformation from K to a system K' moving with velocity v relative to K must be in order. In true representation of these relations E and B fields are not independent of each other. A pure electrostatic field in one coordinate system wont transform into a purely magnetostatic field in another. Here is where it is more appropriate to talk about EM field rather than E or B separately. What you have here is an example of the transformation of fields seen by an observer in the system K when a point charge q moves by in a straight-line path with velocity v. The charge is at rest in system K' (attached to | {
"domain": "physics.stackexchange",
"id": 29316,
"lm_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, electric-fields",
"url": null
} |
c#
bool isCurrentUser = message.Author.Username.ToLower() == UID.ToLower();
if (!isAuthorized && !isCurrentUser)
return StatusCode(403);
Even though the big linq query for "isAuthorized" is still rather bulky and there are two IF-statements with the same result, the code is still a lot more readable. I would argue that neither version is readable enough. Extract 'til you drop. I would say in the grand scheme of things, you should wind up with very small bits of code that do atomic tests and almost reads like natural language when you're done. One possible example (I've created fake types to complete the parameters to the methods):
private static StatusCode CheckAccount(Account account, Item item, Message message, string UID)
{
const int HttpForbidden = 403;
if (!ValidAccount(account))
{
return StatusCode(HttpForbidden);
} | {
"domain": "codereview.stackexchange",
"id": 38292,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#",
"url": null
} |
Your final case is missing then the cases 1,6 | 2,6 | 3,6 | 4,6. You are correct in noting that 5,6 would fall under the first case.
Correcting this then, there are a total of $14$ outcomes in the third case, for then $\frac{16+16+14}{2^8}=\frac{23}{128}$ giving the answer of $151$ as expected.
• of course! Just an oversight. Very clear answer. Thank you. – Lucas May 31 '16 at 22:22
It boils down to counting the last ones. You'll have to have two $T$, and the arrival at $4$ net $H$ must occur exactly at toss $8$, which means it can't occur before.
The way I saw this visually was to write down the times that had the winning toss on toss $7$. As soon as I got a $T$ on toss $7$ as I was writing these down, I knew I was double counting. So the two $T$s must be within the first six tosses, but cannot be in the fifth and sixth tosses (because I would have won on toss $4$).
Here they are: | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9728307700397331,
"lm_q1q2_score": 0.8268781096293923,
"lm_q2_score": 0.8499711718571775,
"openwebmath_perplexity": 220.49112335140973,
"openwebmath_score": 0.7965359091758728,
"tags": null,
"url": "https://math.stackexchange.com/questions/1807424/probability-of-reaching-net-4-heads-when-tossing-coin-8-times"
} |
d-wave, optimization, annealing
Title: Quantum Annealing - Job Shop Problem using this paper, I want to implement a solution for the Job Shop Problem on a D-Wave machine. One of the constraints mentioned in the paper, is
$$
h_3(\bar{x}) = \sum_i \left(\sum_t x_{i,t}-1 \right)^2,
$$
and I'm curious, how to implement a general BQM for it. I need to create a Qubo matrix, based on the solution of this sum. For that I have rewritten it to
$$
\sum_i \left(\sum_t x_{i,t}-1 \right)^2 = \sum_i\left(2\sum_t\sum_{u>t}x_{it}x_{iu} - \sum_tx_{it} +1\right)
$$
and tried to fill the generall matrix with these loops
for i in range (num_operations):
for u in range(upper_time_limit):
for t in range(u):
# What to do with 2* x_{it}x_{iu} ?
for t in range(upper_time_limit):
Q[i][t] -= 1 | {
"domain": "quantumcomputing.stackexchange",
"id": 1301,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "d-wave, optimization, annealing",
"url": null
} |
There there are $5!$ possible permutations or equivalently $5!$ ways to write the numbers $1,\cdots, 5$ in any order. This is because for the first place there are $5$ options, and once that is decided for the second there are $4$ options and so on. So there are a total of $5\times 4\times 3\times 2\times 1=5!=120$ possible ways. This means that the graph has $5!$ vertices. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9759464499040092,
"lm_q1q2_score": 0.8132801743527371,
"lm_q2_score": 0.8333245891029457,
"openwebmath_perplexity": 142.31038944617143,
"openwebmath_score": 0.8100820183753967,
"tags": null,
"url": "https://math.stackexchange.com/questions/678354/is-the-graph-planar-bipartite-regular"
} |
Amber G.
BRF Oldie
Posts: 7001
Joined: 17 Dec 2002 12:31
Location: Ohio, USA
### Re: BR Maths Corner-1
ArmenT wrote:
Amber G. wrote:>> It is *very* easy now to get other solutions of larger numbers if one wants to | {
"domain": "bharat-rakshak.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9697854146791214,
"lm_q1q2_score": 0.8102397524600189,
"lm_q2_score": 0.8354835411997897,
"openwebmath_perplexity": 3346.033401829154,
"openwebmath_score": 0.6928684711456299,
"tags": null,
"url": "https://forums.bharat-rakshak.com/viewtopic.php?f=2&t=4201&start=800"
} |
ros, imu, robot, ros-indigo
Title: Question about imu emplacement
hi ,
i have a sensor imu (razor_imu_9dof) and i'm using the ekf package to combine it with the odom data that coming from encoder , my question is where should i put the imu on the robot , i have a differential robot like a big version of turtlebot but i don't know if i have to put the imu between the wheels or anywhere in the robot and i use the tf to transfomr data to base_link , can you give any advice ?
thank you
Originally posted by kesuke on ROS Answers with karma: 58 on 2018-08-03
Post score: 0
I have two suggestions: | {
"domain": "robotics.stackexchange",
"id": 31456,
"lm_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, imu, robot, ros-indigo",
"url": null
} |
homework-and-exercises, classical-mechanics, lagrangian-formalism, field-theory
You can halt at this stage and carry on to evaluate the derivative $\frac{\partial \mathcal{L}}{\partial (\partial_x \phi)}$ first, and you should yield something like $\mu [(\partial_t \phi) \dot{x} + (\partial_x \phi) \dot{x}^2] - Y \partial_x \phi$. And since the Lagrangian density does not depend on $\phi$, $\frac{\partial \mathcal{L}}{\partial \phi} = 0$. (Do try to calculate them yourself! I may be wrong here :p)
Combining what you have, you should be able to get the EL equation to be:
$\partial_t \mu [\partial_t \phi + (\partial_x \phi) \dot{x}] + \partial_x \mu [\partial_t \phi + (\partial_x \phi) \dot{x}] \dot{x} - Y \partial_{xx} \phi = 0 $
The third term is obviously the RHS of the equation that you need to prove. What is perhaps messy is the first two terms, but you should refer back to the first equation that we had discussed previously, i.e. $D_t = \partial_t + \partial_x \dot{x}$; with this, it is pretty straightforward to show that | {
"domain": "physics.stackexchange",
"id": 13586,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises, classical-mechanics, lagrangian-formalism, field-theory",
"url": null
} |
inverse-kinematics, matlab, manipulator
where $q$ is 'pushed' towards the right solution, updated until the error is minimized. But for additional constraints, the equation (Siciliano, Bruno, et al. Robotics: modelling, planning and control) specifies
$$
\dot{q} = J^\dagger*v_e - (I-J^\dagger J)\dot{q_0}
\\
\dot{q_0} = k_0*(\frac{\partial w(q)}{\partial q})^T
$$ | {
"domain": "robotics.stackexchange",
"id": 1222,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "inverse-kinematics, matlab, manipulator",
"url": null
} |
machine-learning, classification, data-mining, predictive-modeling, time-series
How should I find the most similar usages out of these 10-day usages for my baseline calculation? I think the most/maximum similar usage days represent the days used for baseline calculation. Ad 1. Assuming the measurements at any given time are normally distributed (they shape approximately a bell curve), you could use simple standard deviation to detect outliers. Specifically, for any given time, you can calculate the mean and standard error. Then you calculate the mean sans outliers by taking into account only the measurements that fall at most some pre-set distance from the mean (e.g. given normal distribution, 68% of measurements fall within one standard deviation from the mean).
Pseudo-code example:
# Measurements at time t0 for all 10 days
t0 = np.array([0.1, 0.1, 1.4, .9, 1.25, 1.25, 1.5, 0.1, 0.3, 1.75]) | {
"domain": "datascience.stackexchange",
"id": 862,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "machine-learning, classification, data-mining, predictive-modeling, time-series",
"url": null
} |
pandas
Title: Pandas: saving timedelta to Parquet Looks like Pandas doesn't translate Pandas timedelta to Parquet INTERVAL:
>>> import pandas as pd
>>> df = pd.DataFrame([{'seconds': 30}])
>>> df.to_parquet('/tmp/test.parquet') # so far so good
>>> df['duration'] = pd.to_timedelta(df.seconds, unit='seconds')
>>> df.to_parquet('/tmp/test.parquet')
Traceback (most recent call last):
/ ... /
pyarrow.lib.ArrowNotImplementedError: Unhandled type for Arrow to Parquet schema conversion: duration[ns]
>>>
Is this simply a missing feature? Am I wrong to expect timedelta to be saved as INTERVAL? Which format would you recommend if my dataframe is quite large (500mb) but I'll read it back to Pandas - .to_pickle()? yes missing feature. See https://issues.apache.org/jira/browse/ARROW-6780
you could try engine=fastparquet | {
"domain": "datascience.stackexchange",
"id": 10255,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "pandas",
"url": null
} |
python, beginner, windows
def walk_file_system(working_directory):
current_files = []
yesterday = datetime.date.today() - datetime.timedelta(days=1)
for root, dirs, files in os.walk(working_directory):
# TODO: Move all these directories to config, determine how to
# filter dirs list
if 'Marked' in dirs:
dirs.remove('Marked')
if 'BackupNonCritical' in dirs:
dirs.remove('BackupNonCritical')
if 'Attachments' in dirs:
dirs.remove('Attachments')
if 'x_GrouplinkBackupDB_20131121' in dirs:
dirs.remove('x_GrouplinkBackupDB_20131121')
if 'x_JIRA-LastOldJiraBackup' in dirs:
dirs.remove('x_JIRA-LastOldJiraBackup')
if 'x_PTS-DB' in dirs:
dirs.remove('x_PTS-DB')
if 'x_IvanBackups' in dirs:
dirs.remove('x_IvanBackups')
if 'x_PTS-Devel' in dirs:
dirs.remove('x_PTS-Devel')
if 'x_DBAPPS' in dirs:
dirs.remove('x_DBAPPS') | {
"domain": "codereview.stackexchange",
"id": 22423,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, beginner, windows",
"url": null
} |
rotation, conventions, chirality
Title: What does "clockwise" mean, exactly? I am in the middle of a discussion with a friend about the meaning of the term "clockwise".
Wikipedia indicates that a clockwise rotation goes as top-right-down-left.
However, my friend argues that "the clock is facing opposite to you. So if you rotate top-right-down-left facing the side the clock is facing then it is anti-clockwise."
Our question, therefore, is
does "clockwise" mean top-right-down-left or left-down-right-top? The clockwise direction is normally defined by the right hand grip rule.
When your thumb is pointing away from you, your fingers are curled clockwise. So when you look at a clock the axis of rotation is away from you through the clock.
I'd guess the downvotes are because people believe your question is not physics related, but in fact this rule is how you determine the direction of the angular momentum vector, so there is a connection with physics. | {
"domain": "physics.stackexchange",
"id": 8697,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "rotation, conventions, chirality",
"url": null
} |
gazebo, ros-kinetic, ubuntu, hector-localization, hector-quadrotor
cd /home/carsten/kinetic_ws/build/hector_pose_estimation_core; catkin build --get-env hector_pose_estimation_core | catkin env -si /usr/bin/cmake /home/carsten/kinetic_ws/src/hector_localization/hector_pose_estimation_core --no-warn-unused-cli -DCATKIN_DEVEL_PREFIX=/home/carsten/kinetic_ws/devel/.private/hector_pose_estimation_core -DCMAKE_INSTALL_PREFIX=/home/carsten/kinetic_ws/install; cd -
...............................................................................
Failed << hector_pose_estimation_core:cmake [ Exited with code 1 ]
Failed <<< hector_pose_estimation_core [ 1.7 seconds ]
Abandoned <<< hector_pose_estimation [ Unrelated job failed ]
Finished <<< message_to_tf [ 6.5 seconds ]
[build] Summary: 1 of 3 packages succeeded.
[build] Ignored: 14 packages were skipped or are blacklisted. | {
"domain": "robotics.stackexchange",
"id": 30478,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gazebo, ros-kinetic, ubuntu, hector-localization, hector-quadrotor",
"url": null
} |
thermodynamics, boiling-point
More importantly, however, the boiling point depends on the magnitude of attractive intermolecular forces compared to kT, whereas the heat capacity depends on all the available degrees of freedom (including intramolecular). Therefore you can envision large and small molecules with similar overall solution composition (for instance hydrocarbons) - and thus similar heat capacities - but very different BPs. See for instance this
table of specific heats, where C for hexane through dodecane are very similar, whereas their BPs differ quite a bit. | {
"domain": "chemistry.stackexchange",
"id": 10884,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "thermodynamics, boiling-point",
"url": null
} |
java, complexity
But the output should be
12345
d
8
h
mnopq
It's unclear why you chose this.
System.out.print(a[i][j-1]);
This could be
System.out.print(a[i][j]);
Then it prints the output correctly.
Avoid unnecessary comparisons in loops
You iterate over each element in the entire square and print different things based on an if/else structure. But you don't actually have to do that. Consider
public static void drawZ(String[][] matrix) {
System.out.println(String.join("", matrix[0]));
int n = matrix.length - 1;
for (int i = 1; i < n; i++)
{
int m = matrix.length - i - 1;
for (int j = m; j > 0; j--)
{
System.out.print(" ");
}
System.out.println(matrix[i][m]);
}
System.out.println(String.join("", matrix[n]));
} | {
"domain": "codereview.stackexchange",
"id": 25219,
"lm_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, complexity",
"url": null
} |
c++, recursion, template, c++20, constrained-templates
Simplify the base case
The code is a little bit more complex than necessary because you made the innermost range the base case. But if you instead use the values of the innermost range the base case your code can look like:
template<class T, class UnaryPredicate>
constexpr auto recursive_all_of(T&& value, UnaryPredicate p) {
return std::invoke(p, value);
}
template<std::ranges::input_range T, class UnaryPredicate>
constexpr auto recursive_all_of(T& inputRange, UnaryPredicate p) {
return std::ranges::all_of(inputRange, [&](auto&& range) {
return impl::recursive_all_of(range, p);
});
} | {
"domain": "codereview.stackexchange",
"id": 45377,
"lm_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++, recursion, template, c++20, constrained-templates",
"url": null
} |
electromagnetism
However, one can argue as the following:
We all know that "same laws of physics apply in all inertial frames". With a constant velocity $\vec v$,the rest frame of the rods is an inertial frame. Therefore, if Biot-Savart law applies in our frame, it has to apply in the rest frame. If so, none of the rods will feel a magnetic field from the other one because their relative speed is zero, and there will be no magnetic force between the rods.
I've seen this question several times before in references, exams, exercise sheets,and in many different forms (parallel planes, beam of electrons ...),but no one ever used this argument.What is the problem in it ? Is it something related to Maxwell's equations or special relativity ? Or what else ?
I know a similar question was asked before, but the answers weren't satisfying. Please provide your answers with necessary mathematics. I think about this problem the same way that you do, but I phrase it slightly differently. | {
"domain": "physics.stackexchange",
"id": 45504,
"lm_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",
"url": null
} |
homework-and-exercises, newtonian-mechanics
Make sure to pay attention to what the signs mean, and what direction is "tangential".
The analysis I've provided above is only useful at the instant that the cord is cut. It's always valid, but not always useful, because the rod really can't be regarded as a point particle. As soon as the rod is no longer vertical, you will need to appeal to a the angular momentum equation $d\vec{L}/dt = \vec{\tau}_\text{net,ext}$ instead. If you haven't studied torque and angular momentum yet, then you can probably safely ignore this and just treat it as I did above.
Good luck! | {
"domain": "physics.stackexchange",
"id": 22430,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises, newtonian-mechanics",
"url": null
} |
javascript, performance, algorithm, memory-optimization
When I assign values to variables outside of loops but within the function, are there space complexities that I should pay attention to or does garbage collection take care of this? Is this \$O(1)\$ space complexity as I'm just keeping track of the indices? Feel free to breakdown space complexity as I truly do want to have a more solid understanding of memory management.
I believe I've accounted for the edge cases that I can think of, but are there more that I should be aware of?
I placed the if condition for checking lengths at the top even before the index definitions because I figured that if they aren't even the same size, why bother with doing anything else. Is that weird?
function isMergedArray(half1, half2, mergedArray) {
if ((half1.length + half2.length) != mergedArray.length ) {
return false;
} | {
"domain": "codereview.stackexchange",
"id": 33321,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, performance, algorithm, memory-optimization",
"url": null
} |
françaises describes. Estimator and is given by the third standardized moment measure something relative to a standard bell curve of population... To check the irregularity and asymmetry of the asymmetry of the probability distribution assuming a unimodal distribution and is not... Forces in physics or outliers the definition of skewness is a commonly used measure the! Forces in physics the central peak is, relative to a normal has... 'S correction before computing the skewness Value can be positive, zero, negative, or undefined describes tail. Has been taken from physics and the kurtosis ( fourth moment ) degree of of... Bono, et al looks the same to the standard normal distribution 3! In statistics the values measure something relative skewness moment r the standard normal distribution has a kurtosis of 3 “! Takes into account lower order moments and is given by the third standardized moment of in... Values mean it 's from some other certain measure called the moments to identify the | {
"domain": "kstc.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9802808718926534,
"lm_q1q2_score": 0.8252255794693648,
"lm_q2_score": 0.8418256472515684,
"openwebmath_perplexity": 1569.546396596111,
"openwebmath_score": 0.7885283827781677,
"tags": null,
"url": "https://kstc.com/443o6mw/page.php?5c9398=skewness-moment-r"
} |
reference-request, big-list, ds.data-structures, functional-programming
Many procedures for making data structures persistent, fully persistent, or confluently persistent: Haim Kaplan wrote an excellent survey on the topic. See also above the work of Demaine et al., who demonstrate a fully persistent array in $O(m)$ space (where $m$ is the number of operations ever performed on the array) and $O(\lg \lg n)$ expected access time.
1989: Randomized Search Trees by Cecilia R. Aragon and Raimund Seidel: These were discussed in a purely functional setting by Guy E. Blelloch and Margaret Reid-Miller in Fast Set Operations Using Treaps | {
"domain": "cstheory.stackexchange",
"id": 3687,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "reference-request, big-list, ds.data-structures, functional-programming",
"url": null
} |
distance-metrics
Title: Metric Spaces: Why $L_\infty$ selects the maximum value I have a basic question about the metric spaces. There are several metric spaces like $L_1$, $L_2$ to $L_\infty$. The $L_p$ metric is defined by the following equation:
$$d_p(x,y)=\left(\sum_{i=1}^{n}|x_i-y_i|^p \right)^{1/p}$$
Now, when $p = \infty$, then the equation of the matrix is following:
$$d_{\infty}(x,y)=\max_{i=1,2,\ldots, n}|x_i-y_i|$$
Now, I am taking the value of $x$ as $x = [1,2,3]^T$ (Transpose) and compute $L_p$ metric for, $p = 1,2$ and $\infty$.
My question is, why $L_\infty$ metric choose the maximum value. In the general case, let $x = (x_1,\dots,x_n)$ be a finite-length vector (in a finite dimensional space).
The finite sequence of absolute values $|x_i|$ does attain its maximum (because the sequence is finite), denoted $M = \max_i |x_i|$. | {
"domain": "dsp.stackexchange",
"id": 3599,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "distance-metrics",
"url": null
} |
c++, vectors
void ApplyThreshold(vector<vector<int>> &Matrix2D, int threshold);
vector<vector<int>> CreateContourMatrix(vector<vector<int>> &pMatrix);
int main()
{
const int cutOff = 2;//The value on which to base the creation of contours
vector<vector<int>> matrix;
//Setup test data
matrix.push_back(vector<int> { 1, 1, 1, 1, 1 });
matrix.push_back(vector<int> {1, 2, 3, 2, 1, });
matrix.push_back(vector<int> {1, 3, 3, 3, 1, });
matrix.push_back(vector<int> {1, 2, 3, 2, 1, });
matrix.push_back(vector<int> {1, 1, 1, 1, 1, });
vector<vector<int>> pMatrix = matrix; | {
"domain": "codereview.stackexchange",
"id": 24333,
"lm_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++, vectors",
"url": null
} |
ros, rviz, clearpath
and achieve what I want. But there are a number of links on the robot model and I don't want to specify all of them because the relationship between all these links is already known (like in the tf tree)
How can I solve this problem? Is there not a relationship between the model state values and the link state values since both are the robot. I guess what I am asking is - how do I reset the joint states?
Thank you.
Originally posted by 2ROS0 on ROS Answers with karma: 1133 on 2014-12-04
Post score: 0
Update: deleting the model and respawning it works. Still need to restart the spawn_model node for that. Is there a faster way to do it through the spawn_model rosservice? I'm not sure how I'm going to run xacro.py on it before loading the model through the service.
Originally posted by 2ROS0 with karma: 1133 on 2014-12-08
This answer was ACCEPTED on the original site
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 20243,
"lm_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, rviz, clearpath",
"url": null
} |
ros-lunar, catkin, ros-kinetic, cmake, ros-indigo
Title: When is ${catkin_EXPORTED_TARGETS} needed
This is basically a follow-up to #q285772
During my use of ROS, I adopted to call the following line on any (C++) target that I try to build:
add_dependencies(MYTARGET ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
using ${${PROJECT_NAME}_EXPORTED_TARGETS} only when building msg/srv/actions/dynamic_reconfigure in the package I am workin on, and ${catkin_EXPORTED_TARGETS} always.
This is a constant source of error, as well in the above cited question. Thus, I always adviced People to follow the same strategy.
In a comment to the above question, @gvdhoorn described the approach to always use ${catkin_EXPORTED_TARGETS} as "cargo-cultish" (nice term :-D)
re: adding catkin_EXPORTED_TARGETS:
that's a bit cargo cult-ish. I
wouldn't add that unless it's needed.
Checking the documentation (e.g. wiki, catkin docs 1 or catkin docs 2) I'm not quite sure when to use it.
The wiki suggest that: | {
"domain": "robotics.stackexchange",
"id": 30423,
"lm_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-lunar, catkin, ros-kinetic, cmake, ros-indigo",
"url": null
} |
ros, raspbian, ros-indigo
make[1]: *** [CMakeFiles/roscpp.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
<== Failed to process package 'roscpp':
Command '['/opt/ros/indigo/env.sh', 'make', '-j4', '-l4']' returned non-zero exit status 2 | {
"domain": "robotics.stackexchange",
"id": 22814,
"lm_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, raspbian, ros-indigo",
"url": null
} |
These results are correct to four decimal places.
EXAMPLES
1. Using formula (H) for interpolation by first differences, calculate the following functions:
(a) $\cos 61^\circ$, taking $a = 60^\circ$. (c) $\sin 85.1^\circ$, taking $a = 85^\circ$. (b) $\tan 46^\circ$, taking $a = 45^\circ$. (d) $\cot 70.3^\circ$, taking $a = 70^\circ$.
2. Using formula (I) for interpolation by second differences, calculate the following functions:
(a) $\sin 11^\circ$, taking $a = 10^\circ$. (c) $\cot 15.2^\circ$, taking $a = 15^\circ$. (b) $\cos 86^\circ$, taking $a = 85^\circ$. (d) $\tan 69^\circ$, taking $a = 70^\circ$.
3. Draw the graphs of the functions $x$, $x - \tfrac{x^3}{3!}$, $x - \tfrac{x^3}{3!} + \tfrac{x^5}{5!}$, respectively, and compare them with the graph of $\sin x$. | {
"domain": "wikisource.org",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9888419700672151,
"lm_q1q2_score": 0.8061360963946423,
"lm_q2_score": 0.8152324848629214,
"openwebmath_perplexity": 349.72416740049397,
"openwebmath_score": 0.9539878964424133,
"tags": null,
"url": "http://en.wikisource.org/wiki/Page:Elements_of_the_Differential_and_Integral_Calculus_-_Granville_-_Revised.djvu/264"
} |
reinforcement-learning, deep-rl, open-ai, off-policy-methods, on-policy-methods
Title: Can we combine Off-Policy with On-Policy Algorithms? On-Policy Algorithms like PPO directly maximize the performance objective or an approximation of it. They tend to be quite stable and reliable but are often sample inefficient. Off-Policy Algorithms like TD3 improve the sample inefficiency by reusing data collected with previous policies, but they tend to be less stable. (Source: Kinds of RL Algorithms - Spinning up - OpenAI)
Looking at learning curves comparing SOTA algorithms, we see that off-policy algorithms quickly improve performance at the training's beginning. Here an example: | {
"domain": "ai.stackexchange",
"id": 1976,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "reinforcement-learning, deep-rl, open-ai, off-policy-methods, on-policy-methods",
"url": null
} |
fluid-statics, surface-tension
to\ B}}{kT}\right)$ and exp $\left(-\frac{E_{B\ to\ S}}{kT}\right)$.] This tends to deplete the surface layer, which in turn reduces the movement of molecules from surface to bulk, re-establishing (dynamic) equilibrium (equal rates of movement to and from the surface layer). | {
"domain": "physics.stackexchange",
"id": 63079,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fluid-statics, surface-tension",
"url": null
} |
quantum-mechanics, hilbert-space, operators, wavefunction, notation
We start by just understanding how to transform the state from being represented in the $x$-representation to being represented in the $u$-representation.
Suppose we have a quantum state $\lvert \psi\rangle$, representable in the position eigenbasis as
\begin{align*}
\lvert\psi\rangle &= \int_{-\infty}^{\infty}dx\,\lvert x\rangle\langle x | \psi \rangle
= \int_{-\infty}^{\infty}dx\,\psi(x)\lvert x\rangle\,.
\end{align*}
Consider an operator $\hat{u}=g(\hat{x})$, where $u=g(x)$ is (for simplicity) an invertible, increasing function on $\mathbb{R}$. The eigenbasis of $\hat{u}$ is the same as the eigenbasis for $\hat{x}$, since
$$
\hat{u}\lvert x\rangle = g(\hat{x})\lvert x\rangle = g(x) \lvert x\rangle = u \lvert x\rangle\,.
$$
However, despite the fact that the eigenbases are identical, we don't want to label the vector with $u$ directly, i.e., $\lvert x\rangle \neq \lvert u\rangle$; there is a difference in overall factor that comes in due to a Jacobian. | {
"domain": "physics.stackexchange",
"id": 83466,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, hilbert-space, operators, wavefunction, notation",
"url": null
} |
gazebo
Originally posted by F-word on Gazebo Answers with karma: 11 on 2013-08-12
Post score: 0
Original comments
Comment by F-word on 2013-08-14:
I think I've figured this out. Thank everybody for viewing. I will close this question.
It's a protobuf message:
http://gazebosim.org/msgs/1.9.1/world__stats_8proto.html
Originally posted by nkoenig with karma: 7676 on 2013-09-15
This answer was ACCEPTED on the original site
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 3422,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gazebo",
"url": null
} |
optics, atmospheric-science, weather
So at the time these images were generated the Sun is 60° above the horizon:
In the graphs the angle is the angle above the southern horizon, so at an angle of 60° you are looking directly at the Sun. That's why the maximum brightness is at that angle. | {
"domain": "physics.stackexchange",
"id": 82942,
"lm_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, atmospheric-science, weather",
"url": null
} |
Because we should be concerned about the introduction of a component in the direction of $x_0$ due to roundoff error, we may want to reorthogonalize with respect to $x_0$ in each iteration:
\begin{equation*} \begin{array}{lll} x_0 := x_0 / \| x_0 \|_2 \amp \mbox{ } \amp \mbox{ normalize known eigenvector } x_0 \mbox{ to have length one } \\ v_1 := \mbox{ random vector} \\ v_1 := v_1 - x_0^Hv_1 x_0 \amp \amp \mbox{ make sure the vector is orthogonal to } x_0 \\ v_1^{(0)} := v_1 / \| v_1 \|_2 \amp \amp \mbox{ normalize to have length one } \\ {\bf for~} k:=0, \ldots \\ ~~~ v_1 := A v_1^{(k)} \\ ~~~ v_1 := v_1 - x_0^Hv_1 x_0 \amp \amp \mbox{ make sure the vector is orthogonal to } x_0 \\ ~~~ v_1^{(k+1)} := v_1 / \| v_1 \|_2 \amp \amp \mbox{ normalize to have length one } \\ {\bf endfor} \end{array} \end{equation*}
###### Homework10.1.1.3.
Copy PowerMethodLambda1.m into PowerMethodLambda1Reorth.m and modify it to reorthogonalize with respect to x0: | {
"domain": "utexas.edu",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9848109503004294,
"lm_q1q2_score": 0.8573737331495859,
"lm_q2_score": 0.8705972784807408,
"openwebmath_perplexity": 1336.0382696372924,
"openwebmath_score": 0.9999790191650391,
"tags": null,
"url": "https://www.cs.utexas.edu/users/flame/laff/alaff/chapter10-launch.html"
} |
Why? A $d_{F}$-convergent sequence is also $d$-convergent since $d \leq d_F$. On the other hand, a $d$-convergent sequence converges with respect to $d_F$, as $d_F$ is continuous with respect to $d$. This means that $(X,d)$ and $(X,d_F)$ have the same closed sets, hence the metrics $d$ and $d_F$ induce the same topology. Since $d_F(y_n, y_0) = d(y_n,y_0) + n \geq n$ the metric $d_F$ is unbounded.
I don't see any easier way how to prove this. One can make this argument a little more explicit by replacing $F$ by an explicit function depending on the metric, but little is gained except that the proof becomes a bit more explicit and basic.
Because Google doesn't like me, I can't see the relevant page 287 of John M.'s reference to Exercise 1.13 in K.D. Joshi, Introduction to general topology, New Age International, 1983, but as Pierre-Yves kindly transcribed the exercises in the comments, I see no need of reproducing them here. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9653811591688146,
"lm_q1q2_score": 0.8065600674926482,
"lm_q2_score": 0.8354835391516133,
"openwebmath_perplexity": 236.31340532289425,
"openwebmath_score": 0.8503453135490417,
"tags": null,
"url": "http://math.stackexchange.com/questions/58815/a-separable-locally-compact-metric-space-is-compact-iff-all-of-its-homeomorphic"
} |
This figure can also lead to a conclusion, that when lambda is too large, the model will under-fitting.
Reference:
Machine Learning Course
Exercise 5
#### Related Posts
1. I'm having trouble replicating your results. In your code shown I have two questions: (1) when is the cost function, J, called? and (2) shouldn't the "i:niter" in gradDescent function be "1:niter"?
I forgot to mention: I really enjoy your Open Classroom posts!
1. yes, the cost function is defined as J.
2. you are right, sorry for the typo.
I am glad that you find it useful.
But shouldn't J be called somewhere in the code?
Actually, the derivative function of J is need, but not J itself.
As you can see, the variable *dj* in function *gradDescent*.
2. Running your code as posted I get "Error: object 'm' not found" and "Error: object 'lambda' not found" if I set m to some dummy value -- so my question really is where are those variables set, or initialized, besides in *J*? | {
"domain": "ygc.name",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9425067244294588,
"lm_q1q2_score": 0.8205437908202986,
"lm_q2_score": 0.8705972801594707,
"openwebmath_perplexity": 4935.764602199185,
"openwebmath_score": 0.701530396938324,
"tags": null,
"url": "http://ygc.name/2011/10/25/machine-learning-5-1-regularized-linear-regression/"
} |
python, numpy, simulation, matplotlib, physics
dot = np.dot(r, mu)
if isinstance(dot, np.ndarray):
dot = dot[:, :, np.newaxis]
B1 = 3*r*dot / rmag**5 # first term to the magnetic field
B2 = -mu / rmag**3 # second term
return B1, B2
def bot_field(xyz: np.ndarray) -> np.ndarray:
"""
Calculates magnetic bottle field.
This function will come in handy when we illustrate the field along and ultimately illustrate the
particle motion in field
"""
z_disp = 10 # displacement of the two magnetic dipoles with respect to zero (one at z = -z_disp, the other at +z_disp)
pos = np.array((0, 0, z_disp)) # position of the first dipole
# point dipoles
B1_A, B2_A = make_dipole(pos, xyz)
B1_B, B2_B = make_dipole(-pos, xyz)
return mu_0/4/np.pi * (B1_A + B2_A + B1_B + B2_B) # field due to magnetic bottle | {
"domain": "codereview.stackexchange",
"id": 42459,
"lm_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, numpy, simulation, matplotlib, physics",
"url": null
} |
javascript, mysql, sql, node.js
// Create the UserBook object
return {
// The db object kept locally
db: theDB,
updateUser: function(profile, userRegistered) {
var db = this.db;
// See if the user exists.
db.query( 'SELECT * FROM Users WHERE Provider=? AND ProviderId=? LIMIT 1',
[profile.provider, profile.providerId],
function(err, rows) {
if (err) throw err;
if (rows.length == 1) {
// If we have found a local user the set the ID
profile.id = rows[0].ID; | {
"domain": "codereview.stackexchange",
"id": 5537,
"lm_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, mysql, sql, node.js",
"url": null
} |
material-science, geometry, continuum-mechanics
Thanks to gerry for the key word (given in a comment above). I can now make my above guess more concrete. The limit on the number of folds (for a given length) does follow from the necessary curvature on the fold. The type of image you see for this makes it clear what's going on | {
"domain": "physics.stackexchange",
"id": 100180,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "material-science, geometry, continuum-mechanics",
"url": null
} |
ros, rosservices
## Generate added messages and services with any dependencies listed here
# generate_messages(
# DEPENDENCIES
# std_msgs
# )
###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if you package contains header files
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
# INCLUDE_DIRS include
# LIBRARIES testerinfo
CATKIN_DEPENDS roscpp rospy std_msgs
CATKIN_DEPENDS message_runtime
# DEPENDS system_lib
)
###########
## Build ##
########### | {
"domain": "robotics.stackexchange",
"id": 22496,
"lm_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, rosservices",
"url": null
} |
quantum-mechanics, homework-and-exercises, schroedinger-equation
Also, by Schrodinger equation,
\begin{align*}
\frac{\partial \Psi_1^*}{\partial t} =& -\frac{1}{i\hbar}\left[ - \frac{\hbar^2}{2m}\frac{\partial^2\Psi_1^*}{\partial x^2} + V\Psi_1^* \right] \\
\frac{\partial \Psi_2}{\partial t} =& \frac{1}{i\hbar}\left[ -\frac{\hbar^2}{2m}\frac{\partial^2\Psi_2}{\partial x^2} + V\Psi_2 \right]
\end{align*}
Thus the integrand of $d\gamma /dt$ is
$$
\frac{1}{i\hbar}\frac{\partial}{\partial x} \left[ -\frac{\hbar^2}{2m}\left( \Psi_1^* \frac{\partial \Psi_2}{\partial x}-\frac{\partial \Psi_1^*}{\partial x} \Psi_2 \right) \right].
$$
Hence, the integral is
$$
\frac{1}{i\hbar}\left[ -\frac{\hbar^2}{2m}\left( \Psi_1^* \frac{\partial \Psi_2}{\partial x}-\frac{\partial \Psi_1^*}{\partial x} \Psi_2 \right) \right]
$$
evaluated at $x = \infty , -\infty$. By boundary condition this integral vanishes, thus $d\gamma/dt=0$. This means that $\gamma(t)$ doesn't change with respect to $t$. This is the end of my solution. | {
"domain": "physics.stackexchange",
"id": 75036,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, homework-and-exercises, schroedinger-equation",
"url": null
} |
estimation, self-study, covariance, terminology, estimators
If we normalize the signal level to be the same at input and output, the noise standard deviation will have changed by a factor of $1/\sqrt{N}$, and it's variance by $1/N$, matching your equation.
Stating this mathematically, consider our samples at the output of the multiplier as
$$X_i\quad\text{for}\quad i=1, 2, \ldots, N$$
The multiplication by $+1/-1$ does not change the distribution of the noise on the input samples (they will still be independent and identically distributed, IID), with the same variance as the input given as
$$\textrm{Var}(X_i) = \sigma^2$$
Multiplying by $\pm 1$ with a synchronized PRN causes the mean to be 1 as previously described,
$$E(X_i)=1$$
We will denote the output after accumulating over all $N$ samples as $Y$, but we will also divide by $N$ to be consistent with the normalized autocorrelation $r_{uu}=1 = E(Y)$:
$$r_{uu} = \frac{1}{N}\Sigma_1^N X_i = E(Y)$$
Where $X_i$ is the product of the input waveform with the PRN. | {
"domain": "dsp.stackexchange",
"id": 4841,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "estimation, self-study, covariance, terminology, estimators",
"url": null
} |
imu, navigation, gps, robot-localization
Original comments
Comment by IvanV on 2014-11-14:
(1/3) Thank you for pointing these errors. The negative Z acceleration is probably a mistake by me when converting the raw IMU data to an IMU message, and using the pseaa instead the imu probably was the 112342345235 change...
I will fix them and try it again right now. (follows in next comment)
Comment by IvanV on 2014-11-14:
(2/3) Regarding the first issue, I will submit the feature request, but, for the time being, if I use utm_transform_node will I get map->odom with map in UTM coordinates?
Comment by IvanV on 2014-11-14:
(3/3) Finally, cmd_vels are actually sent to the robot, but being a USV catamaran with differential thruster steering, the inertia and drift are so huge that I thought that it would do more damage than good. Moreover, the USV is dry-docked, and I will be unable to move it at least until next week.
Comment by IvanV on 2014-11-14: | {
"domain": "robotics.stackexchange",
"id": 20040,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "imu, navigation, gps, robot-localization",
"url": null
} |
quantum-field-theory, feynman-diagrams, path-integral, perturbation-theory, interactions
Why should we draw a bubble like shown above? If I am not mistaken, we should have two external legs due to having two propagators and $4$ vertices due to having $4$ sources. However, I only see two vertices here... what am I missing?
PS: Please note this is not a homework question. I am studying Osborn notes, section 2.2. Interacting Scalar Field Theories, and I want to understand how he constructed the Feynman rules (page 23) via working out the simplest example I could find: $\phi^3$ theory
EDIT 0
Let me go slowly here. I will only focus on second order terms. As stated in the comments, we should get $\propto \int \mathrm{d}^4 z \int \mathrm{d}^4 w J(x) \Delta_F(x-z) \Delta_F^2(z-w) \Delta_F(w-y) J(y)$
This is what I have done so far
\begin{align*}
&\exp\left(\frac{i}{2}\int d^d x \int d^d y \frac{\delta}{\delta \phi(x)}\Delta_F(x-y) \frac{\delta}{\delta \phi(y)}\right) \exp\left(i \int d^d t \left( -\frac{\lambda}{3!}\phi^3+J\phi \right)\right)\Big|_{\phi=0}
\\ | {
"domain": "physics.stackexchange",
"id": 76860,
"lm_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, feynman-diagrams, path-integral, perturbation-theory, interactions",
"url": null
} |
## Ch112
The aorta carries blood away from the heart at a speed of about 39 cm/s and has a radius of approximately 1.0 cm. The aorta branches eventually into a large number of tiny capillaries that distribute the blood to the various body organs. In a capillary, the blood speed is approximately 0.072 cm/s, and the radius is about 6.2 x 10-4 cm. Treat the blood as an incompressible fluid, and use these data to determine the approximate number of capillaries in the human body.
• solve in the same approach...
The aorta carries blood away from the heart at a speed of about 44 cm/s and has a radius of approximately 1.2 cm. The aorta branches eventually into a large number of tiny capillaries that distribute the blood to the various body organs. In a capillary, the blood speed is approximately 0.071 cm/s, and the radius is about 6.4 x 10-4 cm. Treat the blood as an incompressible fluid, and use these data to determine the approximate number of capillaries in the human body. | {
"domain": "chegg.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9793540692607816,
"lm_q1q2_score": 0.822396874408295,
"lm_q2_score": 0.839733963661418,
"openwebmath_perplexity": 1561.22366523374,
"openwebmath_score": 0.8439953327178955,
"tags": null,
"url": "http://www.chegg.com/homework-help/questions-and-answers/the-aorta-carries-blood-away-from-the-heart-at-a-speed-of-about-39-cm-s-and-has-a-radius-o-q3378666"
} |
c++, c++17, fltk
it_last_result = it_result;
it_begin = ++it_result;
}
return words;
}
std::vector<Word> longest_words(const std::map<Word, Occurences>& words_with_occurences)
//Which is the longest word in the file?
{
using pair_type = std::map<Word, Occurences>::value_type;
std::vector<Word> words;
auto it_begin = words_with_occurences.begin();
auto it_result = words_with_occurences.end();
auto it_last_result = words_with_occurences.end();
for (;;) {
it_result = std::max_element(
it_begin, words_with_occurences.end(),
[](const pair_type a, const pair_type b)
{
return a.first.size() < b.first.size();
}
); | {
"domain": "codereview.stackexchange",
"id": 31841,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, c++17, fltk",
"url": null
} |
earth, spectroscopy, venus
But if you dial the ${\rm CO}_{2}$ concentration way down (e.g., to 10 ppm), the emitting altitudes are lower for all ${\rm CO}_{2}$-absorbing wavelenths, so much so that the emitting altitude for the Q-branch is down below the stratosphere, and so is at a lower temperature than the rest, and thus emits less flux, giving you the expected profile (i.e., with the weakest emission at the Q-branch wavelength, instead of a reversal):
(Finally, I believe the peculiar spectrum for the "Antarctic" case in the first figure is due to the unusual temperature profile of atmosphere in arctic regions, which includes the temperature increasing with altitude in the first few km above the ground; the fact that the interior of Antarctica is high altitude might also be relevant.) | {
"domain": "astronomy.stackexchange",
"id": 5423,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "earth, spectroscopy, venus",
"url": null
} |
planets, density, gas
Title: How can gaseous Saturn be only 8 times less dense than Earth Saturn's mass is roughly $6\cdot 10^{26}$ kg, and that of the Earth is around $6\cdot 10^{24}$ kg.
Saturn's volume can hold a little more than 760 Earths according to Wikipedia, which makes it something like 7.6 times less dense, on average, than our rocky planet. I find 7.6 is a surprisingly small figure when comparing rock or liquid with gas. Are the gases that make Saturn just very heavy gases (e.g. per mole) or is it something to do with the fact that its large total mass induces a strong gravitational pull compressing the gases to a further extent than we are familiar with on Earth ? There is a misconception here that gases cannot be dense. That is not the case. A gas that is crushed by gravity to very high densities may remain in a gaseous state if its temperature remains high enough. The basic idea is that the thermal energy remains large compared with any intermolecular or interatomic potential energy. | {
"domain": "physics.stackexchange",
"id": 41297,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "planets, density, gas",
"url": null
} |
Proof of (1). This follows from the fact that, for $n$ big enough, $ay_n+ x_n$ is alternatively very near $a+\lim x$ and $-a+\lim x$ (because $x_n$ is very near $\lim x$). More explicitly:
Claim. $$\max\{|\lambda+\mu|,|\lambda-\mu|\}\geq\sqrt{|\lambda|^2+|\mu|^2}\geq\max\{|\lambda|,|\mu|\}.$$ To prove the claim, assume first that $\lambda\in\mathbb R+$, $\mu=re^{it}$. Then $$|\lambda\pm re^{it}|^2=(\lambda+r\cos t)^2+r^2\sin^2t=\lambda^2+r^2\pm 2\lambda r\cos t.$$ Since either $\cos t\geq0$ or $\cos t<0$, one of the two choices of sign puts the expression above $\lambda^2+r^2=|\lambda|^2+|\mu|^2$.
When $\lambda=se^{iv}$, $|\lambda+r^{it}|=|s+re^{i(t-v)}|$ and we can proceed as above. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9793540698633748,
"lm_q1q2_score": 0.8139833245105762,
"lm_q2_score": 0.831143045767024,
"openwebmath_perplexity": 96.63591437083616,
"openwebmath_score": 0.9889639616012573,
"tags": null,
"url": "https://math.stackexchange.com/questions/1043665/continuous-extension-of-the-limit-functional"
} |
will see at the end of this chapter that we can solve systems of linear equations by using the inverse matrix. And 1 is the identity, so called because 1x = x for any number x. 2.5. Inverse Matrices 81 2.5 Inverse Matrices Suppose A is a square matrix. This is the currently selected item. It works the same way for matrices. (Compare this answer with the one we got on Inverse of a Matrix using Minors, Cofactors and Adjugate. 3x3 identity matrices involves 3 rows and 3 columns. This video introduces the identity matrix and illustrates the properties of the identity matrix. If such matrix X exists, one can show that it is unique. When the identity matrix is the product of two square matrices, the two matrices are said to be the inverse of each other. Thus, the number "0" is called the additive identity for real numbers. Inverse of a matrix A is the reverse of it, represented as A-1. Page 1 of 2 4.4 Identity and Inverse Matrices 223 Identity and Inverse Matrices USING INVERSE MATRICES The | {
"domain": "resenarsforum.se",
"id": null,
"lm_label": "1. Yes\n2. Yes",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9678992932829918,
"lm_q1q2_score": 0.816805475267527,
"lm_q2_score": 0.8438951045175643,
"openwebmath_perplexity": 399.5554573363335,
"openwebmath_score": 0.7566174268722534,
"tags": null,
"url": "http://www.resenarsforum.se/v2lpf/mevh6u.php?ca7d97=inverse-of-identity-matrix-is-identity-matrix"
} |
java, beginner, hangman
System.out.println(" | | |");
System.out.println(" | | 0");
System.out.println(" | | ");
System.out.println(" | | ");
System.out.println(" | | ");
System.out.println(" | |");
System.out.println(" | |");
System.out.println(" ___________");
break;
case (2):
System.out.printf("Incorrect! Try Again! You have %d Lives\n", l);
System.out.println(" ______________"); | {
"domain": "codereview.stackexchange",
"id": 26791,
"lm_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, hangman",
"url": null
} |
python, reinforcement-learning, q-learning
print "Score over time: " + str(sum(rList)/num_episodes)
print "Final Q-Table Values"
print Q
The code runs well and I'm able to print my results, but here is where I'm having difficulties:
a = np.argmax(Q[s,:] + np.random.randn(1,env.action_space.n)*(1./(i+1)))
My question is, why are we multiplying by 1/(i+1)? Is this supposed to be an implementation of epsilon annealing? Any help is appreciated.
My question is, why are we multiplying by 1/(i+1)? Is this supposed to be an implementation of epsilon annealing?
The code looks like a relatively ad-hoc* adjustment to ensure early exploration, and an alternative to $\epsilon$-greedy action choice. The 1/(i+1) factor is similar to decaying $\epsilon$, but not identical.
$\epsilon$-greedy with the same decay factor might look like this:
a = np.argmax(Q[s,:])
if epsilon/(1+math.sqrt(i)) > random.random():
a = random.randrange(0, env.action_space.n) | {
"domain": "datascience.stackexchange",
"id": 2002,
"lm_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, reinforcement-learning, q-learning",
"url": null
} |
differential-equations, diffusion
Certainly turbulent fluids mix much faster than diffusion predicts. Generally, the mechanism by which this enhanced diffusion takes place is this: First, turbulent fluid flow, via nonlinear coupling term $(\mathbf{v}\cdot\nabla)\mathbf{v}$, creates smaller and smaller scale structures, i.e., fine layers of ink and water. Second, once these scales are small enough, diffusion is effectively fast, having only very small length scales to mix together. This depends on your system being unstable to perturbations, which depends a great deal on the geometry of your ink drop and the ink properties.
As a starting point, you could treat the two fluids as immiscible, asking how pure parcels of fluid disperse due to shear or the Rayleigh-Taylor instability. Many Navier-Stokes solvers have been written; this page provides a non-exhaustive list. | {
"domain": "physics.stackexchange",
"id": 6593,
"lm_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-equations, diffusion",
"url": null
} |
standard-model, electrons, protons, quarks, charge
So in quantum gravity, the only alternative to charge quantization is a theory with nearly massless particles with extremely tiny charges, and this has clear experimental signatures.
I should point out that if you believe that the standard model matter is complete, then anomaly cancellation requires that the charge of the proton is equal to the charge of the positron, because there is instanton mediated proton decay as discovered by t'Hooft, and this is something we might concievable soon observe in accelerators. So in order to make the charge of the proton slightly different from the electron, you can't modify parameters in the standard model, you need to add a heck of a lot of unobserved nearly massless fermions with tiny U(1) charge.
This is enough conspiratorial implausibility, that together with the experimental bound, you can say with certainty that the proton and electron have exactly the same charge. | {
"domain": "physics.stackexchange",
"id": 87196,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "standard-model, electrons, protons, quarks, charge",
"url": null
} |
quantum-mechanics, photons, reflection, double-slit-experiment
Will there be an interference pattern on screen1 and screen2? Knowing that a photon has gone through a particular slit will prevent interference, but knowing that a photon has gone through a given pair of slits will not prevent interference. If recoil is measured at the mirror, we will know that a photon has reflected and has gone through the slits 1 and 2, and an interference pattern will indeed be formed on screen 1.
Note: the interference pattern will be affected by the mirror's recoil. The photon will transfer a tiny portion of its momentum to the mirror, so will go through the slits with a slightly longer wavelength, and as a result the interference fringes on the screen will be slightly farther apart. The heavier the mirror, the less momentum will be transferred and the less the interference pattern will be affected. | {
"domain": "physics.stackexchange",
"id": 63002,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, photons, reflection, double-slit-experiment",
"url": null
} |
black-hole, exoplanet, gravitational-lensing
The Gaia mission has the potential to find many such unseen companions with periods of up to about 10-15 years, but we are waiting for the full first epoch-by-epoch position measurements to be released. At present all most Gaia data tells us is when a star has some sort of wobble or anomaly. Nevertheless an initial data release of orbital solutions for about 170,000 candidate binary systems has started to yield firm evidence for black hole companions on much wider orbits than the black hole binaries previously found (e.g. . A couple of black hole candidates have been found (e.g., Chakrabarti et al. 2022; El Badry et al. 2023a, b) of around 10 solar masses; unseen companions of solar-type stars or red giants. The prospects for finding many such objects are good (e.g., Janssens et al. 2021). | {
"domain": "astronomy.stackexchange",
"id": 7160,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "black-hole, exoplanet, gravitational-lensing",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.