text stringlengths 1 1.11k | source dict |
|---|---|
opened by LePingKYXK 1
• #### Hiding Spines
Hi, thank you for your tutorial, it's been really helpful!
In the Moving Spines section, you've used ax.spines['right'].set_color('none') to hide the axis. I wonder if ax.spines['right'].set_visible(False) would be a more elegant solution?
opened by joel-e-m-mitchell 1
• #### puzzle comment for dip
At "Instantiating defaults",
> # Create a new figure of size 8x6 points, using 100 dots per inch
>plt.figure(figsize=(8,6), dpi=80)
dpi means "dots per inch", why dpi in comment is 100, in parameter is 80 ?
opened by Sunqinying 1
• #### Python v2.7 error in Earthquakes.py
We discovered in the SciPy Tutorial that the url line should be updated for people running Python V 2.7
import urllib2 and line #26 should be changed to:
url = urllib2.urlopen(feed + "4.5_month.csv")
Cheers! Jen | {
"domain": "pythonrepo.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9585377320263432,
"lm_q1q2_score": 0.822203100932124,
"lm_q2_score": 0.8577681122619883,
"openwebmath_perplexity": 8799.888038610577,
"openwebmath_score": 0.18498849868774414,
"tags": null,
"url": "https://pythonrepo.com/repo/rougier-matplotlib-tutorial-python-data-validation"
} |
optics, energy-conservation, laser, doppler-effect
Is this explanation correct or have I made mistake? I have taken a special relativity course but no quantum mechanics yet, so please keep the quantum mechanics to a minimum if possible. Here are some intuitive arguments; I believe they are valid but it's been a very long time since I thought about these things - so I am open to comments / improvements.
The simple description of Doppler cooling:
Because of the detuning, the probability of a photon absorption is greatest for an atom moving towards the light source - and in the process of absorbing the photon, the atom loses momentum in the direction it was going.
When it re-emits the photon, it will be in a random direction; therefore there will be no net impact on the momentum of the atoms. This is sufficient to see that the atoms "slow down" in the beam direction, but not enough to see that they lose energy in total. | {
"domain": "physics.stackexchange",
"id": 13937,
"lm_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, energy-conservation, laser, doppler-effect",
"url": null
} |
graph. If we add all these typical rectangles, starting from a and finishing at b, the area is approximately: sum_{x=a}^\b(y)Deltax Now if we let Δx → 0, we can find the exact area by integration: My goal is to calculate two areas. Find the area bounded by the curve y = sin x and the x-axis, for 0 ≤ x ≤ 2π. Graph the curve y = sin(x) in the "Area" tool. To get the period of the sine curve for any coefficient b, just divide 2π by the coefficient b to get the new period of the curve. 7 pi. 2 14 Area under a parametric curve Given y = f (x), the area under the curve from x = a to x = b is Area = Z x=b right endpoint x=a left endpoint y dx = Z t= right endpoint t=↵ left endpoint g (t) f 0(t) dt Example. Learners explore the concept of area under a curve. The first two columns of data are the X-Y coordinates of the curve to fill under, the values below the table are the minimum and maximum of the horizontal axis, and the third and fourth columns are the data for the area chart series that | {
"domain": "popping1204.site",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9825575173068325,
"lm_q1q2_score": 0.8250869244446827,
"lm_q2_score": 0.8397339696776499,
"openwebmath_perplexity": 349.75428318802983,
"openwebmath_score": 0.8734630346298218,
"tags": null,
"url": "https://dtawsw.popping1204.site/area-under-sine-curve.html"
} |
particle-physics, neutrinos, beyond-the-standard-model
Title: How will the light neutrino mass hierarchy be determined? The light neutrino mass hierarchy is not known yet. This is because for one of the two independent mass-squared differences only the absolute value is known.
Is there a way that in future the hierarchy will be determined? Is there any experiment which proposes to determine the hierarchy? If yes, which experiment and how? Your question is magnificently broad. The outstanding review of the searches by Qian and Vogel 2015 covers all bases and all dozen experiments and alternate pathways/techniques.
Accelerator Neutrinos:Appearance
Atmospheric neutrinos
ReactorAntineutrinos
They combine all extant data from all experiments, and not one narrow gimmick which you might be seeking. But I have no sense of the schedules and luck involved in getting there first.
Listening to people around me, they appear to think that by 2020 we'll know for sure from NOνA, | {
"domain": "physics.stackexchange",
"id": 45249,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "particle-physics, neutrinos, beyond-the-standard-model",
"url": null
} |
cc.complexity-theory, reductions, function
Title: Cook reduction for search problems, by universal property? A search problem is a relation $R\subseteq \Sigma^*\times\Sigma^*$. A function $f\colon \Sigma^*\to\Sigma^*$ solves $R$ if $(x,f(x))\in R$ for all $x\in\Sigma^*$. Define a search problem to be reasonable if for all $(x,y)\in R$ the word $x$ is at least as long as $y$.
Let $R$ and $S$ be reasonable search problems. Consider the following two properties.
There is a Cook-reduction from $R$ to $S$ (That is, there is a polynomial-time oracle Turing machine $M$ such that for all $f$ solving $S$, the function $M^f$ solves $R$. This is Definition 3.1 of Goldreich's "P, NP, and NP-Completeness: The Basics of Computational Complexity".)
For all functions $f$ such that $S\in\mathsf{FP}^f$, we have $R\in\mathsf{FP}^f$. (Here $\mathsf{FP}^f$ is the set of search problems solved by $M^f$ for some polynomial-time oracle Turing machine $M$.) | {
"domain": "cstheory.stackexchange",
"id": 1784,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "cc.complexity-theory, reductions, function",
"url": null
} |
pcl
Title: PCLVisualizer point cloud ID
Hi,
first the code, than the question:
while (!viewer.wasStopped()) {
[...get coordinates...]
if (counter = true) {
viewer.removePointCloud("1");
viewer.addPointCloud(point_cloud, "2");
counter = false;
}else {
viewer.removePointCloud("2");
viewer.addPointCloud(point_cloud, "1");
counter = 1;
}
viewer.spinOnce();
Here the question: If I run this programm, I get "[addPointCloud] A PointCloud with id <2> already exists! Please choose a different id and retry".
So my question is, if there is any possibility to free the old point cloud ID and write a new point cloud to the previous, now free, ID?
Thanks for the help.
Originally posted by SLAMnect on ROS Answers with karma: 58 on 2011-03-14
Post score: 1
Are you sure you did not want to write
if (counter == true) {
... code goes here
} | {
"domain": "robotics.stackexchange",
"id": 5058,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "pcl",
"url": null
} |
ros, slam, navigation, ros-melodic, rtabmap
Title: [SOLVED] rtabmap fails to run a bag of depth and rgdb images
Hi,
I am playing a bag of 16 bits-per-pixel depth and 8 bit rgb images. While playing the bag, I can extract both the rgb and the depth images into files (to verify that the data is ok)
(I used the thread here to create and extract the depth images)
The way the depth image is stored in the bag is by using a python script that uses the PIL package to read a pgm image from file into a PIL object, serialize the object data into byte array (using io.BytesIO()), and save the byte array in PPM format.
To verify the data, I wanted to view the images first, before running rtabmap
In rviz I can view the rgb image, but I cannot view the depth image. According to here:
"RVIZ cannot view 16 bit images
natively. You'll have to convert them
to an 8 bit format." | {
"domain": "robotics.stackexchange",
"id": 32306,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, slam, navigation, ros-melodic, rtabmap",
"url": null
} |
c#, object-oriented, inheritance, status-monitoring
return false;
}
#endregion
} A design pattern often used, is to have a non generic base type and a generic type derived from it or a type implementing a non generic as well as a generic interface. An example is
public abstract class Comparer<T> :
System.Collections.Generic.IComparer<T>, System.Collections.IComparer
You can see the full implementation here public abstract class Comparer<T> : IComparer, IComparer<T>.
You can see that it does an explicit implementaion of IComparer members and an implicit implementation of IComparer<T>. This hides the IComparer members when not accessed through this very interface. Original code:
public abstract int Compare(T x, T y);
int IComparer.Compare(object x, object y) {
if (x == null) return y == null ? 0 : -1;
if (y == null) return 1;
if (x is T && y is T) return Compare((T)x, (T)y);
ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidArgumentForComparison);
return 0;
} | {
"domain": "codereview.stackexchange",
"id": 35858,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, object-oriented, inheritance, status-monitoring",
"url": null
} |
ros
namespace SendMsg
{
class Message
{
public:
SENDMSGDLL_API int sendingMsg(int x, int y, int z);
};
}
Here is my main.cpp
#include "stdafx.h"
#include <string>
#include <stdio.h>
#include "ros.h"
#include <geometry_msgs/Twist.h>
#include <windows.h>
#include "SendMsgToROS.h" //Header-File where namespace SendMsg and class Message are defined
using std::string;
namespace SendMsg
{
int Message::sendingMsg(int x, int y, int z)
{
ros::NodeHandle nh;
char *ros_master = "1.1.3.1.1";//ID of ROS Masters'
printf("Connecting to server at %s\n", ros_master);
nh.initNode(ros_master);
printf("Advertising cmd_vel message\n");
geometry_msgs::Twist twist_msg;
ros::Publisher cmd_vel_pub("cmd_vel", &twist_msg);
nh.advertise(cmd_vel_pub); | {
"domain": "robotics.stackexchange",
"id": 27524,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros",
"url": null
} |
Define a metric $\delta$ on $\psi(X)$ as follows: $$\delta(\psi(x),\psi(y))\equiv d(x,y)\quad\forall x,y\in X.$$ It is not difficult to show that $\delta$ is a complete metric on $\psi(X)$, given that $d$ is complete on $X$. Moreover, $\delta$ defines the same topology on $\psi(X)$ as the relative $\|\cdot\|^{**}$-norm topology, given that any $\delta$-open ball in $\psi(X)$ contains a $\|\cdot\|^{**}$-open ball and vice versa. (To prove this, one can use the facts that $\psi$ is a linear isometry between $(X,\|\cdot\|)$ and $(\psi(X),\|\cdot\|^{**})$ and that any $d$-open subset of $X$ is also $\|\cdot\|$-open.) Hence, $\psi(X)$ is a completely metrizable subspace of $Y$, so $\psi(X)$ must be a $G_{\delta}$ subset of $Y$ (a countable intersection of $\|\cdot\|^{**}$-open subsets of $Y$): $$\psi(X)=\bigcap_{n=1}^{\infty} U_n,$$ where, for each $n\in\mathbb N$, $U_n\subseteq Y$ is $\|\cdot\|^{**}$-open (see, for example, Lemma 3.33 in Aliprantis–Border, 2006, p. 88 or Theorem 24.12 in | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9822877049262133,
"lm_q1q2_score": 0.8120688350269549,
"lm_q2_score": 0.8267117983401363,
"openwebmath_perplexity": 97.44037018459447,
"openwebmath_score": 0.9682986736297607,
"tags": null,
"url": "https://math.stackexchange.com/questions/992949/non-banach-completely-metrizable-normed-vector-space"
} |
of , where $|A|\neq 0$. Read the instructions. Generalized inverse matrix-exterior penalty function (GIM-EPF) algorithm for data processing of multi-wavelength pyrometer (MWP) Jiafeng Liang, Li Dai, Sheng Chen, Weihong Gu, Bo Peng, Nannan Jiang, Wenlong Song, and Jian Xing. Image Source. Here, authors parallelized a sequential algorithm to find the inverse of a square matrix after. Algorithm for Sparse-Matrix Inverse. 3728639) algorithm which is better than O(n^3) for Cholesky, LU, Gaussian elimination etc. The inverse compositional algorithm can be described as follows [4], 1. GitHub Gist: instantly share code, notes, and snippets. An algorithm applicable for the numerical computation of an inverse matrix. I implemented a parallel algorithm for matrix inversion based on Gauss-Jordan elimination. In this method append more columns(double the number of columns ) to the input matrix and then we try to make last row zero except the last column entry and second last and so on until we get | {
"domain": "adelebianco.it",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9859363729567544,
"lm_q1q2_score": 0.8172809262460258,
"lm_q2_score": 0.8289388125473628,
"openwebmath_perplexity": 447.32852840730374,
"openwebmath_score": 0.7671352624893188,
"tags": null,
"url": "http://adelebianco.it/jqxe/inverse-matrix-algorithm.html"
} |
objective-c, ios
Title: Core Location - Practices for Supporting Common iOS Devices Typical tutorials suggest simple CoreLocation code similar to the following:
Header
#import<CoreLocation/CoreLocation.h>
@interface MyCLController : NSObject <CLLocationManagerDelegate> {
CLLocationManager *locManager;
}
@property (nonatomic, retain) CLLocationManager *locManager;
@end
Setup
....
self.locManager = [[[CLLocationManager alloc] init] autorelease];
if(!self.locManager.locationServicesEnabled)
{
NSLog(@"User has opted out of location services");
}
self.locManager.delegate = self;
self.locManager.desiredAccuracy = kCLLocationAccuracyBest;
self.locManager.distanceFilter = 880.0f; // About 1/10th mile, in meters
[self.locManager startUpdatingLocation];
....
Methods
- (void)locationManager:(CLLocationManager *)manager
didFailWithError:(NSError *)error
{
// Respond to errors
NSLog(@"Location manager error: %@", [error description]);
return;
} | {
"domain": "codereview.stackexchange",
"id": 390,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "objective-c, ios",
"url": null
} |
javascript, homework
Answer to this is:
"Hungry? Grab a Snicker!" Very neat project! Good work. You are correct that there are several improvements that can be made. | {
"domain": "codereview.stackexchange",
"id": 29879,
"lm_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, homework",
"url": null
} |
rosmake, rosjava
Title: error occored when make project for ros java
hanbo@ubuntu:~/ros_workspace/my_package$ rosmake my_package
[ rosmake ] Packages requested are: ['my_package']
[ rosmake ] Logging to directory/home/hanbo/.ros/rosmake/rosmake_output-20120314-055706
[ rosmake ] Expanded args ['my_package'] to:
['my_package']
[ rosmake ] Checking rosdeps compliance for packages my_package. This may take a few seconds.
Failed to find stack for package [rosgraph_msgs]
Failed to load rosdep.yaml for package [rosgraph_msgs]:Cannot locate installation of package rosgraph_msgs: [rospack] couldn't find package [rosgraph_msgs]. ROS_ROOT[/opt/ros/electric/ros] ROS_PACKAGE_PATH[/home/hanbo/ros_workspace]
Failed to find stack for package [sensor_msgs]
Failed to load rosdep.yaml for package [sensor_msgs]:Cannot locate installation of package sensor_msgs: [rospack] couldn't find package [sensor_msgs]. ROS_ROOT[/opt/ros/electric/ros] ROS_PACKAGE_PATH[/home/hanbo/ros_workspace] | {
"domain": "robotics.stackexchange",
"id": 8576,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "rosmake, rosjava",
"url": null
} |
c++, design-patterns
int main()
{
{
Services services;
services.logger.log("yep");
}
//services.logger.log("nope"); // obviously doesn't compile
}
To use the logger "somewhere else" we can pass it into an object constructor by reference, (or pass the entire Services object by reference):
struct Object
{
explicit Object(Logger& logger):
logger(&logger) { }
private:
Logger* logger;
}; | {
"domain": "codereview.stackexchange",
"id": 33051,
"lm_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++, design-patterns",
"url": null
} |
javascript, typescript, angular-2+
Making plain functions out of methods
The reason we haven't been able to move transferRole into a plain function as well is that it makes reference to this. So long as we need this, we're stuck with methods. But it's quite easy to make it a function parameter. When we do so we end up with a final cleaner codebase, Step 7:
const pluck = (prop) => (xs) => xs.map(x => x[prop])
const transferEvent = (event) =>
transferArrayItem(event.previousContainer.data, event.container.data, event.previousIndex, event.currentIndex);
const moveEvent = (event) =>
moveItemInArray(event.container.data, event.previousIndex, event.currentIndex) | {
"domain": "codereview.stackexchange",
"id": 36863,
"lm_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, typescript, angular-2+",
"url": null
} |
finite-automata, np-complete, cellular-automata
CAP (CA Preimage problem):
Given: A fixed CA $(Q,\delta)$ and a configuration substring $s$.
Question: Is there a configuration substring $s_0$ such that $s_0 \vdash^{K} s$, where $K= |s|$? | {
"domain": "cs.stackexchange",
"id": 6551,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "finite-automata, np-complete, cellular-automata",
"url": null
} |
quantum-state, error-correction
\end{eqnarray}
This is a pure state because the combined system qubit+environment is considered a closed quantum system itself.
To look at the qubit alone, we need to trace out the environment degrees of freedom and look at the reduced density matrix of the qubit:
\begin{eqnarray}
\rho_q=\text{Tr}_e |\Psi\rangle\langle\Psi|
\end{eqnarray}
This will yield in general a mixed state, unless the environment and the qubit are completely uncorrelated. The precise state of the qubit after interacting with the environment depends on the set of Kraus operators that describe such interaction with a bath. If the associated map for an interaction operation is a completely positive trace preserving one, then:
\begin{eqnarray}
\mathcal{E}(\rho_q)=\sum_i K_i\rho_q K_i^\dagger,
\end{eqnarray}
where $K_i$ are the Kraus operators describing the operation and satisfying $\sum_i K_i^\dagger K_i=I.$ | {
"domain": "quantumcomputing.stackexchange",
"id": 5605,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-state, error-correction",
"url": null
} |
c#, .net, api, http, rest
Below is the implementation details of IProductService
public interface IProductService
{
List<ProductListResponse> GetList();
ProductDetailResponse GetDetails(string id);
}
public class ProductService : IProductService
{
private readonly IClient _httpClient;
private readonly IConfigurationService _configurationService;
private const string ExternalApiBaseUrl = "ExternalApiBaseUrl";
public ProductService(IClient httpClient, IConfigurationService configurationService)
{
_httpClient = httpClient;
_configurationService = configurationService;
}
public List<ProductListResponse> GetList()
{
var baseUrl = _configurationService.Get(ExternalApiBaseUrl);
var restClient = _httpClient.GetClient(baseUrl);
var restRequest = _httpClient.GetRequest(); | {
"domain": "codereview.stackexchange",
"id": 14148,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, .net, api, http, rest",
"url": null
} |
I will go through the last equation you wrote step-by-step and say why it is true. $$h(-x)=|f(-x)|$$ Since $h(x)=|f(x)|$, this follows immediately from the definition. $$|f(-x)|=|-f(x)|$$ This is because $f$ is an odd function and $f(-x)=-f(x)$ for all $x$. $$|-f(x)|=|f(x)|$$ By the definition of absolute value, $|y|=|-y|$ for all $y$ (absolute value is an even function). $$|f(x)|=h(x)$$ This is again, the definition of $h$.
The principle here is actually deeper. If $g(x)$ is an even function and $f(x)$ is an odd function, $g(f(x))$ is even and $f(g(x))$ is also even. Can you see how to prove these in the same way as above?
• By first statement do you mean $h(-x)=|f(-x)|$? – Alex S Jul 11 '15 at 1:17
• Since $h(x)$ is defined to be $|f(x)|$ for every value of $x$, if we just change $x$ to $-x$ on both sides, the equation is still true. – Alex S Jul 11 '15 at 1:28 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9820137942490254,
"lm_q1q2_score": 0.8161939359373666,
"lm_q2_score": 0.831143045767024,
"openwebmath_perplexity": 75.8832090452703,
"openwebmath_score": 0.8429265022277832,
"tags": null,
"url": "https://math.stackexchange.com/questions/1357002/explaining-why-the-absolute-value-of-an-odd-function-is-even"
} |
The equation $u^2 - 2v^2 = 73$ has infinitely many solutions, but none of them has the required form.
The ring $\mathbb{Z}[\sqrt{2}]$ is Euclidean, hence factorial. The rational prime $73$ is reducible in $\mathbb{Z}[\sqrt{2}]$, $73= (19 + 12\sqrt{2})(19-12\sqrt{2})$, and all solutions of $u^2 - 2v^2 = 73$ arise from the solution $u = 19,\, v = 12$ by multiplication with a unit of norm $+1$. The smallest solution of $x^2 - 2y^2 = 1$ is $x = 3,\, y = 2$, so all solutions are generated by $(3+2\sqrt{2})^k(19+12\sqrt{2})$. Looking at the remainders modulo $24$ of the solutions, we find a short period,
$$(19,12),\, (9,2),\, (11,0),\, (9,22),\, (19,12)$$
and the cycle closes. The first component never has the remainder $-9 \equiv 15 \pmod{24}$.
Thus:
$$\frac{x(x-1)(2x-1)}{6} - x^2$$
is never a perfect square.
-
Very nice answer. – prm Aug 15 '13 at 3:17
Here's a partial solution. I may return to this when I have time... | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9777138105645058,
"lm_q1q2_score": 0.8230645672251061,
"lm_q2_score": 0.8418256532040707,
"openwebmath_perplexity": 263.0697227931296,
"openwebmath_score": 0.9688010811805725,
"tags": null,
"url": "http://math.stackexchange.com/questions/467055/solving-a-function-for-square-numbers"
} |
galaxy, dust
The result is somewhat sensitive to the assumptions, and thus the uncertainties are sometimes quite large. The more IR data points obtained, the better. If only one IR point is available, the temperature cannot be calculated. Then there's a degeneracy between incident UV light and the amount of dust, and the mass can only be estimated to within some orders of magnitude (I think).
If lines from various atomic or molecular transitions are seen as well, the composition can be better constrained. The size distribution can be determined from fitting the theoretical spectrum of a given distribution to observed dust spectra. This information is often not available in a given high-redshift galaxy, so here we can be forced to assume that the dust is similar in nature to "local" dust, i.e. in the Milky Way and our nearest neighbors.
If you're interested in the relevant equations, they can be found many places, e.g. here. | {
"domain": "astronomy.stackexchange",
"id": 791,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "galaxy, dust",
"url": null
} |
homework-and-exercises, gravity, newtonian-gravity
Title: Gravitational intensity I calculated the gravitational intensity and potential at a point P due to a horizontal linear mass distribution of length '$L$', mass '$M$' and uniform linear density at a distance '$R$' apart from the nearest end on the axis of the horizontal linear mass distribution.
The expression for potential is $$\frac{GM}{L}\ln\left(1 +\frac{L}{R}\right)$$
and the expression for intensity is $$-\frac{GM}{RL +L^2}$$
But if point $P$ is placed on either end of the linear mass distribution, then $R=0 \;\text{or}\; R=-L$ and both potential and intensity turn out to be infinity!!!!!
Can anyone please verify the calculations and confirm the results? If the calculations are right, what is the physical interpretation of such a result stated in the previous sentence? Imagine that you had a bunch of atoms all equally spaced on the x axis from $x=0 \to x=L$. | {
"domain": "physics.stackexchange",
"id": 24285,
"lm_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, gravity, newtonian-gravity",
"url": null
} |
thermodynamics, differential-geometry, vectors, differentiation
So what is the vector and the point that we are feeding in?
EDIT:
Perhaps i should not have used the case $\mathrm{d}A=0$ since that seems to be unambiguous. But what is meant when we say for example the total differential is positive ? I've also read that in textbooks. A statement like that doesn't make sense unless i refer to an assumption/convention about the input vector, or does it ? I mean the value "positive" does vary in general with the input vector unless i have exactly the zero map. Please include a discussion about that also in an answer.
Optionally, I would also like a better understanding what the actual vectors are in the context of thermodynamics. In all cases in which I met with the expression $\mathrm{d}A=0$ it meant that the map associated to it was identically null on its codomain. Then it's only an "abuse of notation", an abbreviation to mean that the differential maps all the points in which is evaluated to the null element of the codomain. | {
"domain": "physics.stackexchange",
"id": 76037,
"lm_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, differential-geometry, vectors, differentiation",
"url": null
} |
of row reductions exists a permutation in which each number and the number of place. Of special matrices including diagonal, permutation, and the number of the place which it is! Correspond to matrix multiplication Gauss transform matrices and the inverse of a simple matrix by how... Moreover, the composition operation on permutation that we describe in Section 8.1.2 below does not correspond matrix! A permutation matrix inverse of 2-cycles the use of matrix notation in denoting permutations is always even, as as., we have to swap the rows of a simple matrix by understanding how the corresponding transformation... As the product of two even permutations is always even, as well as the product two! Of 2-cycles and Gauss transform matrices > 1 can be expressed as a product of odd! Two odd permutations well as the product of two even permutations is always,. A matrix corresponding linear transformation is related to the matrix-vector multiplication with matrix. | {
"domain": "southernglowtans.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9908743615328861,
"lm_q1q2_score": 0.8880725174237823,
"lm_q2_score": 0.8962513835254866,
"openwebmath_perplexity": 401.4975871929007,
"openwebmath_score": 0.8973594307899475,
"tags": null,
"url": "http://www.southernglowtans.com/kids-desk-xefgmli/bccf95-permutation-matrix-inverse"
} |
As matthusz says, PI shaseshift results in no signal.
90 degrees causes 0.707 summation
60 degrees is 0.866 output.
Thus 10 or 20 degrees, compared to a radian (57.3 degrees) is less than a dB.
• A phase shift, plus it affects the amplitude, no? E.g. if I shift by $\pi$ I get no signal... So, takeaway is keep phase shift as small as possible? Any specific guidelines? Apr 15 '20 at 7:26 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9674102561735719,
"lm_q1q2_score": 0.8019239049104361,
"lm_q2_score": 0.8289388083214156,
"openwebmath_perplexity": 612.5069127457989,
"openwebmath_score": 0.7574439644813538,
"tags": null,
"url": "https://electronics.stackexchange.com/questions/493190/length-matching-microwave-differential-traces"
} |
java, email
// print received datagrams from client
//add your code here
BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream()));
while ( (data = in.readLine()) != null ) {
//System.out.println("\r\nMessage from " + clientAddress + ": " + data); | {
"domain": "codereview.stackexchange",
"id": 40879,
"lm_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, email",
"url": null
} |
comparison, minimax, alpha-beta-pruning
Title: Should I use minimax or alpha-beta pruning? Should I use minimax or alpha-beta pruning (or both)? Apparently, alpha-beta pruning prunes some parts of the search tree. Both algorithms should give the same answer. However, their main difference is that alpha-beta does not explore all paths, like minimax does, but prunes those that are guaranteed not to be an optimal state for the current player, that is max or min. So, alpha-beta is a better implementation of minimax.
Here are the time complexities of both algorithms
Minimax: $\mathcal{O}(b^d)$,
Alpha-beta (best-case scenario): $\mathcal{O}(b^{d/2}) = \mathcal{O}(\sqrt{b^d})$
where $b$ is an average branching factor with a search depth of $d$ plies. | {
"domain": "ai.stackexchange",
"id": 2663,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "comparison, minimax, alpha-beta-pruning",
"url": null
} |
Square: $m=n$
The nonsingular case $\rho = m = n$.
\begin{align} \mathbf{A} &= \mathbf{U} \, \Sigma \, \mathbf{V}^{*} \\ % &= % U \left[ \begin{array}{c} \color{blue}{\mathbf{U}_{\mathcal{R}}} \end{array} \right] % Sigma \left[ \begin{array}{c} \mathbf{S} \end{array} \right] % V \left[ \begin{array}{c} \color{blue}{\mathbf{V}_{\mathcal{R}}}^{*} \\ \end{array} \right] % \end{align} \begin{align} \mathbf{A}^{\dagger} &= \mathbf{V} \, \Sigma^{\dagger} \mathbf{U}^{*} \\ % &= % V \left[ \begin{array}{c} \color{blue}{\mathbf{V}_{\mathcal{R}}} \end{array} \right] % Sigma \left[ \begin{array}{c} \mathbf{S}^{-1} \end{array} \right] % U \left[ \begin{array}{c} \color{blue}{\mathbf{U}_{\mathcal{R}}}^{*} \end{array} \right] % \end{align}
Original example | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9890130554263733,
"lm_q1q2_score": 0.8644737889185687,
"lm_q2_score": 0.8740772269642948,
"openwebmath_perplexity": 810.1609672143261,
"openwebmath_score": 1.0000098943710327,
"tags": null,
"url": "https://math.stackexchange.com/questions/1971211/pseudo-inverse-of-a-matrix-that-is-neither-fat-nor-tall"
} |
general-relativity, differential-geometry, curvature, geodesics
$$
In advanced thank you for answering my question. Note that 4.25 is written in the Fermi propagated bases. You must be careful when going from $\alpha, \beta...$ to $a,b,...$. In particular,
$$\frac{d}{ds} \theta = \frac{d}{ds} \left(\theta_{\alpha \beta} h^{\alpha \beta}\right) = h^{\alpha \beta}\frac{d}{ds} \theta_{\alpha \beta}\;.$$
Then
$$-h^{\alpha \beta} R_{\alpha 4 \beta 4} =-h^{\alpha \beta} R_{\alpha c \beta d} V^c V^d = -g^{ab} R_{a c b d} V^c V^d = -R_{c d} V^c V^d\;.$$
The first equality is true since
$E_4 = V$, and the second equality is true since $$R_{a c b d} V^a V^c V^d = 0 = R_{a c b d} V^b V^c V^d\;.$$
Similarly, the other two terms work out. It is a simple exercise to show that
$$h^{\alpha \beta} \left(\dot V_{(\alpha;\beta)} +\dot V_\alpha \dot V_\beta\right)= \dot V^a ~_{;\;a}\;.$$ | {
"domain": "physics.stackexchange",
"id": 99176,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "general-relativity, differential-geometry, curvature, geodesics",
"url": null
} |
special-relativity, gravity, speed-of-light, relativity
$$ \begin{align}
v'^2 &= \frac{\gamma^2 v^2 t^2 + c^2 t^2}{\gamma^2 t^2} \\
&= v^2 + \frac{c^2}{\gamma^2} \\
&= v^2 + c^2 \left( 1 - \frac{v^2}{c^2} \right) \\
&= v^2 + c^2 - v^2 \\
&= c^2
\end{align}$$
So the speed of light still equals $c$, as it should. | {
"domain": "physics.stackexchange",
"id": 76944,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "special-relativity, gravity, speed-of-light, relativity",
"url": null
} |
topological-insulators, time-reversal-symmetry, topological-phase
$$
TH\left(\vec{k}\right)T^{-1}=\vec{d}\left(\vec{k}\right)\cdot K\vec{\sigma}K^{-1} =...=H\left(-\vec{k}\right)
$$
but because $K$ is nonstandard operator (it's anti-linear and also basis dependent), I'm not sure how exactly it affects the Pauli matrices. To have time-reversal symmetry, there needs to be a unitary operator $U$ such that
$ U\sigma^x U^{-1}=-\sigma^x, U\sigma^y U^{-1}= \sigma^y, U\sigma^z U^{-1}=\sigma^z$.
These follow from $T=UK$, and I choose a basis for Pauli matrices so that the complex conjugation $K$ only changes $\sigma^y\rightarrow -\sigma^y$.
However, you can easily see that such a $U$ does not exist. For example, under the $U$,
$ U\sigma^x \sigma^y\sigma^z U^{-1}= - \sigma^x \sigma^y \sigma^z. $
However, $\sigma^x\sigma^y\sigma^z = i$, which commutes with any unitary.
Another way to see this is that when $k_z=0$, this Hamiltonian describes a massive Dirac fermion in 2+1, which breaks time reversal (unless $m=1$, but then there is still parity anomaly). | {
"domain": "physics.stackexchange",
"id": 96647,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "topological-insulators, time-reversal-symmetry, topological-phase",
"url": null
} |
sdformat, gazebo-9
In essence, I had a local install directory, let's call it ${localdir} and then the final destination where SDFormat should be run later ${runtimeDir}.
I invoked cmake with cmake .. -DCMAKE_INSTALL_PREFIX=${localdir}, then used make && make install and finally moved the compiled binaries to ${runtimeDir} changing all necessary paths.
However, it seems like I missed some paths or some of them had been compiled into the library, so the solution was to use cmake .. -DCMAKE_INSTALL_PREFIX=${runtimeDir} and then invoke make && make install DESTDIR=${localdir}.
With that approach the libraries were compiled correctly plus I did not have to change any paths at all after moving to ${runtimeDir}. | {
"domain": "robotics.stackexchange",
"id": 4270,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "sdformat, gazebo-9",
"url": null
} |
homework-and-exercises, general-relativity, perturbation-theory, linearized-theory
Title: Perturbed Ricci tensor due to metric perturbation i.e. $R^{(2)}_{\mu\nu}[h]$ in Linearized theory of Einstein field equation This is an equation (7.153) from Chapter-7 of Sean Carroll's An introduction to General Relativity: Spacetime and Geometry book. I think all of you who studied GR and went thorugh Carroll's book have already seen the equation. This is a perturbative expansion of Ricci tensor that is quadratic in h i.e. $R^{(2)}_{\mu\nu}[h]$. I wanted to derive the expression but no luck.For your convenience I have put the expression below that has to be derived from the expression of Ricci tensor. | {
"domain": "physics.stackexchange",
"id": 57032,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises, general-relativity, perturbation-theory, linearized-theory",
"url": null
} |
optics, visible-light, refraction, wavelength, dispersion
As the ray moves from rarer to denser it deviates towards the normal. Red deviates the least and thus would be at a greater angle from the normal than yellow. Try drawing out a ray diagram.
Here, too, angle of refraction is greater for red.
PS: The cases I've shown are both rarer to denser. This doesn't stand true the other way round. From denser to rarer, yellow deviates more and has a greater angle of refraction.
PPS: Most refracted in a prism is violet as it's deviated the most. I'm assuming you do not mean in that manner.
Hope it helps! | {
"domain": "physics.stackexchange",
"id": 99561,
"lm_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, visible-light, refraction, wavelength, dispersion",
"url": null
} |
c++, algorithm, image, geospatial, mapreduce
/**
* \brief Definition of a raster processing function.
*
* A GALGRasterProcessFn accepts an array of data as input, applies custom logic and writes the output to padfOutArray.
* Such a function can be passed to GALGRunRasterProcess to apply custom processing to a GDALDataset in chunks and create
* a new GDALDataset.
*
* @param padfInArray The input array of data.
*
* @param padfOutArray The output array of data. On first call (via GDALRunRasterProcess) this will be an empty, initialised array,
* which should be populated with the result of calculations on padfInArray. In subsequent calls it will contain the result of the
* previous window.
*
* @param nWindowXSize the actual x size (width) of the read window.
*
* @param nWindowYSize the actual y size (height) of the read window. The length of padfInArray == padfOutArray == nWindowXSize * nWindowYSize
* | {
"domain": "codereview.stackexchange",
"id": 21278,
"lm_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, image, geospatial, mapreduce",
"url": null
} |
ros-melodic
Originally posted by huytyskland on ROS Answers with karma: 3 on 2021-10-14
Post score: 0
You have this:
void callBack(const received_message_type receivedMessage)
{
new_message_type newMessage;
[code for conversion]
ros::NodeHandle nh_pub;
ros::Publisher pub = nh_pub.advertise<new_message_type>("a1", 1000);
...
}
you are creating a Publisher inside a callback. That object is then also immediately destroyed at the end of the callback.
That is not a good idea and will not work reliably.
Setting up subscriptions takes time, and you don't give your subscribers any time to do that (as the publisher will be destroyed before the subscriber can receive any data).
Move your ros::Publisher object to a scope which lives longer than the callback and it should start working, provided there are no other problems with your code.
Originally posted by gvdhoorn with karma: 86574 on 2021-10-14
This answer was ACCEPTED on the original site
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 37018,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros-melodic",
"url": null
} |
algorithms, graphs, approximation, vertex-cover
If $u$ is touched by the matching but $w$ is not touched by the matching, then the only way to achieve a valid vertex cover from this matching is to include $u$ in the vertex cover. So, we need to find the edge $(u,v)$ in the matching, then set the corresponding variable $x_i$ to 0 (to ensure $u$ is selected, not $v$).
If $u$ is not touched by the matching but $w$ is touched, then do the reverse of the above.
If neither of $u$ nor $w$ is touched by the matching -- this can't happen in a maximum matching (because you could add the edge $(u,w)$ and get a larger matching). So, you can ignore this case. | {
"domain": "cs.stackexchange",
"id": 13762,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "algorithms, graphs, approximation, vertex-cover",
"url": null
} |
c#, performance, ms-word
FormatDocMargins(ref wordDoc, wordApp);
AddTitleToMailBoxList(wordDoc, mailboxdata.AddressStreetNumber, addDateToTitle);
AddTenantTableToMailBoxList(wordDoc, mailboxdata, wordApp);
object DoNotSaveChanges = PrintAndOrSave(wordDoc, save, print, fullFilePathName);
wordDoc.Close(ref DoNotSaveChanges);
}
catch (Exception e)
{
string eMsg = "An error occurred while generating the Word Document for "
+ documentName + " : " + e.Message;
docGenerated = false;
MessageBox.Show(eMsg);
}
finally
{
wordApp.Quit();
} | {
"domain": "codereview.stackexchange",
"id": 42657,
"lm_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, ms-word",
"url": null
} |
Calculus is needed here only to justify the inequality $\sinh t\ge t$ (for $t\ge 0$).
Update: Another nice thing about this method is that it points the way to a more exact inequality. It turns out that $$\sinh u\sinh v \ge \sinh^2\sqrt{uv}$$ for $u,v\ge 0$. (Proof 1: $\frac12(u^{2m+1}v^{2n+1} + v^{2m+1}u^{2n+1})\ge (uv)^{m+n+1}$ by AM/GM; divide by $(2m+1)!\,(2n+1)!$ and apply $\sum_{m=0}^\infty \sum_{n=0}^\infty$. Proof 2: Check that $t\mapsto\ln\sinh(e^t)$ is convex (for all $t$) by computing its second derivative.)
Applying this with $u=e^x$ and $v=e^{-x}$ above, we get $$\sinh^2(\cosh x) \ge \cosh^2(\sinh x) + \underbrace{\sinh^2(1) - 1}_{\approx 0.3811}$$ with equality when $x=0$.
• (+1) Very nice. Since $\cosh(x)\gt0$, we don't need to worry about signs when taking square roots. – robjohn May 27 '15 at 4:22
Let $t=\sinh x$. Now we can square the inequality and instead try proving $$\sinh^2(\sqrt{1+t^2})=\sinh^2(\cosh x) \ge \cosh^2(\sinh x)=1+\sinh^2t$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9867771801919951,
"lm_q1q2_score": 0.8590855159463234,
"lm_q2_score": 0.8705972667296309,
"openwebmath_perplexity": 568.0134092269792,
"openwebmath_score": 0.9998539686203003,
"tags": null,
"url": "https://math.stackexchange.com/questions/1299822/prove-that-sinh-coshx-geq-cosh-sinhx"
} |
homework-and-exercises, classical-mechanics, lagrangian-formalism, complex-numbers
Title: Complex Coordinate change I have a simple question where I must change the coordinates of a system however I am unsure whether I am correct. I am changing from Cartisian to complex coordinates. Let's say I only have $x$ and $y$ coordinates. Would that mean $$ x =iy - z $$ and $$ y = \frac{z - x}{i} $$
With the time derivatives being $$\dot{x} = i\dot{y} - \dot{z} $$ and likewise for y.
I know this may be a stupid question but it is bugging me and I cannot seem to find any documentation to help.
Note: I cannot use polar complex coordinates. Writing $x=iy-z, y=(z-x)/i$ doesn't help you very much because your goal is to introduce new coordinates and then write $(x,y)$ in terms of these. It's nice to start by writing the map in the other direction, i.e.
$$z=x+iy$$
The complex conjugate is then $\bar{z}=x-iy$. These can be inverted to write $(x,y)$ in terms of $(z,\bar{z})$ as
$$ x = \frac{1}{2}(z+\bar{z}), \qquad y = -\frac{i}{2}(z - \bar{z}) $$ | {
"domain": "physics.stackexchange",
"id": 27916,
"lm_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, complex-numbers",
"url": null
} |
c++, object-oriented, neural-network
Why are you passing a string by value here?
void initializeLayers(int, int *, std::string);
Why are you passing a pointer here?
void initializeLayers(int, int *, std::string);
Pointers are exceedingly rare in modern C++ (unless you are building some low level resource management object like a vector). The problem with pointers is that they do not convey ownership semantics and thus it is easy to leak or accidentally destroy something (ie. they are buggy to use).
When I look at the code that uses this I see it is very inefficient and dangerously written:
int *pLayers = new int[atoi(argv[iArgc + 1])];
// FILL IN pLayers
network.initializeLayers(atoi(argv[iArgc + 1]), pLayers, setSavePath);
delete[] pLayers; | {
"domain": "codereview.stackexchange",
"id": 38019,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, object-oriented, neural-network",
"url": null
} |
python, python-3.x, rest
def invoke(self, **kwargs):
"""
Execute the external call
"""
is_fallback = kwargs.get('is_fallback', False)
is_optional = kwargs.get('is_optional', False)
request_headers = kwargs.get('request_headers', {})
json_data = kwargs.get('json_data', {}) | {
"domain": "codereview.stackexchange",
"id": 32772,
"lm_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, rest",
"url": null
} |
python, python-2.x, security, sqlite, caesar-cipher
def encode_cipher(_string, key):
"""
encode the string using a generated unique key
"""
retval = ""
for k, v in zip(_string, key):
c_index = ALPHABET.index(k)
key_index = ALPHABET.index(v)
cipher_index = c_index + key_index
try:
retval += ALPHABET[cipher_index]
except IndexError:
cipher_index -= 26
retval += ALPHABET[cipher_index]
return retval
def decode_cipher(encoded, key):
"""
decode the encoded string using the encoded string and the key used to cipher it
"""
retval = ""
for k, v in zip(encoded, key):
c_index = ALPHABET.index(k)
key_index = ALPHABET.index(v)
decode = c_index - key_index
try:
retval += ALPHABET[decode]
except IndexError:
decode += 26
retval += ALPHABET[decode]
return retval | {
"domain": "codereview.stackexchange",
"id": 32655,
"lm_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-2.x, security, sqlite, caesar-cipher",
"url": null
} |
inorganic-chemistry, hybridization
I think that the best description of $\ce{BeCl2}$ is via a four-electron-three-centre bond akin to $\ce{XeF2}$. That again requires an unhybridised central atom. The lowest of the three relevant MOs of the 4e3c bond would be formed of the fully bonding $\mathrm{p}(\ce{Cl}) + \mathrm{s}(\ce{Be}) + \mathrm{p}(\ce{Cl})$ combination; the second bonding MO would then be $\mathrm{p}(\ce{Cl}) + \mathrm{p}(\ce{Cl})$ where the nodal plane traverses $\ce{Be}$ — mixing in its 2p orbital probably increases the bonding character — and a final antibonding $\mathrm{p}(\ce{Cl}) + \mathrm{s}(\ce{Be}) + \mathrm{p}(\ce{Cl})$ orbital wherein the phase of beryllium’s orbital is of opposite sign with respect to the chlorine orbitals’. If that is the case, it should possibly be discussed with the ‘hypervalent’ cases of the other question.
I could be terribly wrong, though. Thankfully, nobody will request you to predict the MO scheme of $\ce{BeCl2}$ until at least the final bachelor’s examination. | {
"domain": "chemistry.stackexchange",
"id": 6997,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "inorganic-chemistry, hybridization",
"url": null
} |
atomic-physics, kinetic-theory
For distribution 1,
$$
\frac{1}{2} m \langle v^2 \rangle =
\frac{1}{2} m \frac{ \int_0^\infty v^4 \exp(-mv^2/2kT) dv }
{\int_0^\infty v^2 \exp(mv^2/2kT) dv} = \frac{3}{2} k T
$$
For distribution 2,
$$
\frac{1}{2} m \langle v^2 \rangle =
\frac{1}{2} m \frac{ \int_0^\infty v^5 \exp(-mv^2/2kT) dv }
{\int_0^\infty v^3 \exp(mv^2/2kT) dv} = 2 k T .
$$
Which distribution to use depends on what kind of experimental observation one is making. In Stern Gerlach case one usually places a screen and measures how many atoms arrive on that screen during some interval of time, so the second distribution is the right one to use. If instead one detected the atoms by amount of fluorescence at any given time owing to illumination of a given length of the beam, then distribution 1 would be appropriate.
(As I say, many discussions of atomic beams omit case 1 here altogether, but it is better to be aware of both.) | {
"domain": "physics.stackexchange",
"id": 92954,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "atomic-physics, kinetic-theory",
"url": null
} |
quantum-mechanics, quantum-field-theory, probability, hamiltonian, klein-gordon-equation
Title: Propagators and Probabilities in the Heisenberg Picture I'm trying to understand why
$$\Bigl|\langle0|\phi(x)\phi(y)|0\rangle\Bigr|^2$$
is the probability for a particle created at $y$ to propagate to $x$ where $\phi$ is the Klein-Gordon field. What's wrong with my reasoning below?
We can write
$$\phi(x) = \int \frac{\textrm{d}^3\mathbf{p}}{(2\pi)^3\sqrt{2E_{\mathbf{p}}}}(a_{\mathbf{p}}e^{-ip.x}+a_{\mathbf{p}}^{\dagger}e^{ip.x})$$
Then acting with the position operator (which presumably we can write in terms of the $a$ somehow) we find that $$\mathbf{\hat{x}}\phi(x)|0\rangle=\mathbf{x}\phi(x)|0\rangle$$ This tells us that $\phi(x)|0\rangle$ can be interpreted as a particle at $x$. Now define a state $|\psi(t)\rangle$ with $$|\psi(0)\rangle=\phi(y)|0\rangle$$ We have time evolution defined by $$|\psi(t)\rangle=e^{iHt}|\psi(0)\rangle=e^{iHt}\phi(y)|0\rangle$$ | {
"domain": "physics.stackexchange",
"id": 5024,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, quantum-field-theory, probability, hamiltonian, klein-gordon-equation",
"url": null
} |
ros, gazebo, spawn-model, namespace
Originally posted by leblanc_kevin on ROS Answers with karma: 357 on 2011-09-07
Post score: 1
Seems reasonable to me.
If you open an enhancement ticket for simulator_gazebo the developers will see your request and respond to it.
Originally posted by joq with karma: 25443 on 2011-09-07
This answer was ACCEPTED on the original site
Post score: 1
Original comments
Comment by leblanc_kevin on 2011-09-12:
Thanks, I will! | {
"domain": "robotics.stackexchange",
"id": 6622,
"lm_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, gazebo, spawn-model, namespace",
"url": null
} |
c#, queue, producer-consumer
// Add some entries to the q
for (int i = 0; i < 10000; i++)
{
q.Enque(i);
}
Thread.Sleep(5000); // Give the q time to work
q.Shutdown();
}
QueueWithMultipleConsumerThreads:
public class QueueWithMultipleConsumerThreads<T>
{
private readonly ConcurrentBag<Thread> threads = new ConcurrentBag<Thread>();
private readonly ConcurrentBag<Worker<T>> workers = new ConcurrentBag<Worker<T>>();
private readonly BlockingCollection<T> queue = new BlockingCollection<T>();
public QueueWithMultipleConsumerThreads(uint numberOfWorkerThreads, Action<T> actionToBeCalled )
{
if (numberOfWorkerThreads == 0) { throw new ArgumentException($"{nameof(numberOfWorkerThreads)} must be > 0"); }
if (actionToBeCalled == null) { throw new ArgumentNullException(nameof(actionToBeCalled));} | {
"domain": "codereview.stackexchange",
"id": 24494,
"lm_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#, queue, producer-consumer",
"url": null
} |
datetime, vba, excel
Title: Find Date in Range I have a spreadsheet where I control my shift hours. In such spreadsheet I input the date, the start time, time left for lunch, time back to work, end time and sometimes the overtime.
After that I have created a couple of functions to calculate the amount of time worked, the difference against the 8-hour shift expected time, bank of hours and so forth.
Everything is working fine, but I'm not very happy with the performance of it and I suspect the reason is one of my functions, which checks whether the current date is a holiday or not.
This is my current function:
Function IsHoliday(cell As Date) As Boolean
Dim item As Range
Dim holidayList As Range
' On Error Resume Next
Set holidayList = Sheet2.Range("A3:A17")
For Each item In holidayList
If cell = item.Value Then
IsHoliday = True
Exit Function
End If
Next
On Error GoTo 0
IsHoliday = False
End Function | {
"domain": "codereview.stackexchange",
"id": 22609,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "datetime, vba, excel",
"url": null
} |
error-analysis, data-analysis
Looking at your data, there are two regions where the data does not appear to be linear. This is at approx $x=15$ and $x = 115$. Thus, you should decide whether or not these regions are important. If they are not important you should consider omitting these regions, so that your fit is improved. Note that the data points at the "$x$-edge" carry more leverage. Hence, they are particularly dangerous to distort your fit. | {
"domain": "physics.stackexchange",
"id": 73948,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "error-analysis, data-analysis",
"url": null
} |
algorithms, recursion, divide-and-conquer
I leave you to work out the details.
This is of course the faster way. The slower way, but maybe simpler to understand, is to do the recursion step by step. The function in this case will look like:
function P(n):
if n=1 or n=2 return ....
else
return P(n-1) * x
This one works for any number $n$ and returns $x^n$. The last line just instantiates the function again with a smaller parameter. | {
"domain": "cs.stackexchange",
"id": 5072,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "algorithms, recursion, divide-and-conquer",
"url": null
} |
gene, ucsc
+-------+------------+----------+---------+
| chrom | chromStart | chromEnd | name |
+-------+------------+----------+---------+
| chr1 | 11868 | 13052 | DDX11L1 |
+-------+------------+----------+---------+ | {
"domain": "bioinformatics.stackexchange",
"id": 437,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gene, ucsc",
"url": null
} |
c
Performance
You noted that the algorithm you're using is \$\mathcal{O}(n^2)\$. If you sorted the items in the array first, you could use an O(n) search on the result as you'd be able to simply run through the array until you hit a different value. (Note that this may depend on the statistical nature of your input data and the sort algorithm you use. But in general, I'd expect to see a speedup in such a case.) Most fast sort algorithms are \$\mathcal{O}(n * log(n))\$ so the result would be \$\mathcal{O}(n + n * log(n))\$ (I think? Check my math). Note that you would use the same comparison function for the sort as you would for checking for duplicates. | {
"domain": "codereview.stackexchange",
"id": 23326,
"lm_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
} |
will make the parabola open downward. DWRead. Coordinate Graph . The approach is rather simple. The dots will be a perfect reflection of each other. Complete the table below by finding the reciprocal functions’ symmetry, domain, range, vertical asymptote, and horizontal asymptote. When graphing rectangular equations by The vertical Line test. In fact, these sides are just mirror images of each other! The quadratic equation is a vertical parabola. If at least one not identical element is found, mark matrix as not vertical symmetric. The graphs show what the parabolas look like when they to the left or to the right. The task is to check whether the matrix is horizontal symmetric, vertical symmetric or both. 1.7k plays . So this function is neither even nor odd. Look in a mirror. 4-7 Graphing Quadratics in Vertex Form Name: _ * State the vertex and the axis of symmetry… Even and odd functions like a bell-shaped curve ( 50 % ) Solution in the of. Found, mark matrix as not vertical | {
"domain": "ykema.nu",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9706877709445759,
"lm_q1q2_score": 0.830764243894477,
"lm_q2_score": 0.8558511488056151,
"openwebmath_perplexity": 509.46817848825987,
"openwebmath_score": 0.6092317700386047,
"tags": null,
"url": "http://ykema.nu/aigqkb/81c793-vertical-symmetry-graph"
} |
lagrangian-formalism, conservation-laws, symmetry, noethers-theorem, classical-field-theory
In this question Energy momentum tensor from Noether's theorem the accepted answer says "For actions that only depend on first derivatives of the fields, the variation of the action will inevitably have the form $$ S = \int (\partial_\mu a) j^\mu d^d x $$
where $j^\mu$ is some particular function of the fields or other degrees of freedom (and their derivatives)". Does $(4)$ assume this form? Should it? Note that I haven't specified if $ε^α$ are constant or not, in getting $(4)$ we've been as general as possible on this matter (right?).
The assumption in Noether's (first) theorem is that the action $S$ should be invariant off-shell$^1$ up to a boundary term under the transformations (1) & (2). It is not enough to know this only on-shell.
No. Knowing only that there is an on-shell quasi-symmetry (which is a tautology), there is not enough information to conclude an on-shell continuum equation/conservation law. There is no free lunch. | {
"domain": "physics.stackexchange",
"id": 52982,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "lagrangian-formalism, conservation-laws, symmetry, noethers-theorem, classical-field-theory",
"url": null
} |
python, python-3.x, database, django, role-playing-game
My main concern is the general design pattern I've employed with the linking tables. The code has moved on since then, but the shape of my tables is the same. You migrated the SKILL_CHOICES and ATTRIBUTE_CHOICES out to a separate file. Why not do the same for VIRTUE_CHOICES, VICE_CHOICES, SUB_RACE_CHOICES, FACTION_CHOICES, ARCANUM_CHOICES, PRIORITY_CHOICES? How are the other choices special?
I don't really see how I can review the rest of the code, though. What you have here is largely a data model... and without seeing code that will use these objects or the domain knowledge what this data model represents, I can't tell you whether your data model is good.
... I wonder, though... do you really need to turn all your links into classes? Would a table structure really be so bad? You can have a class that manages that specific table... I imagine that you'd use some of the collections classes that your language provides. | {
"domain": "codereview.stackexchange",
"id": 12121,
"lm_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, database, django, role-playing-game",
"url": null
} |
(Finite dimensional) quantum mechanics, if this is considered "outside of maths":
The basic postulates of quantum mechanics read:
• The quantum system is described by a Hilbert space (make this a complex vector space in finite dimensions).
• "observables" are Hermitian operators (read: symmetric/self-adjoint matrices in finite dimensions) and measurement outcomes are given by eigenvalues, hence you need to know that every Hermitian matrix is diagonalizable with real eigenvalues (spectral theorem).
• composite systems are given by the tensor product (this might not be "elementary", but still, it's pure linear algebra.
• time evolution is given by the Schrödinger equation.
The famous "bra-ket"-notation of Dirac used in virtually all textbooks on quantum mechanics is all about inner products and the duality between a vector space and its dual. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9702399069145609,
"lm_q1q2_score": 0.8064081493286263,
"lm_q2_score": 0.8311430436757312,
"openwebmath_perplexity": 362.63873754561075,
"openwebmath_score": 0.6874520778656006,
"tags": null,
"url": "https://math.stackexchange.com/questions/1072459/what-are-some-applications-of-elementary-linear-algebra-outside-of-math/1072463"
} |
c++, roman-numerals
Update
Roman_integer_values(const Roman_value& roman_digit, const Integer_value& integer_digit)
:roman{ roman_digit }, integer{ integer_digit }
{
};
^
You have extra semicolons after function definitions. Compilers will consider them as "empty statements" and ignore them. Remove them.
There are multiple places where your class member functions have local variables that shadow class data members.
Roman roman{};
Integer integer{};
Integer Roman_int::roman_to_integer(const Roman& roman);
^^^^^
Roman integer_to_roman(const Integer& integer);
^^^^^^^
bool is_valid_roman(const Roman& roman);
^^^^^
Same applies with variables declared inside your class member functions.
Roman as_roman() const { return roman; }
Integer as_integer()const { return integer; } | {
"domain": "codereview.stackexchange",
"id": 31485,
"lm_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++, roman-numerals",
"url": null
} |
javascript, performance, jquery
if(remote > 1) {
$.ajax({
url: '/Includes/pageHelper.cfc',
type: 'post',
async: true,
data: {
method: "getBundleSelectedItems",
productList: itemntns.join(',')
},
success: function(data) {
var $container = $('.selected-items > span');
$container.html(data);
$.each($container.find('.selected-item'), function() {
var myntn = $(this).data().ntn,
$price = $(this).find('.price'),
$bunPrice = $('<span />').addClass('bundle-price');
$(this).find('.cartqty').val(productsBundled[myntn].qty); | {
"domain": "codereview.stackexchange",
"id": 2216,
"lm_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, jquery",
"url": null
} |
5. Feb 21, 2010
CRGreathouse
Yes.
6. Feb 21, 2010
HallsofIvy
Staff Emeritus
What Mark44 gave you will certainly help. The sum of all integers from 1 to n is, of course, n(n+1)/2. The sum of all even integers from 1 to n, assuming for the moment that n is even, n= 2k, is 2+ 4+ 6+ ...+ 2k-2+ 2k= 2(1+ 2+ 3+ ...+ (k-1)+ k) and its sum is 2[k(k+1)/2)= k(k+1). The sum of all odd numbers, from 1 to 2k+1, is the sum of all integers from 1 to 2k+1, (2k+1)(2k+2)/2= (2k+1)(k+1), minus the sum of even integers from 1 to 2k: the sum of all odd integers from 1 to 2k+1 is (2k+1)(k+1)- k(k+1)= (k+1)(2k+1-k)= (k+1)2.
Interesting result isn't it? Yes, 1+ 3= 4, 1+ 3+ 5= 9, 1+ 3+ 5+ 7= 16, etc. all squares.
Another reason why the sum of odd integers is a square: | {
"domain": "physicsforums.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9796676425019243,
"lm_q1q2_score": 0.8076986654077865,
"lm_q2_score": 0.8244619199068831,
"openwebmath_perplexity": 285.5942302770562,
"openwebmath_score": 0.7951633334159851,
"tags": null,
"url": "https://www.physicsforums.com/threads/summation-equation-for-odd-numbers.380096/"
} |
c++, programming-challenge, design-patterns, c++17
The code change is minimal, and the runtime has improved four-fold. The main issue is that the comparator object is passed by value. Not only from your application to std::sort(), but it's also passed by value internally in the implementation of std::sort(). This means that bag and indices get copied by value a lot. So you ideally want to generate those only once, and then have class compare store a pointer or reference to those. I think there are several possible approaches; you could keep the constructor mainly as it is, but instead of storing those vectors directly, use a std::shared_ptr to manage their storage. The default copy constructor will then just take care of updating the refcounts for you:
struct compare {
std::shared_ptr<std::multiset<unsigned>> bag;
std::shared_ptr<std::map<unsigned, size_t>> indices; | {
"domain": "codereview.stackexchange",
"id": 45056,
"lm_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, design-patterns, c++17",
"url": null
} |
algorithms, efficiency, selection-problem
The algorithm is really simple: read 5 unsigned integer values, get the highest 2, do some calculations on those and write back the unsigned integer result.
What is nice is that the 5 integer input values are all in the range of 0-20. The calculated integer value are also in the 0-20 range!
Through profiling, I have figured out that getting the largest two numbers is the bottleneck so I want to speed this part up. What is the fastest way to perform this selection?
The current algorithm uses a 32 bit mask with 1 in the position given by the 5 numbers and a HW-supported CLZ function.
I should say that the CPU is a proprietary one, not available outside of my company. My compiler is GCC but tailor made for this CPU.
I have tried to figure out if I can use a lookup-table but I have failed to generate a key that I can use.
I have $21^5$ combinations for the input but order isn't important, i.e. [5,0,0,0,5] is the same as [5,5,0,0,0]. | {
"domain": "cs.stackexchange",
"id": 4215,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "algorithms, efficiency, selection-problem",
"url": null
} |
ros, debian, jessie
( where/how exactly to run sudo ldconfig -v)
when i check the above mention destination, i find (libcollada-dom2.4-dp.so.2.4.0)
please help me
Following advice from @Humpelstilzchen I got collada_parser built, and ROS installed. Removed collada-com-dev (using dpkg worked fine), re-ran checkinstall, followed by
sudo ldconfig -v
(libcollada-dom2.4... did show up there)
ROS built cleanly and installed into appropriate directory thereafter.
Thanks for the help @jbohren and @Humpelstilzchen
Originally posted by Laughlin with karma: 66 on 2016-02-10
This answer was ACCEPTED on the original site
Post score: 2
Original comments
Comment by Pratik Somaiya on 2016-07-04:
Worked for me!! Thanks all of you :) | {
"domain": "robotics.stackexchange",
"id": 23705,
"lm_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, debian, jessie",
"url": null
} |
java, regex
You might want to profile this. It should certainly be faster for a TreeMap, which is easily iterable. It may or may not be faster for a HashMap.
Not needed in Javadoc
/**
* Marge the results of analyzeForward() and analyzeBackward() methods to ensure the most correct results of
* analysis. The junction of results corrects errors caused by analyzing only front to back, or back to front.
* @return TreeMap with connected results
*/
public TreeMap<Integer,Integer> analyze(){ // merge two versions
You could just say
/**
* Analyze front to back and back to front.
* The junction of results corrects errors caused by analyzing only one direction.
* @return Map with connected results
*/
public Map<Integer, Integer> analyze() {
Also removed the extraneous comment at the end and adjusted return type and spacing. | {
"domain": "codereview.stackexchange",
"id": 14559,
"lm_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, regex",
"url": null
} |
reinforcement-learning
Title: What is softmax in reinforcement learning? There are multiple very complicated articles about softmax online. I just want to know a few things about it:
Why do we need softmax? What is the "problem"? What does it do?
How does it do it? | {
"domain": "cs.stackexchange",
"id": 17308,
"lm_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",
"url": null
} |
special-relativity, waves, symmetry
When you apply a Lorentz transformation, the vectors $(\vec{x},ct)$ and $(\vec{p},E/c)$ change. The position of an object in spacetime is not the same in every frame, and its momentum and energy are not the same either. Instead, the way that those vectors change is well-defined; in particular, for a Lorentz transformation with boost velocity $v$ and Lorentz factor $\gamma$ in the $x$ direction, we have that the new four-vectors $(\vec{x}',ct')$ and $(\vec{p}',E'/c)$ are given by:
$$\vec{x}'=\gamma(x-vt)\hat{x}+y\hat{y}+z\hat{z}$$
$$ct'=\gamma\left(ct-\frac{vx}{c}\right)$$
$$\vec{p}'=\gamma\left(p_x-\frac{vE}{c^2}\right)\hat{x}+p_y\hat{y}+p_z\hat{z}$$
$$\frac{E'}{c}=\gamma\left(\frac{E}{c}-\frac{vp_x}{c}\right)$$
The Lorentz-invariant quantities that are derived from these vectors are Lorentz scalars. In particular, the dot product of two Lorentz vectors is a Lorentz scalar. So, from these two Lorentz vectors, we get the following three Lorentz-invariant quantities: | {
"domain": "physics.stackexchange",
"id": 67035,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "special-relativity, waves, symmetry",
"url": null
} |
3. 3.
$\mathbb{Q}$, as a subspace of $\mathbb{R}$ with the usual topology, is not discrete: any open set containing $q\in\mathbb{Q}$ contains the intersection $U=B(q,\epsilon)\cap\mathbb{Q}$ of an open ball around $q$ with the rationals. By the Archimedean property, there’s a rational number between $q$ and $q+\epsilon$ in $U$. So $U$ can’t contain just $q$: singletons can’t be open.
4. 4.
The set of unit fractions $F=\{1/n\mid n\in\mathbb{N}\}$, as a subspace of $\mathbb{R}$ with the usual topology, is discrete. But $F\cup\{0\}$ is not, since any open set containing $0$ contains some unit fraction.
5. 5.
The product of two discrete spaces is discrete under the product topology. The product of an infinite number of discrete spaces is discrete under the box topology, but if an infinite number of the spaces have more than one element, it is not discrete under the product topology. | {
"domain": "planetmath.org",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9925393560946885,
"lm_q1q2_score": 0.802038507233194,
"lm_q2_score": 0.8080672089305841,
"openwebmath_perplexity": 191.18918650496448,
"openwebmath_score": 0.8691820502281189,
"tags": null,
"url": "https://planetmath.org/discretespace"
} |
python, comparative-review, hash-map, finance
Function 2 is not equivalent to the other two: it returns a dictionary rather than a key set. It suffers from the problem that it sometimes returns the original dictionary, and sometimes returns a copy. It also treats 0 as a special parameter value.
def func2_improved(data, min_value=None, max_value=None):
data = dict(data) # Make a copy
for k, v in data.items():
if min_value is not None and v <= min_value:
del data[k]
if max_value is not None and v >= max_value:
del data[k]
return data.keys()
Function 3 is quite good, especially when formatted as a one-liner using a set comprehension:
def func3_improved(data, min_value=float('-inf'), max_value=float('inf')):
return set(k for (k, v) in data.items() if min_value <= v <= max_value) | {
"domain": "codereview.stackexchange",
"id": 11831,
"lm_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, comparative-review, hash-map, finance",
"url": null
} |
Now, here is why exploiting the even symmetry of $f^{e}$ is important. We will now make a transformation under inversion. Letting $x\to \frac1x$, $(1)$ becomes
\begin{align} \int_{-\infty}^{\infty}f\left(x-\frac1x\right)dx&=2\int_0^{\infty}f^{e}\left(\frac1x-x\right)\frac{1}{x^2}dx \\\\ &=2\int_0^{\infty}f^{e}\left(x-\frac1x\right)\frac{1}{x^2}dx \tag2 \end{align}
where in arriving at $(2)$, we used $f^{e}(x)=f^{e}(-x)$. So, upon adding the right-hand sides of $(1)$ and $(2)$ and dividing by $2$ we obtain
$$\int_{-\infty}^{\infty}f\left(x-\frac1x\right)dx=\int_{0}^{\infty}f^{e}\left(x-\frac1x\right)\left(1+\frac{1}{x^2}\right)\,dx$$
At this point, all we have is that the integral of interest is decomposed into the sum of an integral of its even part and an integral of an "inverted" even part. But, now we notice that the "scale factor" is the derivative of the argument of $f^{e}$ and thus we find that | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9896718471760709,
"lm_q1q2_score": 0.8068126436149404,
"lm_q2_score": 0.815232489352,
"openwebmath_perplexity": 220.10740012358218,
"openwebmath_score": 0.8963024616241455,
"tags": null,
"url": "https://math.stackexchange.com/questions/1397743/intuition-behind-an-integral-identity/1397832"
} |
java, console, chat
public String getSender() {
return sender;
}
public String getDate() {
return date;
}
public String getContent() {
return content;
}
}
The Writer:
public class Writer {
public static void main(String[] args) {
System.out.print("Your nickname: ");
String nickname = scanner.nextLine();
try {
new Writer(nickname).chat();
} catch (Exception e) {
System.out.print("Error: " + e.getMessage());
} finally {
scanner.close();
}
}
private static Scanner scanner = new Scanner(System.in);
private String nickname;
// directory in which messages get stored
// initialized by file named config
private File currentDir;
public Writer(String nickname) {
this.nickname = nickname;
String saveDir = new ConfigFileReader("config").getSaveDir();
currentDir = new File(saveDir, "current"); | {
"domain": "codereview.stackexchange",
"id": 38848,
"lm_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, console, chat",
"url": null
} |
python, object-oriented, programming-challenge, pathfinding, breadth-first-search
Title: Find the shortest path through a maze with a twist: you can knock down one wall I would like my solution to Google Foobar's prepare_the_bunnies_escape checked for readability, maintainability, extensibility, style, design. I am looking forward to reading your suggestions on any of these aspects! Feel free to comment on other aspects as well.
Problem
Link to full problem
statement
Summary
You are given an HxW matrix of 0's and 1's, m, where 0's
indicate traversable cells and 1's indicate nontraversable cells
(i.e. walls). start denotes the cell at coordinate (0, 0) and
end denotes the cell at coordinate (H-1, W-1). start and end are always traversable. Given that you can remove one wall making it traversable, find the distance of a shortest path from
start to end.
Test cases
Inputs:
m = [ [0, 1, 1, 0],
[0, 0, 0, 1],
[1, 1, 0, 0],
[1, 1, 1, 0] ]
Outputs:
7 | {
"domain": "codereview.stackexchange",
"id": 24154,
"lm_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, object-oriented, programming-challenge, pathfinding, breadth-first-search",
"url": null
} |
python, statistics, data-science-model, data-analysis
If your corrosion measure has varying timesteps then you should use the sum of the water flow since averaging would cause inconsistency. For example, the average of flow in 100 days could be the same as the average in 10 days, and the corrosion in 100 days would be way bigger. Having two similar inputs that map to two completely different outputs would cause performance issues for a regression algorithm. | {
"domain": "datascience.stackexchange",
"id": 8039,
"lm_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, statistics, data-science-model, data-analysis",
"url": null
} |
java, performance, object-oriented, programming-challenge, unit-testing
System.out.println("Enter the Initial YLocation:");
y=in.nextInt();
in.nextLine();
System.out.println("Enter the Instructions\t");
instSet=in.nextLine();
MarsRover mr1=new MarsRover(p1,x,y,Direction.valueOf(dir),instSet);
mr1.executeInst();
mr1.showCurrentLocation();
}
}
Plateau.java
import java.util.Scanner;
/**
* Created by Leo on 28-07-2015.
*/
class Plateau {
private int size;
public Plateau() {
Scanner in = new Scanner(System.in);
System.out.println("Enter the Size of the plateau");
size=in.nextInt();
in.nextLine();
}
public Plateau(int sz){
size=sz;
}
public Cell getNeighbour(MarsRover.Direction dir,Cell c){
Cell neighbour = null;
switch (dir) { | {
"domain": "codereview.stackexchange",
"id": 20372,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, performance, object-oriented, programming-challenge, unit-testing",
"url": null
} |
# (Row?) reduction of a system of equations
For a mathematical problem I am trying to solve, I have (say) $$(N+1)$$ inhomogeneous linear equations in $$M$$ variables of the form
$$\sum_{a=1}^{M}c_{i a}p_{a} = \xi_{i} \quad \text{ where } i=1,\ldots, N$$ $$p_{\alpha} - p_{\beta} = r_0 \qquad \text{ where } \alpha, \beta \in \{1, \ldots, M\} \text{ and } \alpha \neq \beta.$$
(So the first $$N$$ equations have RHS $$\{\xi_i\}_{i=1}^{N}$$ and the $$(N{+}1)^{th}$$ equation has RHS $$r_0$$.)
The integer coefficients $$c_{ia}$$ in each equation add up to zero, i.e.
$$\sum_{a=1}^{M}c_{ia} = 0 \quad \text{ for all } a = 1, \ldots N.$$
For a given range of $$r_0$$, i.e. $$r_{0,min} < r_0 < r_{0,max}$$, I would like to reduce as many equations as possible to the form
$$p_{\alpha_i} - p_{\alpha_j} = f_{ij}(r_0, \xi_1, \ldots)$$
and the rest that cannot be reduced in this way should take the form
$$p_{\alpha_{m_1}} - 2 p_{\alpha_{m_2}} + p_{\alpha_{m_3}} = g(r_0, \xi_1, \ldots)$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9539660989095221,
"lm_q1q2_score": 0.8089324944607467,
"lm_q2_score": 0.8479677583778258,
"openwebmath_perplexity": 1013.5449543624284,
"openwebmath_score": 0.43913453817367554,
"tags": null,
"url": "https://mathematica.stackexchange.com/questions/206296/row-reduction-of-a-system-of-equations"
} |
newtonian-mechanics, classical-mechanics, fluid-dynamics, energy-conservation, friction
p.s.
In the image above.
The left side shows the plot of an object in freefall accelerating under gravity. The 3 plots being GPE, KE, TE versus Time.
The right side shows the plot of an object in terminal velocity state.
EDIT :
Trying to be more specific, it is very clear, energy is lost due to viscous drag which is a function of velocity. Now since the object is in terminal velocity state, the drag has a constant value. But for the total energy to remain constant, the energy dissipated must increase with time. So how is a constant drag value causing energy to be dissipated in a linearly increasing fashion? All the lost energy eventually winds up as heat, either in the falling object or in the atmosphere. | {
"domain": "physics.stackexchange",
"id": 5184,
"lm_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, classical-mechanics, fluid-dynamics, energy-conservation, friction",
"url": null
} |
python, python-3.x
Can I simplify calculate_team_stats()?
Yes; the reason it's so unweildly now is because you're using a flat data structure, and you're relying too much on dicts. Dicts aren't great for structured data because they have very little structure. When you know the structure in advance, a tree of NamedTuples is often better. | {
"domain": "codereview.stackexchange",
"id": 38547,
"lm_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",
"url": null
} |
quantum-computing
Title: Quantum state probabilities and amplitudes - absolute value squared? It has just appeared to me that I've overlooked a possibly important fact. When we want to calculate probability $p_x$ of measuring the state $X$ and we know the amplitude of $X$ is $\alpha$, we know that $p_x = |\alpha|^2$. Until today I thought that absolute value was not necessary anyway. However, it brings significant difference if we have complex amplitudes with non-zero imaginary parts.
For example, let's say we have a superposition of 16 states, where four amplitudes are like $\frac{i}{4}$, four like $\frac{-1}{4}$ and eight like $\frac{1}{4}$. If we keep with the recipe I wrote above, then this state is fine, as the sum of all probabilities is 1. However, if we skip the absolute value and compute probabilities like $\alpha^2$, then sum of all probabilities in the above state would be $\frac{1}{2}$ and the state would not be stable. | {
"domain": "cs.stackexchange",
"id": 4030,
"lm_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-computing",
"url": null
} |
swift, ios, stackexchange, mobile
Similar changes can be applied to the UserData class.
Reading the response – Thou shalt not force unwrap!
This refers to the force-unwrap operator ! and the force-cast
operator as!, both easily cause fatal errors and unexpected program terminations.
There is a lot of force-casting in the completion handler in the
requestDataFromApi() function, starting right at the beginning:
if let json = response.result.value {
/* I know this is a bit ugly */
let json1 = json as! [String:AnyObject]
let usersInfoFromJSON = json1["items"] as! NSArray
// ...
That is not ugly, but bad. If for any reason (such as a change in the API)
the response is not a dictionary, or
there is no "items" key in the response, or
the value of the "items" key is not an array | {
"domain": "codereview.stackexchange",
"id": 30171,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "swift, ios, stackexchange, mobile",
"url": null
} |
robotic-arm, manipulator, trajectory
But why he needed to compute both acceleration and velocity form the total displacement?
And what is $V=\frac{T}{4}$ that he computed in the beginning? Shoudn't this be the maximum velocity?
I have a lot of doubts on this, sice I do not understand also what are $A=\frac{16\Delta \theta }{3T^{2}}$ and $V=\frac{4\Delta \theta }{3T}$
And also, why there is the need to compute the time both from the acceleration and form the velocity?
Can somebody please help me understand? Your problem statement is: | {
"domain": "robotics.stackexchange",
"id": 2164,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "robotic-arm, manipulator, trajectory",
"url": null
} |
c#, performance, game-of-life
int neighbors = getLivingNeighbors(i, j);
if (c.IsAlive && neighbors < 2)
{
nextGenCells.Add(c);
}
if (c.IsAlive && neighbors > 3)
{
nextGenCells.Add(c);
}
if (!c.IsAlive && neighbors == 3)
{
nextGenCells.Add(c);
}
}
}
foreach (Cell cell in nextGenCells)
{
cell.IsAlive = !cell.IsAlive;
}
}
private void oneGenerationButton_Click(object sender, RoutedEventArgs e)
{
updateCells();
}
private void CreateBoardButton(object sender, RoutedEventArgs e)
{
rowNum = (int) heightSlider.Value;
columnNum = (int)widthSlider.Value;
createGrid(rowNum, columnNum);
}
private void randomizeButton_Click(object sender, RoutedEventArgs e)
{
Random rand = new Random(); | {
"domain": "codereview.stackexchange",
"id": 8898,
"lm_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, game-of-life",
"url": null
} |
c++, performance, beginner, algorithm, programming-challenge
for (auto const& word : words)
^^^^^^
This prevents the strings being copied into the function. It will also catch situations were you accidentally try and modify the string.
Please add braces {} around sub blocks.
It will save you one day without you even knowing. Issues caused by missing braces are notoriously hard to find because they are caused when sombody else does something nasty that affects your code (multi line macros come to mind).
One variable per line:
int left_a = 0, right_a = 0;
Its not going to hurt you to add an extra line and it makes the job easier for the next person.
Not sure it is worth it.
But just to be complete you could use a standard algorithm to count.
int count = 0;
for (auto &word : words)
if (is_stretchable(base_string, word))
count++;
return count;
// --- | {
"domain": "codereview.stackexchange",
"id": 38579,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, performance, beginner, algorithm, programming-challenge",
"url": null
} |
image-processing, math, shape-analysis
Title: How to efficiently calculate points of intersection of a straight line and a contour? Ex.
I have an image, let's say 100x100 pixels with some shape on it. And a set of straight lines that are passing through origin located at some point of image, for example origin located at point (50, 50). Number of lines determined by step - angle. If step = 15 degrees, then we have 180 / 15 lines. I want to determine points of interesection in efficient way, but all that I came up for now is printing a line on matrix and check for non-zero elements if they overlap non-zero elements of a shape(and check for diagonal connectivity). Calculate the straight lines angles with respect to the x-axis
Calculate the angles of each and every point on the contour
Search for points on the contour with same angles as the lines with respect to the origin.
These are the points of line-contour crossing. | {
"domain": "dsp.stackexchange",
"id": 3189,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "image-processing, math, shape-analysis",
"url": null
} |
statics
$$M= -8= -4b\dfrac{1}{2}\cdot\dfrac{1}{3}b+2.5(b+a)\dfrac{1}{2}\cdot\dfrac{1}{3}(b+a)$$
So what am I doing wrong?
Because $M$ can never be negative with me, plus the answer should be $b=5.625$ and a= $1.539$.
But this to me makes no sense, because then $F_1+F_2\neq0$.
And if I should take the reactive forces into account at $A$ then you can never have still a moment, because then it is not static anymore. Defining $F_1$ as the triangular load, we have
$$F_1 = -\dfrac{4b}{2} = -2b$$
Defining $F_2$ as the uniform load, we have
$$F_2 = 2.5(a+b)$$ | {
"domain": "engineering.stackexchange",
"id": 684,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "statics",
"url": null
} |
php, object-oriented, api
public $revertedData = array(),
$lastObj = null,
$ltet = self::LTET,
$gtet = self::GTET;
/** Constructor of the class */
public function __construct() {
//Performs all the relative checks that are required by the FM PHP API
$this->doChecks();
$this->fm = new FileMaker( FMDB_NAME, FMDB_IP, FMDB_USERNAME, FMDB_PASSWORD );
}
/**
* Perform all checks before doing any thing
*
* @todo Will extend this function to perfrom more extensive tests
*
* @author RichardC
* @version 1.0
*
* @since 1.6
*
* @return true
*/
protected function doChecks(){
if( !function_exists( 'curl_init' ) ){
die( 'Please enable cURL to use the FileMaker PHP API' );
}
return true;
} | {
"domain": "codereview.stackexchange",
"id": 1418,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "php, object-oriented, api",
"url": null
} |
c++, algorithm, array, sorting, c++14
int num;
std::string name;
for(int i=0; i < size; ++i)
{
in >> name;
in >> num;
median.push_back( std::make_pair(num,name));
}
return median;
}
That one line alone will probably fix your timeout errors.
But we can do even better.
Although we’re reserving all the memory we’re going to need, we’re still pushing elements on to the vector. Now it is going be very quick… but, again, still not free.
So instead of just reserving space and then pushing elements in to the vector over and over… why not create the elements right away, and then read the data directly into them? No extra copies needed.
This is technically not good practice in general… but it is a valid hack for efficiency. And efficiency is what you’re gunning for.
So:
auto read_data_pairs(std::istream& in, int size) -> std::vector<std::pair<int, std::string>>
{
std::vector<std::pair<int,std::string>> median; | {
"domain": "codereview.stackexchange",
"id": 40807,
"lm_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, array, sorting, c++14",
"url": null
} |
which the integral converges. If the limit exists and is a finite number, we say the improper integral converges. f(x)dxare called convergent if the corresponding limits exists and divergent if the limit does not exists. Check out all of our online calculators here!. Improper integrals are used to calculate the solutions to definite integrals that may not necessarily exist because the functions are either discontinuous or have indefinite limits. a definite integral in which one or both of the limits of integration is infinite. By evaluating the terms and substituting the limits, we will notice that the integral diverges as a result since the terms cannot be cancelled as a result. Some positive constant. ) We say that the improper integral Z b a f converges, if lim c!b Z c a fexists in R: Otherwise we say the improper integral R b a f is divergent. Improper (Horizontal Asymptote) Integrals Since we can’t do a definite integration on the TI when one of the limits is positive or negative | {
"domain": "kangalmalakli.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9904406026280905,
"lm_q1q2_score": 0.8097589590957879,
"lm_q2_score": 0.817574478416099,
"openwebmath_perplexity": 604.3811915113284,
"openwebmath_score": 0.9631556272506714,
"tags": null,
"url": "http://kangalmalakli.it/fjie/improper-integral.html"
} |
ros, roslaunch, node, rosrun
I don't know what's wrong with it, please help me, thank you very much!
Originally posted by xuao on ROS Answers with karma: 5 on 2016-04-13
Post score: 0
Original comments
Comment by maysamsh on 2016-04-13:
Have you installed message_to_tf package?
Comment by xuao on 2016-04-13:
I have installed that package in home/aicrobo/catkin_ws/src, and catkin_ws is my workspace.
aicrobo@ubuntu:~/catkin_ws$ rospack find message_to_tf
/home/aicrobo/catkin_ws/src/message_to_tf
From joq comment, this solved the issue for me (using indigo, you might need to adapt to your ROS version):
sudo apt-get install ros-indigo-message-to-tf
Originally posted by romay with karma: 56 on 2016-04-22
This answer was ACCEPTED on the original site
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 24368,
"lm_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, roslaunch, node, rosrun",
"url": null
} |
catkin
Originally posted by ahendrix with karma: 47576 on 2014-08-06
This answer was ACCEPTED on the original site
Post score: 0
Original comments
Comment by roadrunner on 2014-08-06:
Thanks for the pointers. I'll try that. | {
"domain": "robotics.stackexchange",
"id": 18920,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "catkin",
"url": null
} |
rust, library, vectors
/// Creates a new `Vec3` based on the given `x`, `y` and `z` values.
///
/// ### Arguments
///
/// * `x` - The first vector component.
/// * `y` - The second vector component.
/// * `z` - The third vector component.
///
/// ```
/// use glMatrix_rs::vec3::*;
///
/// let result = Vec3::from_values(0.0, 1.0, 2.0);
/// assert_eq!([0.0, 1.0, 2.0], result);
/// ```
fn from_values(x: f32, y: f32, z: f32) -> Vec3 {
[x, y, z]
} | {
"domain": "codereview.stackexchange",
"id": 34493,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "rust, library, vectors",
"url": null
} |
quantum-field-theory, path-integral, commutator, second-quantization
$$\lim_{\epsilon\rightarrow 0}\int_A d^3 x\left[ \langle\left.\frac{\partial\mathcal{L}}{\partial\left(\partial_0\phi\right)}(x)\,\,\phi(y)\rangle\right|_{x^0=y^0+\epsilon/2} - \langle\phi(y)\left.\frac{\partial\mathcal{L}}{\partial\left(\partial_0\phi\right)}(x) \rangle\right|_{x^0=y^0-\epsilon/2} \right] = -i\,1_A(y^i)$$
where $1_A$ is an indicator function that equals one if $y^i\in A$, and zero otherwise. So the quantity in brackets is clearly $-i\delta^{(3)}(x^i-y^i)$. And also from the relation of the path integral correlation functions to time ordered correlation functions in the operator approach it must be the commutator
$$\left[\frac{\partial\mathcal{L}}{\partial\left(\partial_0\phi\right)}(x),\phi(y)\right]=-i\delta^{(3)}(x^i-y^i)$$ | {
"domain": "physics.stackexchange",
"id": 84889,
"lm_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, path-integral, commutator, second-quantization",
"url": null
} |
java, performance, beginner, strings
public static void counter(int number, int lenght) {
int numberFull=(number*2)+1;
int spaceFull=lenght-numberFull;
int space=spaceFull/2;
for (int a=1;a<=space;++a)
{System.out.print(" ");}
for (int x=0;x<=number;x++)
{System.out.print(x);}
for (int y=number-1;y>=0;y--)
{System.out.print(y);}
for (int b=1;b<=space;++b)
{System.out.print(" ");}
} You can simplify the logic that prints the numbers going from 0 to number anc back to 0.
They are: number - Math.abs(number - x). Let's explain why. With the number 5, the wanted output is:
01234543210 | {
"domain": "codereview.stackexchange",
"id": 19739,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, performance, beginner, strings",
"url": null
} |
python, object-oriented, python-2.x, cache
class Cache(dict):
def __init__(self, provider):
self._provider = provider
def __missing__(self, key):
v = self._provider(self, key)
self[key] = v
return v
class FileCache(Cache):
def __init__(self, path, provider):
super(FileCache, self).__init__(provider)
self._path = path
def __enter__(self):
path = self._path + '.lock'
if not os.path.isfile(path):
with open(path, 'a') as f:
pass
else:
raise IOError('file {!r} exists.'.format(path))
self._file = open(self._path, 'a+')
return self
def __exit__(self, exc_type, exc_value, traceback):
self._file.close()
os.remove(self._path + '.lock')
return False | {
"domain": "codereview.stackexchange",
"id": 23481,
"lm_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, object-oriented, python-2.x, cache",
"url": null
} |
homework-and-exercises, particle-physics, nuclear-physics, mesons
The general process for analyzing these sorts of things qualitatively is checking for symmetry violations. Processes that violate strict symmetries are forbidden and can be ignored, while processes that violate approximate symmetries are suppressed and therefore much less likely than processes that don't violate any symmetries. Beyond that, you have to at least be comfortable drawing Feynman diagrams, where you can look for additional factors that can suppress decays, such as decays that can only occur via loops (e.g. $\rm H\to\gamma\gamma$), where the OZI rule applies (e.g. $\rm\phi\to\pi^+\pi^-\pi^0$), or extra vertices required in the decay at tree level. | {
"domain": "physics.stackexchange",
"id": 69787,
"lm_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, particle-physics, nuclear-physics, mesons",
"url": null
} |
ros, rosbag, timestamp, header
Title: rosbag API C++: Message Header Stamp sec and nsec are always zero?
The "sec" and "nsec" values in the message header are always zero when recording using "rosbag::write". I provide a valid Time for the second parameter, but that only seems to affect the message body timestamp and playback timing, but not the header. Is that expected?
I am converting some odometry and depth image information that was collected in Windows to a rosbag containing tf, depth_image, and camera_info messages (using rosbag API in C++)for consumption by the slam_gmapping node. | {
"domain": "robotics.stackexchange",
"id": 16789,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, rosbag, timestamp, header",
"url": null
} |
java, javafx
viewInvetoryDetailsViewModel.show(this.getSelectedProduct());
}
}
@FXML
private void inventoryTableUpdate(MouseEvent event) throws Exception {
if (this.productTableView.getSelectionModel().getSelectedItem() != null) {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/com/hassanalthaf/telemart/views/UpdateInventoryDetailsView.fxml"));
Parent updateInventoryDetails = fxmlLoader.load();
UpdateInventoryDetailsViewModel updateInventoryDetailsViewModel = fxmlLoader.getController();
updateInventoryDetailsViewModel.show(this.getSelectedProduct(), this);
}
}
@FXML
private void inventoryTableDelete(MouseEvent event) {
if (this.productTableView.getSelectionModel().getSelectedItem() != null) {
int id = this.getSelectedProduct().getId();
this.productController.deleteProduct(id);
this.populateProductsTable();
}
} | {
"domain": "codereview.stackexchange",
"id": 17934,
"lm_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, javafx",
"url": null
} |
condensed-matter, superconductivity, fermions, many-body, second-quantization
Title: Solving the BCS Hamiltonian via the Bogoliubov Transformation I was doing a calculation in Giamarchi's Introduction to Many Body Physics, chapter 3, on BCS theory and second quantization, and ran into some confusion with the BCS Hamiltonian. The pdf is here for your reference: http://dpmc.unige.ch/gr_giamarchi/Solides/Files/many-body.pdf
The main confusion comes with eqn. 3.154. Here, the BCS Hamiltonian is given by
$$
H=\sum_k \left( A(k)(\beta_k^\dagger \beta_k-\alpha_k^\dagger \alpha_k)+\Delta(\alpha_k^\dagger \beta_k+\beta_k^\dagger \alpha_k)\right)+ \sum_k\xi(k)
$$
Where $\xi(k)$ and $A(k)$ are functions of $k$ and $\alpha_k$ and $\beta_k$ are fermionic operators. Now, I know that the tight-binding Hamiltonian with a periodic potential is given by eqn. 3.128:
$$
H=\sum_{k}\bigg( A(k)(\beta_k^\dagger \beta_k-\alpha_k^\dagger \alpha_k)+V(\alpha_k^\dagger \beta_k+\beta_k^\dagger \alpha_k)\bigg)
$$ | {
"domain": "physics.stackexchange",
"id": 59027,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "condensed-matter, superconductivity, fermions, many-body, second-quantization",
"url": null
} |
ros, gazebo-9
Originally posted by teshansj on Gazebo Answers with karma: 5 on 2020-06-12
Post score: 0
Original comments
Comment by nlamprian on 2020-06-12:
Check that ros-melodic-gazebo-ros-pkgs is installed.
Comment by teshansj on 2020-06-13:
That was the problem. Thank you. Please add it as an answer
Comment by KansaiRobot on 2021-03-07:
I am having the same problem. Once you solved it in what topic did you publish so as to make the robot move? Oh found it. it was cmd_vel
Judging from the topic list, the gazebo plugins are not running, which means they were not found when loading the turtlebot model. Install the ros-melodic-gazebo-ros-pkgs package.
Originally posted by nlamprian with karma: 833 on 2020-06-13
This answer was ACCEPTED on the original site
Post score: 1 | {
"domain": "robotics.stackexchange",
"id": 4521,
"lm_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, gazebo-9",
"url": null
} |
move arou… Move the red point to move the center of rotation. A plane of symmetry must pass through. When we look at the above images of regular pentagon, it fits on to itself 5 times during a full rotation of 360 degrees. So, an isosceles triangle has rotational symmetry of order 1. 113 The order of rotational symmetry of a shape is the number of times it can be rotated around a full circle and still look the same. A square is in some sense “more symmetric” than The angle of turning during rotation is called the angle of rotation. They are called isosceles trapeziums as they have two equal sides like isosceles triangles. An object's degree of rotational symmetry is the number of distinct orientations in which it looks exactly the same for each rotation. Rotational Symmetry. Thus a square has a rotational symmetry of order 4 about its centre. A is the original image. What is the order of rotational symmetry of a scalene triangle ? Rotational Symmetry - Hexagon. Secondly, does a square | {
"domain": "gridserver.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9585377249197138,
"lm_q1q2_score": 0.8108677411321988,
"lm_q2_score": 0.845942439250491,
"openwebmath_perplexity": 440.5843512704106,
"openwebmath_score": 0.6536144018173218,
"tags": null,
"url": "https://s78299.gridserver.com/pq2r4/rotational-symmetry-of-a-square-e09066"
} |
ros, audio, audio-common
I launched both audio_capture and audio_play as per the tutorial
$ roslaunch audio_capture capture.launch
$ roslaunch audio_play play.launch
Problem and Troubleshooting
No sound output.
Both scripts launched without error.
I've verified that the nodes are connected using rxgraph
"rostopic echo audio" streams audio messages.
I can see the microphone input level bouncing, but the output level is doing nothing.
I've used sound_play to verify that I can play sounds and my volume settings are correct.
From what I can tell, everything should be working. But I still get no output. Any ideas on how to troubleshoot this?
Thanks,
-Brian
Originally posted by brianpen on ROS Answers with karma: 183 on 2012-01-26
Post score: 0
Have you tried the example in the turtlebot_sounds package?
Originally posted by Ryan with karma: 3248 on 2012-01-26
This answer was ACCEPTED on the original site
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 8009,
"lm_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, audio, audio-common",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.