text stringlengths 1 1.11k | source dict |
|---|---|
reference-request, pl.programming-languages, type-theory, lambda-calculus, dependent-type
Title: Preservation under Substitution with Telescopes In the simply typed lambda calculus, one can show the following result, known as "preservation under substitution":
If $\Gamma \vdash v : \tau_1$ and $(x : \tau_1) \vdash t : \tau_2$,
then $\Gamma \vdash [v/x]t : \tau_2 $. | {
"domain": "cstheory.stackexchange",
"id": 4498,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "reference-request, pl.programming-languages, type-theory, lambda-calculus, dependent-type",
"url": null
} |
ros, python, catkin-make, yaml, ros-kinetic
whereas apt-get gives me
python-yaml is already the newest version (3.11-3build1)
Does anyone have any idea how to fix this?
Originally posted by jnauta on ROS Answers with karma: 3 on 2018-01-22
Post score: 0
ROS - even Kinetic - officially supports Python 2 only, so mixing and matching with Python 3 is going to be messy at best.
A virtualenv could work, but you'll have to make sure that it's completely isolated from your Python 3 install.
Edit:
I believe that it was not stated that ROS only support Python 2
It will depend on how familiar you are with where this kind of info is typically found, but see REP-3 - Kinetic Kame.
See ros-infrastructure/rep#149 for some discussion about this (and how to handle the Python 3 migration).
I did the initial installation on a virtualenv running Python 3.
Did you install from sources or did you do a regular apt-get install? | {
"domain": "robotics.stackexchange",
"id": 29819,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, python, catkin-make, yaml, ros-kinetic",
"url": null
} |
Out[61]:
array([[[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1]],
[[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1]]], dtype=int16)
In [62]:
np.empty( (2,3) )
# use the values you computer stores at the moement
Out[62]:
array([[-1.49166815e-154, 2.32035730e+077, 1.48219694e-323],
[ 0.00000000e+000, 0.00000000e+000, 4.17201348e-309]])
In [63]:
#To create sequences of numbers, NumPy provides the arange function which is analogous to the Python built-in range, but returns an array.
np.arange( 10, 30, 5 )
Out[63]:
array([10, 15, 20, 25])
In [64]:
from numpy import pi
np.linspace( 0, 2, 9 ) # 9 numbers from 0 to 2
Out[64]:
array([0. , 0.25, 0.5 , 0.75, 1. , 1.25, 1.5 , 1.75, 2. ])
### Basic Operations¶
Arithmetic operators on arrays apply elementwise. A new array is created and filled with the result.
In [65]:
a = np.array( [20,30,40,50] )
a
Out[65]:
array([20, 30, 40, 50])
In [66]:
b = np.arange( 4 )
b
Out[66]:
array([0, 1, 2, 3])
In [67]:
c = a-b
c | {
"domain": "yongjunzhang.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9559813526452772,
"lm_q1q2_score": 0.8007490713626452,
"lm_q2_score": 0.8376199694135332,
"openwebmath_perplexity": 5730.180705893791,
"openwebmath_score": 0.29298263788223267,
"tags": null,
"url": "https://yongjunzhang.com/files/css/Lab9b.html"
} |
classical-mechanics, lagrangian-formalism, differential-geometry, momentum, hamiltonian-formalism
The fiber-derivative is a map $\mathbf{F}L:TQ\to T^*Q$, and we have that for each $\xi_a\in T_aQ$, the object $(\mathbf{F}L)_{\xi_a}\in T_a^*Q$ is a covector, which in terms of coordinate charts can be written as $(\mathbf{F}L)_{\xi_a}=\frac{\partial L}{\partial v^i}\big\rvert_{\xi_a}\cdot (dx^i)_{a}$. Or, as an equality of maps,
\begin{align}
(\mathbf{F}L)\bigg|_{TU}&=\frac{\partial L}{\partial v^i}\cdot ((dx^i)\circ \pi_{TQ}).
\end{align}
Note the order of brackets, and composition.
Note also that since $\mathbf{F}L$ takes values in $T^*Q$, we need to use the basis covectors $dx^i$, where $x^i$ are coordinate functions defined on the base manifold (as opposed to $dq^i$). | {
"domain": "physics.stackexchange",
"id": 92541,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "classical-mechanics, lagrangian-formalism, differential-geometry, momentum, hamiltonian-formalism",
"url": null
} |
ros, node
Title: Ctrl +C can't kill the node
However , I wrote a UDP_server to keep receive massage ,and the receive funcion is in the while(ros::ok()),but when I press ctrl +C , the process doesn't shut down . what's going wrong ?
Originally posted by Tomas yuan on ROS Answers with karma: 56 on 2017-03-28
Post score: -1 | {
"domain": "robotics.stackexchange",
"id": 27446,
"lm_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, node",
"url": null
} |
strings, vb.net
MessageBox.Show(String.Format("Number of alphabets : {0}", alphaCount))
MessageBox.Show(String.Format("Number of numerics : {0}", numericCount)
End Sub
Using LinQ:
Although not always the best option, you can achieve the same result using LinQ, using the Enumerable.Count method:
Dim alphaCount = input.Count(Function(c) Char.IsLetter(c))
Dim numericCount = input.Count(Function(c) Char.IsDigit(c))
Here's the complete code using LinQ:
Public Sub CountAlphaNumericUsingLinQ(ByVal input As String)
Dim alphaCount = input.Count(Function(c) Char.IsLetter(c))
Dim numericCount = input.Count(Function(c) Char.IsDigit(c))
MessageBox.Show(String.Format("Number of alphabets : {0}", alphaCount))
MessageBox.Show(String.Format("Number of numerics : {0}", numericCount))
End Sub | {
"domain": "codereview.stackexchange",
"id": 11878,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "strings, vb.net",
"url": null
} |
python, performance, algorithm, numpy
"""Phase I setup"""
A[[i for i in range(m) if b[i] < 0]] *= -1 # Change sign of constraints
b = np.abs(b) # Idem
A_I = matrix(np.concatenate((A, np.identity(m)), axis=1)) # Phase I constraint matrix
x_I = np.concatenate((np.zeros(n), b)) # Phase I variable vector
c_I = np.concatenate((np.zeros(n), np.ones(m))) # Phase I c_j vector
basic_I = set(range(n, n + m)) # Phase I basic variable set
"""Phase I execution"""
print("Executing phase I...")
ext_I, x_init, basic_init, z_I, _, it_I = simplex_core(A_I, c_I, x_I, basic_I, rule)
# ^ Exit code, initial BFS, basis, z_I, d (not needed) and no. of iterations
print("Phase I terminated.") | {
"domain": "codereview.stackexchange",
"id": 32582,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, performance, algorithm, numpy",
"url": null
} |
divide radicals 1 simplify by rationalizing. rational exponents pdf.rational exponents and radical form puzzle.radical These are multiple choice so it makes it that much easier. Step 2: Distribute (or FOIL) both the numerator and the denominator. The denominator contains a radical expression, the square root of 2. √25/√2 √2/2 5√2/2 3√2/2 2.) Machine Learning Exam Questions and Answers... Ce site Web vise à fournir aux étudiants : des Cours des Livres Gratuits , des TD , des Examens et Exercices Corrigés en Informatique (Programmation et Réseaux) , Math , Physique ,Chimie, Economie et Gestions . Python Exercises with Solutions. Question 7b of 10 ( 3 Rationalizing Denominators 735328 ) Maximum Attempts: 1 Question Type: Multiple Choice Maximum Score: Question: Which choice is equivalent to the fraction below when x 2 1? Services, Algebraic Numbers and Transcendental Numbers, Quiz & Worksheet - Rationalize the Denominator with a Radical Expression, How to Rationalize the Denominator with | {
"domain": "dutadamai.id",
"id": null,
"lm_label": "1. Yes\n2. Yes\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9273632896242073,
"lm_q1q2_score": 0.8105871401881236,
"lm_q2_score": 0.8740772351648677,
"openwebmath_perplexity": 2172.775275415746,
"openwebmath_score": 0.673582911491394,
"tags": null,
"url": "https://dutadamai.id/seven-signs-slrxzdb/6o1eqv.php?956e80=rationalizing-the-denominator-multiple-choice"
} |
# recurrence initial conditions
I'm working on a homework assignment involving recursion and I'm having trouble finding an easy way to determine the initial conditions. Heres the problem:
We want to tile ann×1 strip with tiles of three types: 1×1 tiles that are dark-blue, light-blue,and red; 2×1 green tiles, and 3×1 sky-blue tiles. Now give a formula with initial conditions for the number of tilings, considering that blue tiles cannot be next to each other.
I can understand that the recurrence equation is:
$$B_n = B_{n-1}+3B_{n-2}+2B_{n-3}+B_{n-4}+B_{n-5}$$
And I've found initial conditions for
$$B_0=1$$ $$B_1 = 3$$ $$B_2 = 6$$ $$B_3 = 17$$
However, I found these but actually writing down all the possible combinations of tiles, but $$B_4$$ is a huge possible list. Is there some method of combinatorics or permutations I can use to find the initial conditions for $$B_4$$? | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9740426473232578,
"lm_q1q2_score": 0.8008472794159238,
"lm_q2_score": 0.8221891327004132,
"openwebmath_perplexity": 418.70163883255003,
"openwebmath_score": 0.9999197721481323,
"tags": null,
"url": "https://math.stackexchange.com/questions/3547709/recurrence-initial-conditions"
} |
thermodynamics, entropy, reversibility
In order to respond to @Nasu answer you should edit it to say "change in entropy". The way you word it now suggests entropy is itself a process, which it is not (as I believe @Nasu is trying to tell you).
That said, the change in entropy of the system for a reversible process can be zero, greater than zero, or less than zero, depending on whether there is (1) no heat transfer (e.g., reversible adiabatic process), (2) heat transfer into the system (e.g., reversible isothermal expansion process), or (3) heat transfer out of the system (e.g., reversible isothermal compression), respectively. It is the total entropy change of the system plus its surroundings that is zero for any reversible process, and greater than zero for an irreversible process.
then its subsequent counterpart (irreversible process) should have 0
entropy.
It's not clear to me what you mean by "its subsequent counterpart". Subsequent to what? Counterpart of what? | {
"domain": "physics.stackexchange",
"id": 92510,
"lm_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, entropy, reversibility",
"url": null
} |
quantum-field-theory, field-theory, terminology, path-integral, classical-field-theory
Title: "Classical field configuration" - QFT I often encounter the term "classical field configuration" in the scope of QFT, but I have a hard time interpreting what it really means.
If I understood it correctly, then a general field configuration is just an explicit form of a field, e.g. a free field $\phi(x)$. If this is correct, then I wonder what a classical configuration is exactly! A classical field configuration of a field $\phi(x)$ is just an explicit form for $\phi(x)$ that satisfies the equations of motion. | {
"domain": "physics.stackexchange",
"id": 86808,
"lm_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, field-theory, terminology, path-integral, classical-field-theory",
"url": null
} |
is met. Trefethen and David Bau III (SIAM, 1997). And they've generally been isomorphic (the same) and not particularly inspiring. There are about 230 problems with solutions. Note that Using Systems to Solve Algebra Word Problems can be found here in the Systems of Linear Equations and Word Problems section. Most with solutions. 25: The inverse of a general 2 2 matrix 1 Exercise 0. Practical Tips For A Better Ebook Reading. Well, let’s try this course format: Teach concepts like Row/Column order with mnemonics instead of explaining the reasoning. linear algebra stephen with best price and finish evaluation from a variety item for all item. Elementary Linear Algebra was written by Dr. Late homeworks will not be awarded any credit. Let A be the conjugate transpose of the complex matrix A; i. It requires little more than a foundation in algebra and geometry, yet it supplies powerful tools for solving problems in subjects as diverse as computer science and chemistry, business and biology, | {
"domain": "projectxitalia.it",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9867771782476948,
"lm_q1q2_score": 0.8223056988533766,
"lm_q2_score": 0.8333246015211008,
"openwebmath_perplexity": 872.5357602429608,
"openwebmath_score": 0.4449801445007324,
"tags": null,
"url": "http://projectxitalia.it/kvyn/linear-algebra-problems-and-solutions-pdf.html"
} |
why is my reasoning wrong UPDATE I noticed one mistake, so I corrected it but still dont get how to reach final solution
first day: 1 litre of juice +1 litre of water hence ratio---> 1:1 (total 2 litres)
Second day: 1 litres of juice +2 litres of water hence ratio---> 1:2 ( total 3 litres )
If ratio of mixture on day one to mixture on day two is 2 to 3 and price per glace on day one is 0.60
so i assume from this ratio $$2:3$$ that $$2$$ is 0.60 and what to do next if $$2$$ is 0.60 then what is $$3$$ how to calculate
or where am i wrong
VP
Joined: 09 Mar 2016
Posts: 1230
Re: On a certain day, orangeade was made by mixing a certain [#permalink]
### Show Tags | {
"domain": "gmatclub.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9615338101862454,
"lm_q1q2_score": 0.8012697652919633,
"lm_q2_score": 0.8333245870332531,
"openwebmath_perplexity": 2962.814225305419,
"openwebmath_score": 0.3879888951778412,
"tags": null,
"url": "https://gmatclub.com/forum/on-a-certain-day-orangeade-was-made-by-mixing-a-certain-133206.html"
} |
mathematical-physics, differential-geometry, gauge-theory, field-theory
2. Donaldson invariants
This section attempts to be a brief retelling of Witten's "Topological Quantum Field Theory"
2.1 Twisted $\mathcal{N}=2$ supersymmetric Yang-Mills theory
The physical setting in which the Donaldson invariants will appear is a Yang-Mills theory living on the four-dimensional manifold $M$ coupled to certain fields such that the total action enjoys a supersymmetry. The action of this theory looks admittedly horrible:
$$ S_\text{SYM} = \int_M \mathrm{Tr}_\mathfrak{g}\left(\frac{1}{4}F_{\mu\nu}F^{\mu\nu} + \frac{1}{4}F_{\mu\nu}(\ast F)^{\mu\nu} + \frac{1}{2}\phi D_\mu D^\mu \lambda - \mathrm{i}\eta D_\mu \psi^\mu + \mathrm{i}D_\mu\psi_\nu \chi^{\mu\nu} - \frac{\mathrm{i}}{8}\phi[\chi_{\mu\nu},\chi^{\mu\nu}] - \frac{\mathrm{i}}{2}\lambda[\psi_\mu,\psi^\mu] - \frac{\mathrm{i}}{2}\phi[\eta,\eta] - \frac{1}{8}[\phi,\lambda]^2 \right)\sqrt{g}\mathrm{d}^4 x$$ | {
"domain": "physics.stackexchange",
"id": 27041,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "mathematical-physics, differential-geometry, gauge-theory, field-theory",
"url": null
} |
python, beginner, numpy, pyside
# Set dialog layout
if self.load_flag is None:
self.setLayout(hor_layout)
return 1
class DigitDialog(QDialog):
def __init__(self, parent=None):
super(DigitDialog, self).__init__(parent)
# load data
self.data = DigitData()
v_layout = QVBoxLayout()
self.bar = QProgressBar()
self.button = QPushButton("View Digits")
self.button.clicked.connect(self.load_digits)
v_layout.addWidget(self.button)
v_layout.addWidget(self.bar)
self.setLayout(v_layout)
self.setFixedWidth(400)
# vars used in loading digits
self.scroll = None
self.dt = None
def load_digits(self):
# setup the button to stop the load if desired
self.button.setText("Quit Loading")
self.button.clicked.disconnect()
self.button.clicked.connect(self.quit_load) | {
"domain": "codereview.stackexchange",
"id": 36117,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, beginner, numpy, pyside",
"url": null
} |
2 2σ2!, σ > 0. t = draw. A Kernel is a function that returns the inner product of a function applied to two arguments. A "kernel" is a function which gives the similarity between individual elements in two sets, i. In these methods the Gram matrix plays an important role. d(˘;) If ispositive de nite, distribution has density on Rd. Rudolph Triebel Computer Vision Group Machine Learning for Computer Vision Examples of Valid Kernels •Polynomial Kernel: •Gaussian Kernel: •Kernel for sets: •Matern kernel:!17 k(x i, x j)=(xT i x j + c) d c>0 d 2 N k(x i, x j)=exp(kx i x. xj not only depends on the ambient coordinates of xi and xj,but also on geometric properties of the set XD. The great advantage of kernels is that they can also be constructed when {$\mathbf{x}$} is not a pre-defined vector of features, but instead some complex object, like an image or a set of items, or a sequence or a graph. The Gaussian kernel function is defined as:. The Gaussian blur can be seen as a refinement of the | {
"domain": "gipad.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9843363512883317,
"lm_q1q2_score": 0.8181243089519122,
"lm_q2_score": 0.8311430415844384,
"openwebmath_perplexity": 1156.4016423735295,
"openwebmath_score": 0.7524211406707764,
"tags": null,
"url": "http://gipad.it/ssmz/gram-matrix-gaussian-kernel.html"
} |
f#
// I am going to use the following type to hold the information
// from each section of the log.
type Section (lines:string list) =
member x.Lines = lines
// Read a single section from the top of the log (based on: http://fssnip.net/iV).
// val GetSection : lines:string list -> Section * string list
let GetSection (lines:string list) =
let rec getSection (l:string list) result =
match l with
| h::t when DivisibleByFive h ->
let values = h::result |> List.rev
(new Section(values), t)
| h::t when not (DivisibleByFive h) ->
getSection t (h::result)
| _ ->
(new Section(result), [])
getSection lines [] | {
"domain": "codereview.stackexchange",
"id": 8247,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "f#",
"url": null
} |
php, json
/**
* Update the block's data with a new one.
* Syntax: `$block->update('key1.key2.key3', $newData)`.
*
* @param string $key The key to replace the data.
* @param mixed $data The new data.
* @return void
*/
public function update(string $key, $newData)
{
$data = &$this->data;
$keys = explode('.', $key);
foreach($keys as $key)
{
if(isset($data[$key]))
$data = &$data[$key];
else
return;
}
$data = $newData;
} | {
"domain": "codereview.stackexchange",
"id": 42366,
"lm_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, json",
"url": null
} |
fourier-transform, fourier, decomposition
Title: Trying to decompose a signal into sine waves whose wavelengths aren't restricted to 1/N times sample range? I am trying to essentially do a Fourier transform - I want to fit some data with sine/cosine functions. At first I was trying to do this using FFT, but my problem is that the FFT algorithm doesn't seem to provide accurate information about the actual frequencies/wavelengths that are making up the data, i.e., all the wavelengths reported by the FFT are 1/N of the sample window (where N is an integer.)
But, say that the actual wavelength present is some non-integer quotient such as 1/3.5 times the sample window, etc.? Is there a better algorithm than FFT to fit a function with any-wavelength sine waves, instead of only restricting to specific wavelengths?
(I understand that to get a better fit, it probably won't be a fast algorithm like FFT - that is fine if it is a slow method, as long as it can accurately fit to find any arbitrary present frequencies.) | {
"domain": "dsp.stackexchange",
"id": 4095,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fourier-transform, fourier, decomposition",
"url": null
} |
homework-and-exercises, statistical-mechanics
which yielded the master equation
$$\partial_{t}P(n,t) = -(\lambda_n+\sigma_n)P(n,t) + \sigma_{n-1}P(n-1,t) + \lambda_{n+2}P(n+2,t) $$
I was wondering: is this correct? I am unable to check this result. After searching in several books, I found out that the expression is, indeed, correct. However, some authors prefer to absorve the $\frac{1}{2}$ in the definition of $\lambda$.
For future reference, after writing the Generating Function and simplifying, one should obtain
$$\partial_t \langle n(t) \rangle = \langle n(t) \rangle (\sigma + \lambda) - \lambda \langle n^2(t) \rangle$$
However, if absorving the factor as said above,
$$\partial_t \langle n(t) \rangle = \langle n(t) \rangle (\sigma + 2\lambda) - 2 \lambda \langle n^2(t) \rangle$$
This is practically the result we get by a qualitative analysis, in first order! | {
"domain": "physics.stackexchange",
"id": 75122,
"lm_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, statistical-mechanics",
"url": null
} |
quantum-field-theory, waves, conventions, fourier-transform, plane-wave
Edit: I used the mostly minus metric signature in this question. The notion of position space wavefunctions in Quantum Field Theory appears and reveals its usefulness in the context of the LSZ reduction formula. First I wish to emphasize that it has a different nature than in non-relativistic Quantum Mechanics. The reason is that there is no useful generalization of the position operators $X^i$ of non-relativistic QM to QFT. In the absence of those, we don't really have the position basis $|x\rangle$ and without it there is no sense in which we can construct an object $\psi(x)=\langle x|\psi\rangle$ which represents "the probability amplitude for a particle to be found at $x$". | {
"domain": "physics.stackexchange",
"id": 89114,
"lm_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, waves, conventions, fourier-transform, plane-wave",
"url": null
} |
quantum-mechanics, mathematical-physics, hilbert-space, dirac-delta-distributions
Title: Could two different bases of a Hilbert space have different cardinality? Here is a quote from http://en.m.wikipedia.org/wiki/Hilbert_space#Hilbert_dimension (accessed: Nov. 22, 2013) :
As a consequence of Zorn's lemma, every Hilbert space admits an orthonormal basis; furthermore, any two orthonormal bases of the same space have the same cardinality, called the Hilbert dimension of the space. | {
"domain": "physics.stackexchange",
"id": 10458,
"lm_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, mathematical-physics, hilbert-space, dirac-delta-distributions",
"url": null
} |
• Thanks for your detailed answer! I was wondering if my approach would work too? – user370967 Aug 5 '18 at 14:36
• Yes, of course, your approch works. I only wanted to round off the picture. – Paul Frost Aug 5 '18 at 14:44
• By the way, where did you find the second definition? – Paul Frost Aug 5 '18 at 14:45
• Thank you! I personally prefer this definition, but one hardly ever finds it in the literature. – Paul Frost Aug 5 '18 at 14:50
• I share your point of view. Perhaps you are interested in the discussion following this question: math.stackexchange.com/q/2830875 Most people seem to dislike the more general definition for functions defined on an arbitrary $E$ and prefer to regard $f$ as differentiable at a point $x \in E$ if there exist an open neighborhood $U$ of $x$ in $\mathbb{R}$ and a differentiable function $\hat f : U \to \mathbb{R}$ such that $\hat f \mid_{U \cap E} = f \mid_{U \cap E}$. In my eyes this is more a theorem than a definition. – Paul Frost Aug 5 '18 at 15:17 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9822877018151065,
"lm_q1q2_score": 0.8387879901697441,
"lm_q2_score": 0.8539127473751341,
"openwebmath_perplexity": 99.10788569939939,
"openwebmath_score": 0.9752528667449951,
"tags": null,
"url": "https://math.stackexchange.com/questions/2872828/show-that-this-definition-of-derivative-implies-the-other-one"
} |
distances, positional-astronomy, observational-astronomy, astrometry, star-cluster
If one knows the angle θ, he/she will be able to find the movement of the star and in the end, calculate it' s distance, through deduced relations beginning with $ v_t =v_r \tan θ.$
Question
I know the declination and the right ascension of both the star and the convergent point.
My problem as is to find the angle θ. In the exercise I have it is requested to find the angle between the star and the convergent point, that is θ , using spherical trigonometry. My mind goes on to using the cosine relationship:
$$ \cos a = \cos b \cos c + \sin b \sin c \cos A ,$$ for the triangle | {
"domain": "astronomy.stackexchange",
"id": 1563,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "distances, positional-astronomy, observational-astronomy, astrometry, star-cluster",
"url": null
} |
quantum-mechanics, homework-and-exercises, quantum-information, density-operator, time-evolution
\end{bmatrix} \right)\left( \sum_n^\infty \omega^{2n} \begin{bmatrix}
\frac{c^{2n}}{2n!} & \omega\frac{c^{2n+1}}{(2n+1)!}\\
0&0
\end{bmatrix} \right)$$
$$%= \sum_n^\infty \omega^{4n}\begin{pmatrix}\frac{c^{4n}}{\left(2n\right)!\left(2n\right)!}&\omega\frac{c^{4n+1}}{\left(2n\right)!\left(2n+1\right)!}\\ \omega \frac{c^{4n+1}}{\left(2n\right)!\left(2n+1\right)!}& \omega^2\frac{c^{4n+2}}{\left(2n+1\right)!\left(2n+1\right)!}\end{pmatrix} = \mathbf{\rho}(t_f)$$ Additionally to Norbert Schuch's answer and comments, where he points out your problem of normalization, I want to add a brief note about the exact calculations that can be performed in this example.
First, for convenience, I want to take the factor $\omega$ out of the definition of the Hamiltonian. Now we have to notice (you also stated it in a comment) that
$$ H^{n}=\begin{cases} |0\rangle\langle 0| + |1\rangle\langle 1| &\quad \text{for } n \text{ even} \\ H &\quad \text{for } n \text{ odd} \end{cases} \quad .$$ | {
"domain": "physics.stackexchange",
"id": 75281,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, homework-and-exercises, quantum-information, density-operator, time-evolution",
"url": null
} |
c#, beginner, array, statistics
THScore.Text = $"{_maxV}, {_maxS}";
TLScore.Text = $"{_minV}, {_minS}";
} I prefer to use explicit access modifiers -- it keeps everything uniform: you have internal int[][] JaggedArray so I'd make the others like _minV explicitly private. | {
"domain": "codereview.stackexchange",
"id": 15427,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, beginner, array, statistics",
"url": null
} |
ros
<inertial>
<mass value="0.5"/>
<origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
<inertia ixx="0.007601" ixy="0.0" ixz="0.0"
iyy="0.03009" iyz="0.0"
izz="0.024365"/>
</inertial>
<visual>
<geometry>
<box size="0.75 0.4 0.15" />
</geometry>
<material name="">
<color rgba="1.0 0.3 0.1 1.0"/>
</material>
</visual>
<collision>
<origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
<geometry>
<box size="0.75 0.4 0.15" />
</geometry>
</collision>
</link>
<gazebo reference = "Chassis">
<material> Gazebo/Orange </material>
</gazebo> | {
"domain": "robotics.stackexchange",
"id": 38456,
"lm_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
} |
it.information-theory, kolmogorov-complexity
Algorithmic mutual information is $I(B_1:B_2) = K(B_2) - K(B_2|B_1^*) = K(B_1) - K(B_1| B_2^*)$. This expression is accurate to within a constant independent of $B_1$ and $B_2$.
A Kolmogorov structure function for a bitstring $B$ is the set generating program $P_B$ such that $B$ is in the set $S_B$ generated by $P_B$ when given $n$ as input. The shortest $P_B$, such that $\ell(P_B) + \log_2(|S_B|) \leq K(B)$, is called the minimal Kolmogorov structure function, denoted by $P^*_B$. $\log_2(|S_B|)$ is close to the "randomness" in $B$ that cannot be captured by $P^*_B$.
In the case of a typical $B$ the length of $P^*_B$ is minimal, since knowing $n$ we can enumerate all bitstrings of length $n$ with a constant size program $C$. On the other hand, in the case of atypical $B$s, the length of $P^*_B$ may be significantly larger than $C$. | {
"domain": "cstheory.stackexchange",
"id": 4394,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "it.information-theory, kolmogorov-complexity",
"url": null
} |
general-relativity, tidal-effect
I believe that the force difference on an object can be so huge near to a black hole. I wonder if the person in free falling box to huge mass can feel any affect in the box or not?Can outside a rested observer observe a deformation on the box?
Can The General Relativity formulas calculate that increasing length of the box in a gravitational field even if the internal observer does not detect any change in the box ?
If the answer is yes,
Isn't it a contradiction with the length contraction of the special relativity because It states that the length will be getting less via the formula below.
$$L=L_0\sqrt{1-\frac{V^2}{c^2}}$$ where $L_0$ is rested lenght of object. | {
"domain": "physics.stackexchange",
"id": 16903,
"lm_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, tidal-effect",
"url": null
} |
ros, turtlebot, ros-master-uri
Originally posted by Solmaz on ROS Answers with karma: 3 on 2012-07-26
Post score: 0
Yes. You can use a resolvable wireless address as well, as long as both the workstation and the turtlebot can run something like ping turtle.dynamic.blabla.edu successfully.
If you followed the instructions here:
http://ros.org/wiki/Robots/TurtleBot/Network%20Setup, you can simply replace the IP_OF_TURTLEBOT with your resolvable address and re-run the instructions. This might cause duplicate entries in your ~/.bashrc file which you can manually edit to retain only the relevant entries.
Once you have done so, follow the instructions at the end of the Network setup page to verify connectivity.
Originally posted by piyushk with karma: 2871 on 2012-07-26
This answer was ACCEPTED on the original site
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 10379,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, turtlebot, ros-master-uri",
"url": null
} |
user 3.14159
In general, pgfplots is a great tool for 3d plots. This is certainly the case if you plot a single surface, as in this example. If you have multiple intersecting plots, then you may have to work harder (but according to how I read the manual, the future may bring some tools that do such things automatically). To produces this plot, all we need to do is to use polar coordinates and a simple trick for the vertical wall: cut of the radius function via rr(\x)=min(\x,1);. Notice also that the axes are autmomatically almost right, but this is because they happen to be so in this example, so we only have to fix a stretch of the z-axis. In general, pgfplots does not compute the intersections of the axes with the surfaces, so we do have to do that ourselves. Note also that this plot does not really highlight some of the very nice features of pgfplots such as colorful shading with interpolated colors. | {
"domain": "topanswers.xyz",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9230391727723469,
"lm_q1q2_score": 0.8083857032880143,
"lm_q2_score": 0.8757869948899665,
"openwebmath_perplexity": 1156.6963844118175,
"openwebmath_score": 0.8193881511688232,
"tags": null,
"url": "https://topanswers.xyz/tex?q=1635"
} |
beginner, c, calculator, bitwise, gtk
<property name="height_request">45</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="x">165</property>
<property name="y">115</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="bitmask">
<property name="width_request">81</property>
<property name="height_request">27</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Bit-Mask:</property>
</object>
<packing>
<property name="x">3</property>
<property name="y">71</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="bitmask_field"> | {
"domain": "codereview.stackexchange",
"id": 32446,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "beginner, c, calculator, bitwise, gtk",
"url": null
} |
c#, .net, linq, entity-framework
Title: Merge entities which have the same children The C# code below, using LINQ to Entities, aims to merge all Class entities which have the same SubjectId and the same Students.
var sb = new StringBuilder();
var counter = 0;
using (var ctx = new Ctx())
{
var allClasses = ctx.Classes.Where(o => o.SubjectId > 0).OrderBy(o => o.Id).ToList();
foreach (var c in allClasses)
ctx.LoadProperty(c, o => o.Students);
// For each class...
for (var i = 0; i < allClasses.Count; i++)
{
var c = allClasses[i];
var duplicates = allClasses
.Where(o => o.SubjectId == c.SubjectId && o.Id != c.Id &&
o.Students.OrderBy(s => s.Id).Select(s => s.Id)
.SequenceEqual(c.Students.OrderBy(s => s.Id)
.Select(s => s.Id)))
.ToList();
// Does it have any duplicates?
if (duplicates.Count == 0)
continue; | {
"domain": "codereview.stackexchange",
"id": 762,
"lm_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, linq, entity-framework",
"url": null
} |
• Thanks! It was indeed really a question of methodology, although I wasn't completely sure of the answer! The guessing method sounds like something that with practice would indeed save a lot of time.
– Dan
Nov 18, 2016 at 19:00
Everything is more or less correct about the way you approach the problem. You could have also opted for the middle term factorisation method or the method of vanishing method. However you have to correct one thing ...
Now factorise the rows and columns: $$x^2 + 1x = x(x+1)\\ x^2 + 3x = x(x+3)\\ 1x + 3=1(x+3)\\ 3x +3=1(x+3)$$
The last line ought to be $3x +3=3(x+1)$.
• Thank you! I've edited my post. Will look up the methods you've suggested, can never hurt to have more tools in the arsenal!
– Dan
Nov 18, 2016 at 19:01
• @DanB You're welcome. Nov 18, 2016 at 19:02 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9814534392852384,
"lm_q1q2_score": 0.8527130143481412,
"lm_q2_score": 0.8688267626522814,
"openwebmath_perplexity": 202.2672422360076,
"openwebmath_score": 0.9031533002853394,
"tags": null,
"url": "https://math.stackexchange.com/questions/2020321/factorise-fx-x34x2-3x"
} |
javascript, mysql, node.js
Here how I would proceed with the refactor.
I used the callback style (instead of async/await) since you are not using promises
I assume there is a db and a uploadDir global objects - since are not in the code example
router.delete('/:id', (req, res) => {
loadData(req.params.id, (err, files) => {
if (err) { return res.status(500).end(err.message) }
// if both query are successful delete from the database
deleteAll(req.params.id, (err) => {
if (err) { return res.status(500).end(err.message) }
res.redirect(303, '/admin/posts') // response to the client first
// the database deletion is OK, now delete the files quitely
const deleteFileArray = files.comment.concat(files.post)
deleteFiles(deleteFileArray, (err) => {
if (err) {
console.log('ops failed to delete files, but who cares?')
}
})
})
})
}) | {
"domain": "codereview.stackexchange",
"id": 39150,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, mysql, node.js",
"url": null
} |
sensors, ros, rangefinder, linux
Title: How to connect ethernet based Hokuyo scanner? This is a very basic beginner question, I know, but I am having trouble connecting to the Hokuyo UST-10LX sensor and haven't really found much in terms of helpful documentation online.
I tried connecting the Hokuyo UST-10LX directly to the ethernet port of a Lubuntu 15.04 machine. The default settings of the Hokuyo UST-10LX are apparently:
ip addr: 192.168.0.10
netmask: 255.255.255.0
gateway: 192.168.0.1
So, I tried going to the network manager and setting IPv4 settings manually, to have the ip addr be 192.168.0.9, netmask of 255.255.255.0, and gateway to 192.168.0.1. I also have a route set up to the settings of the scanner.
I then go into the terminal and run:
rosrun urg_node urg_node _ip_address:=192.168.0.10
and get this output:
[ERROR] [1444754011.353035050]: [setParam] Failed to contact master at [localhost:11311]. Retrying... | {
"domain": "robotics.stackexchange",
"id": 1209,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "sensors, ros, rangefinder, linux",
"url": null
} |
performance, python-3.x
Rewrite:
from fbprophet import Prophet
import pandas as pd
import numpy as np
from multiprocessing import Pool, cpu_count
def forecast_data(args):
(df, dealer, dates) = args
model = Prophet()
model.fit(df.loc[np.in1d(df.index, dealer)][['ds', 'y']])
return model.predict(dates)
if __name__ == "__main__":
df = pd.read_csv('X.csv', header=0, names=['ds', 'dealer', 'y'],
parse_dates=['y'], index_col="dealer")
date_range = pd.date_range('2020-11', '2024-12', freq='MS')
date_range = pd.DataFrame(date_range, columns=['ds'])
p = Pool(cpu_count())
results = pd.concat(
[result for result in p.imap(
forecast_data,
[(df, dealer, date_range) for dealer in df.index.unique()]
)])
results.to_csv('X2.csv') | {
"domain": "codereview.stackexchange",
"id": 39997,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "performance, python-3.x",
"url": null
} |
java, performance, integer
private int square(int x) {
final long x2 = x;
return (int) ((x2 * x2) % modulus); // The cast is safe and the result is surely non-negative.
}
/** Return a non-negative value less than modulus and congruent to the exact product. */
public int mul(long x, long y) {
return mul(mod(x), mod(y));
}
/** Return a non-negative value less than modulus and congruent to the exact product. */
public int mul(int x, int y) {
return mod((long) x * y);
}
/** Return a non-negative value less than modulus and congruent to the exact sum. */
public int add(int x, int y) {
return mod((long) x + y);
}
/** Return a non-negative value less than modulus and congruent to the exact difference. */
public int sub(int x, int y) {
return mod((long) x - y);
} | {
"domain": "codereview.stackexchange",
"id": 14366,
"lm_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, integer",
"url": null
} |
asymptotics
Title: Asymptotics of a logarithmic series Given that,
$T(n) = \sum_{i=2}^{n} \log_i n$
I need to find the asymptotic boundary of $T(n)$.
Answer given is $\theta(n)$.
Please provide explanation. First, the change-of-base formula may be helpful here:
$$
\log_b(x) = \frac{\ln x}{\ln b}
$$
Also, with sums I always find it helps to write out the sum explicitly, so let's do that:
$$
T(n) = \sum_{i=2}^{n} \log_i n
= \log_2(n) + \log_3(n) + \log_4(n) + \cdots + \log_n(n)
$$
Now if you want to show this is $\theta(n)$, there are two things: you should show it is lower bounded by $cn$, and it is upper bounded by $Cn$, for some constants $c$ and $C$. | {
"domain": "cs.stackexchange",
"id": 15578,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "asymptotics",
"url": null
} |
python, object-oriented, python-3.x, finance, sqlite
Title: OOP bank account program in Python 3 Python beginner here. Building an OOP bank account program with SQLite and starting to struggle a bit with its design. From a design standpoint I have a file (bank) which calls ATM. ATM simulates an ATM, and is the file which then calls bank_account or credit_card depending on the account data passed in from bank.
To initially setup an account I decided to put this into a different file, for example bank_account_setup or for credit_card, credit_card_setup. These would create_account, help setup pin etc so that the account is created and ready to use. Then the actual bank_account or credit_card contains other functions, like, deposit, withdraw, get_balance etc. Also, send_email is in another file | {
"domain": "codereview.stackexchange",
"id": 33753,
"lm_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-3.x, finance, sqlite",
"url": null
} |
ros, action, ros-kinetic, action-client
Title: Using a action's result
Hello together,
together with another student, we have written a action client and server by using actionlib/client/simple_action_client.h and actionlib/server/simple_action_server.h.
At the terminal we can see the result correctly.
Now we would like to use result for further activities. For this the source file of the client contains:
actionlib::SimpleActionClient<manipulator::DetectionAction>::ResultConstPtr result = *(ac.getResult())
ac is our action client, manipulator::DetectionAction is the ActionSpecs from the header file.
We have already started several attempts, but still are unsuccessful.
The compiler error is
actionlib::SimpleActionClient<manipulator::DetectionAction>::ResultConstPtr is private.
We would really appreciate, if someone could help us.
Thanks a lot!
Originally posted by waltejon on ROS Answers with karma: 5 on 2018-12-05
Post score: 0
What should work is the following:
DetectionResultConstPtr result = ac.getResult(); | {
"domain": "robotics.stackexchange",
"id": 32122,
"lm_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, action, ros-kinetic, action-client",
"url": null
} |
2) Is wrong and your function is a counter-example. $0$ is in fact a global maximum of your function.
3) You need more than that. Precisely, you must send $x$ and $y$ to $\pm\infty$ independently, as in $$\lim_{\|x\|_2 \to \infty} f(x_1, x_2)$$ Your particular function is very well behaved since $$f(x_1, x_2) = e^{-\|x\|_2^2}$$ So the above limit is indeed $0$. To prove that you have a global maximum, observe that $g(r) := e^{-r^2}$ satisfies $g'(x) < 0$ for $x > 0$ and $g(x) = 1$. Thus by some Calculus theorem on differential inequalities, $g$ satisfies $$g(x) \le 1 \quad \forall\ x > 0$$ and likewise you can show $g(x)\le 1 \forall\ x < 0$. You have now established that $0$ is a global maximum of $g$. Finally find $f(x) = g(\|x\|_2) \le 1$ to establis that $(0,0)$ is a global maximum of $f$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.966914017797636,
"lm_q1q2_score": 0.8237651030905573,
"lm_q2_score": 0.8519527982093666,
"openwebmath_perplexity": 163.4171353919832,
"openwebmath_score": 0.8889787793159485,
"tags": null,
"url": "https://math.stackexchange.com/questions/1426931/finding-global-maximizers-and-minimizers"
} |
time-series, lstm, preprocessing, forecasting
If you are interested in the relationship between time and observation-value, treating the entities as different batches could make sense, under the assumption that the role of individual entities doesn't really matter to you. In this case, you would, for example, add the mean of each entity (or the overall mean) to all entities with missing values to get a constant number of observations per entity. But you could also simply average all values in each timestamp and include other features as min & max. This would most probably deliver better results. | {
"domain": "datascience.stackexchange",
"id": 4948,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "time-series, lstm, preprocessing, forecasting",
"url": null
} |
matlab, lowpass-filter
As you can see, it gets rid of the pre-transient ringing, while introducing post-transient ringing. The post-transient ringing should not be a big issue. But, there is also a signal delay/distortion that becomes clear at the same time point across different conditions (red line). That can shift the absolute and relative timing of events in the signal.
Is there a way to compensate for that?
You are using a linear phase filter. These are non causal and hence you get pre-ringing at your transients. Use a minimum phase or IIR filter. Do NOT use filtfilt, since that makes an IIR filter linear phase again and you end up with the same problem | {
"domain": "dsp.stackexchange",
"id": 9457,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "matlab, lowpass-filter",
"url": null
} |
deep-learning
print(x.grad) # dz/dx
print(y.grad) # dz/dy
I get
<Tensor <LB (3, 3) op:MovementOps.RESHAPE> with grad None>
<Tensor <LB (1, 3) op:MovementOps.RESHAPE> with grad None>
I am on a Mac Studio running Ventura (13.0.1 (22A400)) using Python 3.10.8.
Am I missing some kind of low level driver or accelerator or something?
I am new to all of this (my first attempt to look at Deep Learning technology) so I don't understand what I am looking at. I see references to MovementOps in accel/opencl/ops_opencl.py so I'm thinking some kind of post processing step is missing? Its because of the repr() function in the Tensor class. Geohot has choosen numpy as backend for tinygrad so calling x.grad.numpy() will give you the result you want. | {
"domain": "datascience.stackexchange",
"id": 11408,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "deep-learning",
"url": null
} |
$$g(x) = \left\{\begin{matrix} y_m, & x < x_0 - \varepsilon \\ \frac{L-a}{1 + e^{-k(x-x_0)}}, & x_0-\varepsilon \leq x < x_0+ \varepsilon \\ y_M, & x \geq x_0 + \varepsilon\end{matrix} \right.$$
Here is an example of using this method with $m=2$, $\varepsilon=4$, $x_0=1$, $y_m=-2$, and $y_M=3$: | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9838471637570105,
"lm_q1q2_score": 0.8322780752901064,
"lm_q2_score": 0.8459424450764199,
"openwebmath_perplexity": 176.57176347320274,
"openwebmath_score": 0.8662092089653015,
"tags": null,
"url": "https://math.stackexchange.com/questions/2618459/transform-logistic-sigmoid-function"
} |
gazebo, navigation, rviz, amcl, move-base
What causes such a pattern/behavior?
Update Based on Comment:
Here are some of the config/params I am working with.
move_base node
<node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen">
<rosparam file="$(find robot)/config/costmap_common_params.yaml" command="load" ns="global_costmap" />
<rosparam file="$(find robot)/config/costmap_common_params.yaml" command="load" ns="local_costmap" />
<rosparam file="$(find robot)/config/local_costmap_params.yaml" command="load" />
<rosparam file="$(find robot)/config/global_costmap_params.yaml" command="load" />
<rosparam file="$(find robot)/config/base_local_planner_params.yaml" command="load" />
<param name="controller_frequency" value="10.0"/>
<param name="planner_frequency" value="10.0"/>
<remap from="cmd_vel" to="cmd_vel"/>
<remap from="odom" to="odom"/>
<remap from="scan" to="robot/laser/scan"/>
</node> | {
"domain": "robotics.stackexchange",
"id": 29413,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gazebo, navigation, rviz, amcl, move-base",
"url": null
} |
(Note that although exp(t) is defined for a Taylor series, it currently converts the arguments to floats.)
You can also bound the remainder using TaylorModels.jl.
1 Like
That’s a neat writeup of very relevant problems and methods from a giant in the field, but it is surprising how jaded and bitter the tone of the article is.
1 Like | {
"domain": "julialang.org",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9399133498259924,
"lm_q1q2_score": 0.8490182794193459,
"lm_q2_score": 0.9032942021480236,
"openwebmath_perplexity": 3790.1935699635287,
"openwebmath_score": 0.6842126846313477,
"tags": null,
"url": "https://discourse.julialang.org/t/difference-between-f-1-0e-7-f-1-0e-8/32779"
} |
c++, json, c++17
//clear the accumulated values
this->property_name_.str("");
this->scalar_value_.str("");
}
As long as you’re using string streams, copies are unavoidable (C++20 fixes this).
Instead, suppose property_name_ and scalar_value_ were strings. All the places you use operator<<, just use operator+= instead. And PushJValue() could become:
void ParserValueStack::PushJValue(JValueType type)
{
optional<JValue> new_value; | {
"domain": "codereview.stackexchange",
"id": 38461,
"lm_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++, json, c++17",
"url": null
} |
javascript, animation, svg, d3.js
Title: D3.js interpolating line on circumference of circle For now, I've tried to make a line rotate on the path of a circle, but used setInterval multiple times and there might be other ways of achieving the same.
I would like your thoughts before I add two more circles just like in this webpage.
var width = 300;
var height = 300;
var body = d3.select("body")
var svg = body.append("svg")
.attr("width",width)
.attr("height",height)
.attr("fill","blue")
var rad = Math.PI;
var circlePath = svg.append("path")
.attr('d', "M70,100a30,30 0 1,0 60,0a30,30 0 1,0 -60,0")
.attr('fill', 'none')
.attr('stroke', 'steelblue' )
// var path = <path d="M70,100a30,30 0 1,0 60,0a30,30 0 1,0 -60,0"/>
console.warn(circlePath.node());
var path1 = circlePath.node(); | {
"domain": "codereview.stackexchange",
"id": 13195,
"lm_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, animation, svg, d3.js",
"url": null
} |
of the commonly used Indefinite Integrals. Differentiation and integration of simple functions . 68-70. BASIC ANTIDERIVATIVE FORMULAS YOU REALLY NEED TO KNOW !! ex dx = ex +C ax dx = ax lna +C 1 x dx =ln|x| +C cosxdx=sinx+C sec2 xdx=tanx+C sinxdx= TABLE OF LAPLACE TRANSFORM FORMULAS L[tn] = n! s n+1 L−1 1 s = 1 (n−1)! tn−1 L eat = 1 s−a L−1 1 s−a = eat L[sinat] = a s 2+a L−1 1 s +a2 = 1 a sinat L[cosat] = s s 2+a L−1 s s 2+a = cosat Differentiation and integration L d dt f(t) = sL[f(t)]−f(0) L d2t dt2 f(t) = s2L[f(t)]−sf(0)−f0(0) L dn dtn f(t) = snL[f(t)]−sn−1f Applications of trigonometry are also found in engineering, astronomy, Physics and architectural design. Several examples, with detailed solutions, involving products, sums and quotients of exponential functions are examined. Tangent Line. In this chapter, you will learn how to evaluate limits and how they are used in the two basic problems of calculus: the Chapter 3: Differentiation Formulae: Introduction. We can easily obtain | {
"domain": "brian229.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9891815503903562,
"lm_q1q2_score": 0.8285582199824016,
"lm_q2_score": 0.8376199694135333,
"openwebmath_perplexity": 830.7896849780968,
"openwebmath_score": 0.876122772693634,
"tags": null,
"url": "http://brian229.com/8vpu/differentiation-formulas-and-examples-pdf.php"
} |
hilbert-space, quantum-information, density-operator, trace
Title: Proof of strong convexity of trace distance I'm trying to follow the Nielsen and Chuang proof (equation 9.49 of Chapter 9, page 408). I reproduce it here for completeness.
With trace distance defined as $D(\rho, \sigma) = \frac{1}{2}tr(|\rho - \sigma|)$, it is known that there exists a projector $P$, such that $D(\rho, \sigma) = tr(P(\rho-\sigma))$. We wish to prove a result for a probabilistic mixture of states, $\sum_i p_i\rho_i$ and $\sum_i q_i\sigma_i$.
There exists a projector $P$ such that
$\begin{align}
D\left(\sum_i p_i\rho, \sum_i q_i\sigma\right) &= \sum_i p_i tr(P\rho_i) - \sum_i q_i tr(P\sigma_i) \\
&=\sum_i p_i tr(P(\rho_i - \sigma_i)) + \sum_i (p_i - q_i) tr(P\sigma_i) \\
&\leq \sum_i p_i D(\rho_i,\sigma_i) + D(p_i,q_i)
\end{align}
$
Here, $D(p_i,q_i)$ is the classical probability distance given by $D(p_i,q_i) = \frac{1}{2}\sum_i |p_i - q_i|$ for any pair of probability vectors. | {
"domain": "physics.stackexchange",
"id": 60407,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "hilbert-space, quantum-information, density-operator, trace",
"url": null
} |
waves, signal-processing
When these two are combined by a process called modulation the resulting voltage is of the form,
$V_{\rm am}(t) = A \sin(2\pi f_c t) + B\sin\left(2\pi \left[f_c + f_m\right] t\right) + B\sin\left(2\pi \left[f_c - f_m\right] t\right)$
which you will note is the sum of,
the carrier, $A \sin(2\pi f_c t)$, of frequency $f_{\rm c}$
the upper side band, $B\sin\left(2\pi \left[f_c + f_m\right] t\right)$, of frequency $f_{\rm c}+f_{\rm m}$
the lower side band, $B\sin\left(2\pi \left[f_c - f_m\right] t\right)$, of frequency $f_{\rm c}-f_{\rm m}$
So the side bands are the voltages above and below the carrier frequency which appear as the result of the modulation process. | {
"domain": "physics.stackexchange",
"id": 90554,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "waves, signal-processing",
"url": null
} |
c#, meta-programming, rubberduck
var implementsLine = module.CountOfDeclarationLines + 1;
module.InsertLines(implementsLine, "Implements " + _model.InterfaceName);
_state.RequestParse(ParserState.Ready);
var qualifiedSelection = new QualifiedSelection(_model.TargetDeclaration.QualifiedSelection.QualifiedName,
new Selection(implementsLine, 1, implementsLine, 1));
var implementInterfaceRefactoring = new ImplementInterfaceRefactoring(_state, _editor, new MessageBox());
implementInterfaceRefactoring.Refactor(qualifiedSelection);
}
private string GetInterface()
{
return "Option Explicit" + Environment.NewLine + string.Join(Environment.NewLine, _model.Members.Where(m => m.IsSelected));
}
}
And the support classes, InterfaceMember and Parameter:
public class Parameter
{
public string ParamAccessibility { get; set; }
public string ParamName { get; set; }
public string ParamType { get; set; } | {
"domain": "codereview.stackexchange",
"id": 17580,
"lm_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#, meta-programming, rubberduck",
"url": null
} |
black-hole
Title: How many wandering black holes are there in the milky way? I have attempted to research this topic due to curiosity, but I have yet to find a credible answer, the best I could find is this article, which has no listed sources, and the author has also done similar "click bait" style headlines with little to no evidence. Yes as StephanG said there are thought to be 100 million black holes in our galaxy composed of approximately 100 billion stars. Most of these are thought to be stellar mass black holes. Not the super massive black hole assumed to be at the center of our galaxy. Some references are:http://hubblesite.org/explore_astronomy/black_holes/encyc_mod3_q7.html and https://www.sciencenews.org/article/we-share-milky-way-100-million-black-holes. | {
"domain": "astronomy.stackexchange",
"id": 2420,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "black-hole",
"url": null
} |
observatory, resource-request
Any help will be well received. "Virtual Observatory" is a catchall phrase basically for a place any scientist can publish their data (ie. tables in their papers) or for hosting databases (such as the latest releases of major survey measurements) which comply with TAP protocols and so can be easily communicated with using a variety of astronomical data analysis programs.
There are many many virtual observatories, here, for example, is the German Virtual Observatory, which is run by the excellent people in Heidelberg: http://www.g-vo.org/
They have a link describing the data publishing process here: http://www.g-vo.org/pmwiki/About/PublishYourData
Usually what this entails is putting your data, such as tables from your paper, into a universal format, like VOTable. This type of table is readily accessed by astronomy data analysis tools such as TopCat (or Aladin, like you mentioned): http://www.star.bris.ac.uk/~mbt/topcat/ | {
"domain": "astronomy.stackexchange",
"id": 2224,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "observatory, resource-request",
"url": null
} |
object-oriented, api, lua, minecraft, turtle-graphics
Title: Building a 64 × 64 particle accelerator frame in Minecraft with a computercraft turtle I dont think this will work anywhere besides in minecraft with computercraft but it's all correct syntax. I just feel like it has some lines of code I could eliminated somehow and made it a cleaner script. I appreciate any constructive criticism to help me further understand what I'm misunderstanding.
function placef()
turtle.select(1)
x = 1
if turtle.getItemCount(x) == 0 then
repeat turtle.select(x+1)
x = x + 1
if x == 17 then
x = 1
y = 2
end
if y == 2 then
os.reboot()
end
until turtle.getItemCount(x) > 0
end
turtle.place()
end
function placeup()
turtle.select(9)
x = 9
if turtle.getItemCount(x) == 0 then
repeat turtle.select(x+1)
x = x + 1
if x == 17 then
x = 9
y = 2
end
if y == 2 then
os.reboot()
end
until turtle.getItemCount(x) > 0
end
turtle.placeUp()
end
function place()
turtle.select(9) | {
"domain": "codereview.stackexchange",
"id": 31997,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "object-oriented, api, lua, minecraft, turtle-graphics",
"url": null
} |
c#, wpf, xaml
/// <typeparam name="T">The type of the queried item.</typeparam>
/// <param name="childName">x:Name or Name of child. </param>
/// <returns>The first parent item that matches the submitted type parameter.
/// If not matching item can be found,
/// a null parent is being returned.</returns>
/// <remarks>
/// https://stackoverflow.com/a/1759923/1188513
/// </remarks>
public static T FindChild<T>(this DependencyObject parent, string childName)
where T : DependencyObject
{
if (parent == null) return null; | {
"domain": "codereview.stackexchange",
"id": 6645,
"lm_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#, wpf, xaml",
"url": null
} |
data-structures, search-trees, balanced-search-trees
Title: Balancing a Binary Search Tree I was reading about binary search trees on it's Wikipedia article. I was a little confused by this image. Why is it that the right branch to the head node does not have a sub-tree? I understand why it can be valid like this but surely the "8" could branch to "13" instead, then "10" and "14" could become the descendants of "13". It seems like this would be far more balanced. So I researched around for more information about binary search tree balancing and I'm still unsure. Why is the diagram in the Wikipedia article was favored? Is my suggestion wrong?
Depth-first in-order traversal still works as I presume the same for all other traversal methods. Yes, the right subtree could be $13(10,14)$. | {
"domain": "cs.stackexchange",
"id": 3578,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "data-structures, search-trees, balanced-search-trees",
"url": null
} |
java, unit-testing, mocks
Note this is just a sample. Normally we would use a spring MVC for unit testing a REST service.
But is the use of anyString() valid. Does it mean we are being too broad with the mocking criteria?
Is there anything else that is wrong with this style? Well, what you do not actually test is: Are the login parameters passed to the LoginService correctly? In your example, you are simply assuming that the next login will fail or succeed, but you do that completely ignoring the actual parameters.
Especially for the successfull test I would use the actual expected parameters instead of anyString. For the not successfull test you could do the same, return a result with false if the login data is the expected value (otherwise it will be null).
This way you don't just test the way the LoginRestService handles the responses from the LoginService, but also that the LoginRestService gives the correct parameters to the LoginService in the first place, eliminating one possible cause of errors. | {
"domain": "codereview.stackexchange",
"id": 15401,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, unit-testing, mocks",
"url": null
} |
c#, multithreading, task-parallel-library
On a side note, doThreadedQuery is a rather unfortunate name because
.NET method names should be PascalCase, not camelCase;
There's no “query” being performed, you're just scheduling an operation. | {
"domain": "codereview.stackexchange",
"id": 5561,
"lm_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#, multithreading, task-parallel-library",
"url": null
} |
python, python-3.x, matrix, chess
This is the most concise way of writing it that I've found, without compromising clarity. The in for comparison and int for incrementing the count each save us a few lines of code.
But, it's still really verbose and repetitive. Each of the for loops are essentially doing the same exact thing, just in a different direction.
This comes up in every matrix question, whether it's just linear checks like above, BFS, DFS, they pretty much all have a four-directional comparison and traversal that produces 4 copies of code that are all identical in function.
Is there a less verbose way of writing these, without being overly fancy and hard-to-read? Dimensions
How big is your chess board, and is it square, or at least rectangular?
First, you use range(len(board)) to determine the rows of the chess board, but then you use range(len(board[r])) for the columns, which means you can handle each row having a different number of columns! | {
"domain": "codereview.stackexchange",
"id": 35429,
"lm_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, matrix, chess",
"url": null
} |
gauge-theory
$$A'_\mu(g \phi)=g A_\mu \phi - (\partial_\mu g) \phi$$
$$A'_\mu g =g A_\mu - (\partial_\mu g)$$
$$A'_\mu =g A_\mu g^{-1} - (\partial_\mu g) g^{-1}$$
And I know it is not the good sign on the second part of the rhs of last line. So there is a mistake in my logic somewhere, but I don't know where. | {
"domain": "physics.stackexchange",
"id": 45125,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gauge-theory",
"url": null
} |
ros, action, ros-kinetic
Isn't that exactly the point of actions, that they are long running? Does that mean that the fibonnaci example is actually bad practice?
The under-the-hood description continues to say:
Upon construction of the simple action server, the user decides whether or not to spin up an extra thread to allow for taking long running actions in a goal callback.
I don't see this in the SimpleActionServer constructor. It has a boolean to choose autostarting, but nothing about spinning a separate thread.
This is an option in the SimpleActionClient, but its use is discouraged anyway.
So what is the recommended approach?
Should I only check for the legality of the goal and then setAccepted in the goal callback and then do the real work in my main thread (while(ros::ok() { ... }))? *
Or should/can I do the work in the goal callback (as the fibonnaci example does)? If I do that, will my feedback be sent and will I receive preemptions?
Thanks
EDIT: | {
"domain": "robotics.stackexchange",
"id": 30173,
"lm_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, action, ros-kinetic",
"url": null
} |
amateur-observing, jupiter, radio-astronomy, natural-satellites
Antenna is of course merely one part of the story. Second thing that is required is the receiver. NASA is sponsoring Radio JOVE project with an assembly manual for roughly 100 electronic components and pieces of hardware worth RJ1.1 Receiver (Radio Jove 1.1 Receiver) that can be almost completely assembled out of parts ordered from Radio Shack (it even includes RS part numbers). I'll add a photograph and a few other links, and you'll have to be on your own then:
Self-assembled Radio Jove Receiver's front plate with two turning knobs for volume and tuning. Source: KB0LQJ Observatory
Some relevant links for building Radio Jove (or Jupiter FM, if you like, it will be your own receiver so name it as you wish), starting with already mentioned ones:
Amateur Radio Astronomy Projects — Radio Signals from Jupiter (PDF) | {
"domain": "astronomy.stackexchange",
"id": 3626,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "amateur-observing, jupiter, radio-astronomy, natural-satellites",
"url": null
} |
navigation, costmap-2d-ros, costmap, costmap-2d
Originally posted by mgruhler with karma: 12390 on 2015-07-06
This answer was ACCEPTED on the original site
Post score: 3
Original comments
Comment by mattc_vec on 2015-07-08:
Yeah, I completed that tutorial. I've managed create the new layer by specifying a plugins array in a .yaml file I load in the roslaunch file. This plugins array overwrites the existing one, and erases the static, inflation, and obstacle layers.
Comment by mattc_vec on 2015-07-08:
Is there any way to add the new layer to the existing plugins array? If I specify these layers in the yaml as well, they use the default cost_scaling_factor and inflation radius, which I don't want.
Comment by David Lu on 2015-07-08:
There is no way to just add to the existing plugins. However, if you start the costmap without using the new yaml file, it will set up your parameter space with the new style parameters, listing the existing layers and moving the parameters for cost_scaling_factor, etc. Copy that to your launch file | {
"domain": "robotics.stackexchange",
"id": 22089,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "navigation, costmap-2d-ros, costmap, costmap-2d",
"url": null
} |
complexity-theory, np-complete, satisfiability
Title: What is a dichotomy? Whether 2-SAT itself is a dichotomy of SAT? Recently, I am reading papers about dichotomy. I do not understant what condition can be called as a dichotomy? What is the meaning of "a question is either in P or in NP-complete"? (assume P $\neq$ NP)
For example, I've known the Schaefer's dichotomy theorem, in which a dichotomy about "whether a class of SAT is in P" is given. In this theorem, the dichotomy contains six conditions, one of them is "2-SAT". | {
"domain": "cs.stackexchange",
"id": 2125,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "complexity-theory, np-complete, satisfiability",
"url": null
} |
evolution, bioinformatics
Title: Molecular Evolution: Mrbayes never stops? When I use my own data to build Bayesian phylogenetic trees using the software Mrbayes, after many generations, it never reaches stopping status (namely, the average standard deviation of split frequencies below 0.01).
What should I do to get to this point?
The dtype is protein, 37 taxa were included, the model I used was as follows:
prset aamodel=fixed(wag);
lset rates=Invgamma;
mcmc ngen=100000 samplefreq=100 There are a few things you can try to get better convergence. I'd try the following in increasing order of difficulty/effort/processing time. | {
"domain": "biology.stackexchange",
"id": 1356,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "evolution, bioinformatics",
"url": null
} |
gauge-theory, differentiation, lie-algebra, gauge-invariance, yang-mills
Title: Gauge invariance doesn't actually force usual choice of covariant derivative? As we all know, a gauge invariant theory is of the form
$$ \mathcal{L} = \bar{\psi} \gamma^\mu \left( i\partial_\mu + A_\mu^a T^a\right) \psi.$$
The multiplet $\psi$ and gauge field $A_\mu = A^a_\mu T^a$ transform as follows under a gauge transformation:
$$\psi \rightarrow G \psi, \quad \quad A_\mu \rightarrow G A_\mu G^{-1} - (\partial_\mu G) G^{-1},$$
where $G(x)$ is an element of the gauge group.
I know that $T^a$ are supposed to be the generators of the gauge group, i.e. they are a basis for the associated Lie Algebra. However, it seems to me that actually this fact is not essential for $\mathcal{L}$ to be gauge invariant! I mean, any old matrices $T^a$ will do; we just say that under a 'gauge transformation' $A_\mu$ transforms as above. | {
"domain": "physics.stackexchange",
"id": 66068,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gauge-theory, differentiation, lie-algebra, gauge-invariance, yang-mills",
"url": null
} |
slam, navigation, odometry, kinect, rosjava
Original comments
Comment by Juan Antonio Breña Moral on 2012-01-24:
I have to read odometry tutorial again. Many thanks.
Comment by Hansg91 on 2012-01-22:
Actually, the odometry tutorial also publishes tf messages, so that should be enough. I did forget to tell you something and I edited my answer with extra info.
Comment by Juan Antonio Breña Moral on 2012-01-22:
I read in the tutotial about navigation stack: http://www.ros.org/wiki/navigation that it is necessary to use tf messages but you didn't say anithing about it. Tell me your experince
Comment by Juan Antonio Breña Moral on 2012-01-22:
I read in the tutotial about navigation stack: http://www.ros.org/wiki/navigation that it is necessary to use tf messages but you didn't say anithing about it. Tell me your experince
Comment by Juan Antonio Breña Moral on 2012-01-22: | {
"domain": "robotics.stackexchange",
"id": 7951,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "slam, navigation, odometry, kinect, rosjava",
"url": null
} |
black-holes, astronomy, astrophysics, galaxies
That said, it is becoming possible using very long baseline interferometry to take "pictures" of a couple of nearby black holes. I don't think there are any successful images yet, but we'll probably get some in the next 3 years or so using the Event Horizon Telescope. A prediction of what will be seen: | {
"domain": "physics.stackexchange",
"id": 15142,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "black-holes, astronomy, astrophysics, galaxies",
"url": null
} |
entomology, ethology, parasitology, ant, parasitism
http://www.butterflycircle.com/checklist/showbutterfly/224
http://www.samuibutterflies.com/insects/butterflies/lycaenidae/liphyrabrassolisbrassolis/
The only credible evidence that the adult Phengaris are threatened by the ants is that one, unsupported statement on David Nash's University of Copenhagen webpage. I have emailed Dr. Nash, but have not received a reply. Nevertheless, I am convinced that the claim is not correct.
By contrast, we have a great deal of evidence that the various Phengaris species are not in any danger from the ants after emerging from their pupae, and neither have nor need a defence mechanism based on loose scales. I am confident enough in this that I am posting it as my answer. | {
"domain": "biology.stackexchange",
"id": 10283,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "entomology, ethology, parasitology, ant, parasitism",
"url": null
} |
16. Still not sure how to plot a histogram in Python? If so, I’ll show you the full steps to plot a histogram in Python using a simple example. qqplot(x) displays a quantile-quantile plot of the quantiles of the sample data x versus the theoretical quantile values from a normal distribution. In other words, we are looking for the absence of pattern! Any type of pattern exhibited in a residual plot. Prism 8 (right graph below) is much smarter about this, so the default graphs look better, and do a much better job showing the distribution of the. Making a box plot itself is one thing; understanding the do’s and (especially) the don’ts of interpreting box plots is a whole other story. This plot is used to determine if your data is close to being normally distributed. QQ-plot technique is used as a framework for estimation of contaminated measurements distribution providing the algorithm adaptation. Quantile-Quantile Plots Description. PP plots tend to magnify deviations from the | {
"domain": "clubita.it",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9621075711974103,
"lm_q1q2_score": 0.8099268345758419,
"lm_q2_score": 0.8418256532040708,
"openwebmath_perplexity": 1397.0072810229867,
"openwebmath_score": 0.538626492023468,
"tags": null,
"url": "http://clubita.it/yzob/qq-plot-pdf.html"
} |
electromagnetism, forces, magnetic-fields
Of course, if the size of a compass/needle is small in comparison with the radius of the lines, of a non-uniform magnetic field, at the point of the measurement, we could approximate this field as uniform and therefore the results will be the same for small and large (relatively speaking) compasses. | {
"domain": "physics.stackexchange",
"id": 47858,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electromagnetism, forces, magnetic-fields",
"url": null
} |
genetics, molecular-biology, molecular-genetics, molecular-evolution, biology-misconceptions
How can I get over this conceptual chasm? Learning about a historical development of a particular discipline might help, but I need to find a way to systematize my study and I can't have a recourse to university right now (even if I did, I'll face the same conceptual hurdle). I have library loans and will to study, but I haven't internalized a good number of micro-talk related concepts and they feel so foreign to me.
This is quite maundering, but I couldn't put it any more succinctly. If there's anyone who experienced a similar frustrating feeling to the one I've described, I'd be very grateful if they could offer me some tips. Thanks a lot. I'm assuming you have a reasonable high school education otherwise you probably wouldn't have posted your question.
Do a basic science course and/or read - maths, physics, chemistry, biology texts. 1st year university level should be good. | {
"domain": "biology.stackexchange",
"id": 8505,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "genetics, molecular-biology, molecular-genetics, molecular-evolution, biology-misconceptions",
"url": null
} |
statistical-mechanics, bose-einstein-condensate, partition-function, superfluidity
Is there any way to derive an approximate grand canonical partition function for the system using the above hamiltonian to derive its thermodynamic properties; and if yes, how do we take the non conserving nature of the quasiparticles into account? | {
"domain": "physics.stackexchange",
"id": 44370,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "statistical-mechanics, bose-einstein-condensate, partition-function, superfluidity",
"url": null
} |
swift, objective-c, static
return _shortMonthNames
}
private static var _longMonthNames: [String]!
public static var longMonthNames: [String] {
if _longMonthNames == nil {
_longMonthNames = formatter.standaloneMonthSymbols
}
return _longMonthNames
}
public static var numberOfMonths: Int {
return shortMonthNames.count
}
// lots of other similar private/public pairs of statics
}
Is this an appropriate way to translate the functionality given the need to be able to reinitialize the statics? I don't like having a private static backing each public static property. Some thoughts: | {
"domain": "codereview.stackexchange",
"id": 34473,
"lm_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, objective-c, static",
"url": null
} |
hubble-telescope, early-universe
The Hubble Ultra Deep Field has FoV of 2.8 by 2.5 arcminutes. The region of the Universe that this FoV spans is thus largest at a distance of 15 Glyr, where it span $4.8\times4.3\,\mathrm{Mlyr}^2$ (i.e. square-mega-lightyears). But then your FoV begins to span an increasingly smaller region. At recombination, it spans only $34\times30\,\mathrm{klyr}^2$ — in other words, if a Milky Way-sized galaxy were present there (it weren't), it would be larger than the FoV.
It you could look all the way back to 4 hours after Big Bang, your FoV would span roughly a square-lightyear. Three minutes after BB, when all the Universe's hydrogen and helium had just been created, it would span $\sim0.1\times0.1\,\mathrm{lyr}^2$. A few microseconds after BB, it would span roughly a square-AU (the distance from Earth to Sun). Approximately $10^{-22}\,\mathrm{s}$ after BB, it would span a square kilometer. | {
"domain": "astronomy.stackexchange",
"id": 2907,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "hubble-telescope, early-universe",
"url": null
} |
python, python-3.x, multithreading, http, network-file-transfer
class Verifier:
@staticmethod
def validate_filepath(path):
path = path.replace('\\', '/')
if (not re.match('^[a-zA-Z]:/(((?![<>:"/|?*]).)+((?<![ .])/)?)*$', path) or
not Path(path[:3]).exists()):
print('Invalid windows file path has been inputted, process will now stop.')
return False
return True
@staticmethod
def validate_url(url):
if not validators.url(url):
print('Invalid url been inputted, process will now stop.')
return False
if url.lower().startswith('ftp://'):
print(
"`requests` module doesn't suport File Transfer Protocol, process will now stop")
return False
return True
@staticmethod
def confirm_overwrite(path, overwrite):
filepath = str(path)
if not path.exists():
return True
if path.is_file():
if overwrite:
return True | {
"domain": "codereview.stackexchange",
"id": 42148,
"lm_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, multithreading, http, network-file-transfer",
"url": null
} |
quantum-field-theory, feynman-diagrams, integration, unitarity, analyticity
N. Arkani-Hamed, F. Cachazo & J. Kaplan, What is the Simplest QFT?,
arXiv:0808.1446; eqs. (133)-(134).
M.D. Schwartz, QFT & the standard model,
2014; Subsection 24.1.2.
M. Le Bellac, Quantum & Statistical FT, 1991; Section 10.4.
M. Srednicki, QFT, 2007; chapter 14. A prepublication draft PDF file is
available here. | {
"domain": "physics.stackexchange",
"id": 99060,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-field-theory, feynman-diagrams, integration, unitarity, analyticity",
"url": null
} |
java, algorithm, sorting, kotlin
Title: Sorting algorithms in Kotlin - Bubble, Insertion, Selection, Merge and Quick sort Introduction
I decided to try Kotlin because of its forgiving nature to long-time Java users. I implemented a few introductory sorting algorithms and would like to have them reviewed, not just to ensure that I'm applying Kotlin correctly, but also to improve my style and get rid of any potential bugs.
I have made use of a few extension functions to make the code more readable and all relevant source code will be posted in this question.
Note: I tagged it as Java as well, because someone familiar with Java can easily get into Kotlin if they see how easy it is to read Kotlin. Anything applicable in Java can almost always be applied directly to Kotlin code.
Project Structure
Main files
+- meta
| +- annotations
| | +- ComparisonSort
| | +- StableSort
| +- Complexity
+- sort
| +- AbstractSort
| +- BubbleSort
| +- InsertionSort
| +- MergeSort
| +- QuickSort
| +- SelectionSort
+- util | {
"domain": "codereview.stackexchange",
"id": 33193,
"lm_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, algorithm, sorting, kotlin",
"url": null
} |
special-relativity, speed-of-light, mass, faster-than-light
Now, with that out of the way: unfortunately, the passage you've quoted from Hawking's book uses the old convention, where "mass" refers to relativistic mass. The "equivalence of energy and mass" he mentions is an equivalence of energy and relativistic mass, expressed by the equation $E = m_\text{rel}c^2$. Under this set of definitions, it is true that an object approaching the speed of light would have its (relativistic) mass approach infinity (i.e. increase without bound). Technically, it's not wrong, because Hawking is using the concept correctly, but it's out of line with the way we do things in physics these days.
With modern usage, however, I might rephrase that paragraph as follows: | {
"domain": "physics.stackexchange",
"id": 2810,
"lm_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, speed-of-light, mass, faster-than-light",
"url": null
} |
rviz
Title: ROS Rviz groovy segfault and assertion fail
Hi
RVIZ keeps segfaulting everytime i visualise a point cloud, I am not sure why.
I have attached a pcd file test.jpg (text file , test.jpg rename this to test.pcd) which causes the following error in RVIZ
rviz: ../../../../../src/glsl/ralloc.c:81: get_header: Assertion `info->canary == 0x5A1106' failed.
Mostly it just segfaults everytime I try to visualise the pointcloud 2
rosrun pcl_ros pcd_to_pointcloud test.pcd 10 cloud_pcd:=Laser _frame_id:=/map
I have been experimenting with the number of points. Set WIDTH and POINTS to N to visualise N points. When this number is 100 it segfaults and when its small I can see the pointcloud.
for instance if WIDTH and POINTS = 10 then the segfault does not occur.
If your gradually increase this number there is no segfault, but if you make this number large for the first time you publish the pointcloud eg 100 RVIZ segfaults | {
"domain": "robotics.stackexchange",
"id": 16900,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "rviz",
"url": null
} |
and *.kasandbox.org are unblocked and compare answers! Only root of the inflection point change in the graph gets steeper and steeper the absolute minimum maximum! Your answers with part ( b ) set the second derivative changes ( where concavity.! Education to anyone, anywhere or decreasing 4 * e^2x - e^x point of inflection second derivative when! Get ; 6x = 12. x = 0, and website in this for. We 're having trouble loading external resources on our website I comment with a complex root its! Website is made possible by displaying online advertisements to our Cookie Policy f′. The graphs of f on the histogram itself ) curvature occurs how to obtain maximums, minimums and inflection of... To Matlab and where the concavity test for a function is concave up on the right side of derivative... Inflation points of inflection Jackie Nicholas c 2004 University of Sydney inflection points of inflection:.. Inflection Jackie Nicholas c 2004 University of Sydney of Technology a very clear physical | {
"domain": "cooperadorsdemataro.coop",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9653811581728097,
"lm_q1q2_score": 0.8126826125768603,
"lm_q2_score": 0.8418256412990657,
"openwebmath_perplexity": 436.57279044448717,
"openwebmath_score": 0.581055223941803,
"tags": null,
"url": "https://cooperadorsdemataro.coop/claire-ptak-dhzn/point-of-inflection-second-derivative-9feb06"
} |
c#, rubberduck
protected virtual IEnumerable<Declaration> UserDeclarations
{
get { return State.AllUserDeclarations.WhereInspectionIsNotDisabledByAnnotation(AnnotationName); }
}
I think that's better because you've centralised your logic (I'm not overly fond of the name though). You could potentially remove the .IsInspectionDisabled() method from Declaration and put the logic in the extension method but that's up to you.
This is interesting ((dynamic)context.Context)... Why are you doing that?
I agree that SeverityLabel definitely doesn't fit ;) I'd expect it to be readonly anyway:
// C#6
public string SeverityLabel => RubberduckUI.ResourceManager.GetString("CodeInspectionSeverity_" + Severity, RubberduckUI.Culture);
If you want to change the label, you should have to change the severity!
You have a lot of magic strings around the place:
"Inspection", "Meta", "CodeInspectionSeverity_"... They should be well named constants. | {
"domain": "codereview.stackexchange",
"id": 17901,
"lm_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#, rubberduck",
"url": null
} |
classification, machine-learning-model, beginner
I also know if the runner won/placed/lost
My goal is to be able to say that runnerx X will win/place
after ca 50-75% of the expected racetime with say 80% accuracy.
My problem is that I don't know how to model this situation.
I've seem tournament strategies - ie who out of two runner will win -
but here's more data - both in time and in participants
What model should I pay attention to? | {
"domain": "datascience.stackexchange",
"id": 4014,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "classification, machine-learning-model, beginner",
"url": null
} |
java, mvc, spring, controller
CategoryService
all of the methods seen above are more or less identical in service class, they only differ in their naming, so I am going to add only one of them for brevity's sake
public Page<Category> getAllCategoriesByPostCountDesc(int pageNumber) {
Pageable pageable = PageRequest.of(pageNumber, 4);
return categoryRepository.findAllOrderByPostCountDesc(pageable);
} | {
"domain": "codereview.stackexchange",
"id": 40376,
"lm_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, mvc, spring, controller",
"url": null
} |
java, algorithm, object-oriented, design-patterns, finance
boolean isBalanceCorrect = checkInputBalance(userInputBalance);
if (isBalanceCorrect) {
balance += userInputBalance;
account.setBalance(balance);
System.out.println("New account balance: " + account.getBalance());
} // else you can call this function again or to do something
Additional function for checking user input.
private boolean checkInputBalance(double inputBalance) {
if (inputBalance < 0) {
System.out.println("You can't insert negative values on your deposit");
return false;
} else if (inputBalance == 0) {
System.out.println("You current balance will not change");
return false;
}
} | {
"domain": "codereview.stackexchange",
"id": 20285,
"lm_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, algorithm, object-oriented, design-patterns, finance",
"url": null
} |
electric-circuits, capacitance, resonance, inductance
Thank you all ahead of time for your responses. Your title is about a parallel LCR circuit but your text seems to be moving towards a series LCR circuit.
If you have a circuit consisting of an ideal inductor $L$ , an ideal capacitor $C$ which is charged and a switch and you close the switch then an oscillatory current flows in the circuit with first the energy within the circuit stored in the capacitor, then the inductor, then the capacitor etc.
The frequency of the oscillator current is $\omega = \frac{1}{\sqrt{LC}}$.
Now consider the inductor and capacitor as a parallel combination in series with an ac power supply set to a frequency of $\omega = \frac{1}{\sqrt{LC}}$.
In the steady state an oscillating current will circulate around the LC loop but no current will flow in the ac power supply circuit. | {
"domain": "physics.stackexchange",
"id": 39207,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electric-circuits, capacitance, resonance, inductance",
"url": null
} |
ros, installation, ros-electric
Error during install of 'physics_ode' : [physics_ode] Checkout of https://code.ros.org/svn/ros-pkg/stacks/physics_ode/tags/physics_ode-1.6.1 version None into /home/dlr/ros/physics_ode failed.
Error during install of 'visualization_common' : [visualization_common] Checkout of https://code.ros.org/svn/ros-pkg/stacks/visualization_common/tags/visualization_common-1.6.2 version None into /home/dlr/ros/visualization_common failed.
Error during install of 'rx' : [rx] Checkout of https://code.ros.org/svn/ros/stacks/rx/tags/rx-1.6.1 version None into /home/dlr/ros/rx failed.
Error during install of 'image_common' : [image_common] Checkout of https://code.ros.org/svn/ros-pkg/stacks/image_common/tags/image_common-1.6.1 version None into /home/dlr/ros/image_common failed.
Error during install of 'perception_pcl' : [perception_pcl] Checkout of http://svn.pointclouds.org/ros/tags/perception_pcl-1.0.2 version None into /home/dlr/ros/perception_pcl failed. | {
"domain": "robotics.stackexchange",
"id": 8543,
"lm_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, installation, ros-electric",
"url": null
} |
algorithms, approximation, real-numbers
Linear Search + Use Previous Results:
Step 1:
$$
[0, 1]\to[0.0, 0.1, 0.2, \cdots,0.9, 1.0]\to [0.7,0.8]
$$
Step 2:
$$
[0.7,0.8]\to[0.70,0.71,0.72,\cdots,0.79,0.80]\to[0.70, 0.71]
$$
Step 3:
$$
[0.70,0.71]\to[0.700,0.701,0.702,\cdots,0.709,0.710]\to[0.707, 0.708]\to 0.708
$$
The time complexity of this method is: $O(10k)$
Binary Search + Use Previous Results:
Similar to the method above, The time complexity of this method is: $O(k\log10)$
Are there any faster algorithms? If so, what is it? You are in fact asked to find $b$ independent bits of information (such that $2^{-b}\sim10^{-k}$)*, using queries that return a single bit of information each. So you can't get an answer in less than $b$ queries in the worst case, and this is achieved by binary search.
*Justification: the problem is equivalent to finding an integer $n$ such that $|a\cdot10^k-n|<1$, with $n$ in range $[0,10^k]\sim[0,2^b]$. | {
"domain": "cs.stackexchange",
"id": 21018,
"lm_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, approximation, real-numbers",
"url": null
} |
sensors, ros, irobot-create, python
Title: How can I access the cliff sensors on an iRobot Create 2 via ROS/ Python? I have an iRobot Create 2 and am currently using the create_autonomy package. Currently, they have cliff sensors as a "planned" feature. I see in the documentation that there are 4 cliff sensors (which can return 0 (no cliff) and 1 (yes cliff)) and their "Packet ID" numbers.
It also mentions this note for each sensor: "NOTE: This packet is a binary version of the “Cliff Front Left Signal” (ID: 29) packet." I don't understand what this means or if it's relevant to what I'm doing.
How can I read this cliff sensor data (in order to publish a topic with it)? It is possible to subscribe to the cliff state using ROS. The topic is /cliff_state, and it is of type Int16. Below is what I used in my code, where callback_cliff is my callback function.
rospy.Subscriber('/cliff_state', Int16, callback_cliff)
However, I'm still not sure what the packet ID numbers are. | {
"domain": "robotics.stackexchange",
"id": 1669,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "sensors, ros, irobot-create, python",
"url": null
} |
mechanical-engineering, gears
Title: Worm gear for a lifting device I am designing a lifting device for practical use which is powered by a dc motor with worm gear. The lifting device should be able to hold the load in place at a certain height.however, i read that wormgears are self locking only in situations where shock and vibration are not present, in other words, if the lifting device is not perturbed in any way, the self-locking feature will probably perform as intended. This could present a problem for security reasons and functionality if the lifting device is intended for use in varied conditions. My question is, should I consider others options, like different types of gears or persist with the worm gear I've seen from simple observation that many lifting devices using winch mechanisms use worm gears. One advantage of using this mechanism is the high gear ratio (reduction) created with few components. | {
"domain": "engineering.stackexchange",
"id": 2081,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "mechanical-engineering, gears",
"url": null
} |
quantum-mechanics, fermions, representation-theory, clifford-algebra, anticommutator
$$ a_i a_j = - a_j a_i, \; a^{\dagger}_i a^{\dagger}_j = -a^{\dagger}_j a^{\dagger}_i $$
$$ a_i a^{\dagger}_j + a^{\dagger}_j a_i = \delta_{ij}. $$
I am interested in the generic formula for a matrix representation of such CAR. According to the Pauli principle, it should have the dimensionality of $2^N$.
Note that simply taking
$$ a_i = 1 \otimes \dots \otimes a \otimes \dots \otimes 1 $$
gives you a different algebra – for example, $a_i$ and $a_j$ commute for $i \neq j$ instead of anti-commuting. Hence, this isn't the sought matrix representation. The answer is the so-called Jordan-Wigner transformation. This expresses the canonical ladder operators describing $N$ fermionic modes in terms of Pauli operators on a tensor product Hilbert space of $N$ spin-1/2 particles. Given a set of fermionic operators $\{\hat{a}_j\}$, for $j = 1,2,\ldots,N$, which satisfy the CAR $\{\hat{a}_j,\hat{a}_k^\dagger\} = \delta_{jk}$ and $\{\hat{a}_j,\hat{a}_k\} = 0$, the matrix representation is given by | {
"domain": "physics.stackexchange",
"id": 61245,
"lm_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, fermions, representation-theory, clifford-algebra, anticommutator",
"url": null
} |
quantum-mechanics, quantum-information, quantum-entanglement
Title: Can a particle be entangled with itself? Suppose I had a single particle with a four-dimensional Hilbert space $\mathcal{H}$ spanned by the states $\{ |1\rangle,|2\rangle,|3\rangle,|4\rangle\}$ and suppose I prepared the particle in the superposition state
$$ |\psi\rangle = \frac{1}{\sqrt{2}}\left(|1\rangle + |4\rangle \right). $$
With a trivial relabelling of the basis states as $|1\rangle \rightarrow |00\rangle$, $|2\rangle \rightarrow |01\rangle$, $|3\rangle \rightarrow |10\rangle$ and $|4\rangle \rightarrow |11\rangle$, then it makes it clear that the original Hilbert space $\mathcal{H}$ is isomorphic to the Hilbert space of a pair of spin-$1/2$ particles as $\mathcal{H} \cong \mathcal{H}_{1/2} \otimes \mathcal{H}_{1/2} $, where $\mathcal{H}_{1/2}$ is spanned by the basis $\{ |0\rangle , |1\rangle \}$.
In this basis, the state $|\psi\rangle$ can be trivially rewritten as
$$ |\psi\rangle = \frac{1}{\sqrt{2}}\left(|00\rangle + |11\rangle \right),$$ | {
"domain": "physics.stackexchange",
"id": 92781,
"lm_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-information, quantum-entanglement",
"url": null
} |
matlab, gazebo
Originally posted by hsu with karma: 5780 on 2012-03-02
This answer was ACCEPTED on the original site
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 8416,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "matlab, gazebo",
"url": null
} |
definition, moon, satellites
Title: What distinguishes a moon from orbiting space debris? Or in other words, when is a satellite "too small" to be a moon? The Wikipedia article on Natural Satellites doesn't really give an adequate distinction as to what distinguishes a moon from other orbiting bodies. What I am looking for is a classification that defines a moon, i.e. when can something be classified as a moon, or definitely not a moon?
Saturn, for example, has lots of orbiting space debris that form its rings. Certainly, there might be some cutoff point. I suspect that this question will really only be answered by force of necessity. Pluto was considered a planet until a number of other similar objects were discovered that reclassified it as a new kind of object. | {
"domain": "physics.stackexchange",
"id": 3138,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "definition, moon, satellites",
"url": null
} |
There are 50 different possible ways that the unknown mines next to the revealed region could be configured:
Here, the green cells are clear (no mines), while the X's around the perimeter indicate the different ways the mines could potentially be placed.
If we consider each of these to be of equal probability (probably not quite true, because the total number of mines on the board might mean that configurations with more (or less) mines are slightly more (or less) probable), then we simply need to count the number of configurations with a mine in each location to determine the probability of finding a mine there.
Doing so, we end up with
From this, it seems evident that the best move is on the fifth row, where there is an 8. Making this move gives you only a 16% chance ($\frac8{50}$) of finding a mine.
Conversely, picking one of the bottom squares means you have a 66% chance ($\frac{33}{50}$) of finding a mine. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.972830769252026,
"lm_q1q2_score": 0.8064171847288777,
"lm_q2_score": 0.8289388146603364,
"openwebmath_perplexity": 597.9744998141219,
"openwebmath_score": 0.591291606426239,
"tags": null,
"url": "https://puzzling.stackexchange.com/questions/50948/optimal-next-move-in-minesweeper-game/50949"
} |
deep-learning, q-learning, dqn, rewards
Does anyone have any tips on how to achieve this? Would a minus gamma have adverse effects on the network?
TLDR:
Time between actions becoming increasingly long over time, would prefer an agent that makes many actions over long-term ones. Thanks for the responses - after taking into account the 'risk' the network experiences when working with unstable financial data I modified the activation layers from RelU to Sigmoid - this has lead to a considerable improvement to both results (profit!) and additionally the rate at which actions are carried out.
I will also edit the above question to provide further details. | {
"domain": "ai.stackexchange",
"id": 1097,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "deep-learning, q-learning, dqn, rewards",
"url": null
} |
python, game, console, chess
def generate_bishop_legal_moves(self, pos_y: int, pos_x: int) -> list[str]:
legal_moves = []
for delta_y, delta_x in BISHOP_DELTAS:
for i in range(1, 9):
end_y = pos_y + i*delta_y
end_x = pos_x + i*delta_x
if (
not is_in_bounds(end_y, end_x) or
get_color(self.matrix[end_y][end_x]) == self.current_turn_color
):
break
legal_moves.append(encode_move({
"type": MoveType.NORMAL,
"start_pos": [pos_y, pos_x],
"end_pos": [end_y, end_x]
}))
if not is_empty(self.matrix[end_y][end_x]):
break
return legal_moves | {
"domain": "codereview.stackexchange",
"id": 44514,
"lm_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, game, console, chess",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.