text stringlengths 1 1.11k | source dict |
|---|---|
c++, beginner, algorithm, programming-challenge, c++17
Within each chunk, there is one digit at the hundreds place.
Within each chunk, the last 2 digits have a special case till 20, otherwise it's a special word for the ten's place, and the one's place.
So the only variables you need are just
std::string const till_twenty[20] = {"", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen"};
std::string const tens_place[10] = {"", "Ten", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"};
std::string const thousands[4] = {"", "Thousand", "Million", "Billion"}; | {
"domain": "codereview.stackexchange",
"id": 38784,
"lm_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, algorithm, programming-challenge, c++17",
"url": null
} |
Why do we care? It turns out to be a useful notion in several contexts
when \D is a square design; in particular it will let us classify and
analyze projective planes of small order. For starters (see p.18),
suppose we ask whether a projective plane \D = (X,\B) is extendable:
is there a 3-design \E such that \D is \E_p? If so, we already know
the points of \E -- namely X u {p} -- and some of the blocks, namely
B u {p} for any B in \B. Since B is square, any two blocks meet in
λ=1 point. For each x in X, \E_x has the same parameters as \E_p,
so is also square with the same value of λ; hence any two of its blocks
meet in a unique point too. Thus any two blocks of \E are either disjoint
or meet in 2 points. (That's a special case of the argument at the
beginning of the proof of Cameron's Theorem 1.35 .) So, any block of \E
that does not contain p is an arc. Indeed we'll see it's an arc of
maximal size, which we'll call a "hyperoval".
How big can an arc be? | {
"domain": "harvard.edu",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9908743632845277,
"lm_q1q2_score": 0.819167516223836,
"lm_q2_score": 0.8267117876664789,
"openwebmath_perplexity": 3260.0613332805115,
"openwebmath_score": 0.862601101398468,
"tags": null,
"url": "http://www.math.harvard.edu/~elkies/M155.15/notes.html"
} |
uniform random variables. In other words, any value within the given interval is equally likely to be drawn by uniform. Thus, as with discrete random variables, the expected value of a continuous random variable can be thought of as a weighted average of the values that the random variable can take, where the weights are provided by the distribution of the variable. To generate a random variable that has CDF F(y) = 1 e y for y 0, we can use the following steps (a)generate a random number u from Uniform (0;1). The Excel RAND and RANDBETWEEN functions generate pseudo-random numbers from the Uniform distribution, aka rectangular distribution, where there is equal probability for all values that a random variable can take on. The acceptance-rejection algorithm is then as follows: (1) independently simulate a random number with a uniform distribution over the unit interval and a realization * of the random variable ; and then (2) using a fixed, strictly positive number , accept * as a | {
"domain": "aeut.pw",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9805806472775277,
"lm_q1q2_score": 0.8466250968684361,
"lm_q2_score": 0.863391602943619,
"openwebmath_perplexity": 354.89415997265763,
"openwebmath_score": 0.6748271584510803,
"tags": null,
"url": "http://gqjl.aeut.pw/generate-random-variable-from-uniform-distribution.html"
} |
newtonian-mechanics, brachistochrone-problem
$$ 2u \ddot{u} - \dot{u}^2 = 1 $$
This equation looks formidable, because it is nonlinear, but it possesses a nonobvious extra scale symmetry. When you scale x and y by a factor R, the arclength scales by the same factor, so that the derivative $\dot{u}$ is invariant. The product $u\ddot{u}$ is also invariant. The reason for choosing the variable u, and not y, is that the natural Brachistochrone scaling is around the axis $y=y_0$. The scale symmetry suggests a transformation of variables, and the right one is
$$ {d\over ds} ({\dot{u}\over \sqrt{u}}) = {1\over 2u^{3/2}}$$
or, using $v=\sqrt{u}$,
$$ \ddot{v}= - {1\over 2v^3} $$ | {
"domain": "physics.stackexchange",
"id": 1869,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "newtonian-mechanics, brachistochrone-problem",
"url": null
} |
java, graph, depth-first-search
AdjacencyList
import java.util.List;
import java.util.ArrayList;
public class AdjacencyList implements Graph {
private int numOfVertices;
private ArrayList<ArrayList<Integer>> adj;
public AdjacencyList(int numOfVertices) {
this.numOfVertices = numOfVertices;
adj = new ArrayList<ArrayList<Integer>>(numOfVertices);
for(int i = 0; i < numOfVertices; i++) {
adj.add(new ArrayList<Integer>());
}
}
@Override
public void addEdge(int i, int j) {
adj.get(i).add(j);
}
@Override
public void removeEdge(int i, int j) {
List<Integer> edges = adj.get(i);
for(Integer integer : edges) {
if(integer == j) {
edges.remove(integer);
return;
}
}
}
@Override
public boolean hasEdge(int i, int j) {
return adj.get(i).contains(j);
}
@Override
public List<Integer> outEdges(int i) {
return adj.get(i);
} | {
"domain": "codereview.stackexchange",
"id": 15125,
"lm_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, graph, depth-first-search",
"url": null
} |
general-relativity, black-holes, metric-tensor, curvature, event-horizon
Both $g_{\theta\theta}$ and $g_{\phi\phi}$ are only dependent on the current coordinates.
$g_{tt} = 1-\frac{r_s}{r}$ and $g_{rr} = -g_{tt}^{-1}$, so it seems like the metric tensor is only a function of the Schwarzschild radius. So if I want to keep $r_s$ constant, there does not seem to be a parameter to reduce distance curvature.
I've tried putting random coefficients in the geodesic equations, but adjustments seem to have the effect of reducing distance curvature.
I've largely ignored $ct$, just including it for the sake of the geodesic equations and dropping it later. But I don't think changing it would have an affect, because $r_s$ is a function of $c^2$ already, which I am trying to hold constant. Nothing else in the code is in terms of G or M because $r_s$ is known in advanced.
Given that Newton's gravity is proportional to $\frac{1}{r^2}$, it would almost seem like you can scale the current geometry, but not change how it evolves over large distances. | {
"domain": "physics.stackexchange",
"id": 84199,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "general-relativity, black-holes, metric-tensor, curvature, event-horizon",
"url": null
} |
php, object-oriented, design-patterns
return $this->handleException(new Exception($message, $code));
}
protected function handleException(Exception $e)
{
return ResponseJsonError::getResponse($e);
}
}
This class could be problematic to me as it's doing lots of things. It's able to handle requests and responses (and exceptions bound to these), and it also logs all of its requests.
I did this class to be able to implement subclasses to change the behavior when needed, but I still wanted to be able to use this main class for most requests.
Here's an example of a subclass I made :
<?php
namespace App\Services\Pivotal\Request;
class PivotalGuzzleHttpRequest extends GuzzleHttpRequest
{
private $tokenFactory;
public function __construct(Client $client, GuzzleLogger $logger, RequestsLog $requestLog, TokenFactory $tokenFactory)
{
parent::__construct($client, $logger, $requestLog);
$this->tokenFactory = $tokenFactory;
} | {
"domain": "codereview.stackexchange",
"id": 22610,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "php, object-oriented, design-patterns",
"url": null
} |
c++, performance, c++11, recursion, breadth-first-search
return NotPrevioslyVisited;
}
void KMMoveFilters::PushVisited(KMBoardLocation Location)
{
m_VisitedRows.push_back(Location.GetRow());
m_VisitedColumns.push_back(Location.GetColumn());
m_VisitedLocations.push_back(Location);
}
void KMMoveFilters::PopVisited()
{
m_VisitedRows.pop_back();
m_VisitedColumns.pop_back();
m_VisitedLocations.pop_back();
} | {
"domain": "codereview.stackexchange",
"id": 21124,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, performance, c++11, recursion, breadth-first-search",
"url": null
} |
waves, terminology, oscillators
Thanks to Floris in help of derivation of the definition. | {
"domain": "physics.stackexchange",
"id": 29711,
"lm_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, terminology, oscillators",
"url": null
} |
• 1. Couldn't you just check the rank of $(v_1, v_2, \dots, v_n,v)$? 2. Would it not do to just solve the implied linear equation by your sum, and then check that the components of the solution vector are all nonnegative? – J. M.'s technical difficulties May 24 at 17:03
• @J.M. That $v$ is linearly dependent on $\{v_1,\ldots,v_n\}$ does not necessarily mean they are positively dependent, so matrix rank doesn't help much~(of course they cannot be positively dependent if they are not even linearly dependent, but in my case linear dependence is guaranteed). There can be infinitely many solutions, and I don't know how to determine if there is one that has non-negative coordinates. – Lagrenge May 24 at 17:10 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9777138099151278,
"lm_q1q2_score": 0.816863786175177,
"lm_q2_score": 0.8354835309589074,
"openwebmath_perplexity": 1278.8033869967128,
"openwebmath_score": 0.5300247073173523,
"tags": null,
"url": "https://mathematica.stackexchange.com/questions/222537/how-to-check-positive-linear-dependence-of-vectors-matrices"
} |
filters, fourier-transform, filter-design, linear-systems
I'm stuck on a final step in this problem. Essentially, there are the two systems above, which we'll call System 1 (Fig. 4.26, with ideal lowpass $H(jw)$) and System 2 (with $H_1(jw)$). The question proposes that the output y(t) of System 2 is identical to that which would be obtained by retaining $\Re\{f(t)\}$ of System 1.
I have a couple questions -
(1) Why do we need to take the real part of system 1 and not system 2? Aren't they both already bandpass filters?
(2) I solved out answers for $F(jw)$ and $Y(jw)$. $H_1(jw)=H(jw)$ is assumed (they seem to be the same):
$$F(jw)=H(j(w+w_c))X(jw)\\Y(jw)=\frac{1}{2}(H(j(w-w_c))X(jw)+\frac{1}{2}H(j(w+w_c))X(jw)$$
I'm relatively confident this answer is correct, but I'm unsure of how to take the real part of $f(t)$. Can I take the real part of $F(jw)$ and get it to look like $Y(jw)$? | {
"domain": "dsp.stackexchange",
"id": 2209,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "filters, fourier-transform, filter-design, linear-systems",
"url": null
} |
quantum-field-theory, spinors, chirality
Title: Two conflicting definitions of chirality Consider a Majorana fermion embedded in a Dirac spinor,
$$\psi = \begin{pmatrix} \psi_L \\ i \sigma_2 \psi_L^* \end{pmatrix}.$$
The Majorana fermion $\psi_L$ is left-chiral, i.e. it transforms in the $(1/2, 0)$ representation of the Lorentz group.
Now, I've also been told that you can project out chirality components using $P_L = (1-\gamma_5)/2$ and $P_R = (1+\gamma_5)/2$. Then I would have expected that
$$P_L \psi = \psi, \quad P_R \psi = 0$$
though this is clearly not the case.
The problem also appears when considering charge conjugation,
$$C: \psi \to -i\gamma_2 \psi^*.$$
Charge conjugation does not affect a Majorana fermion, so it leaves the representation chirality alone. But on the other hand, if $P_L \psi = \psi$, then
$$P_R (C\psi) = C\psi$$
so it flips the other kind of chirality. | {
"domain": "physics.stackexchange",
"id": 30086,
"lm_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, spinors, chirality",
"url": null
} |
c++, file
// 500 lines of code not using outfile
outfile << objectMap.size() << std::endl;
for (const auto& x : objectMap)
outfile << x.first << ' ';
}
Move the declaration of outfile to the point just before you tart using it. In C++ because of constructors/destructors the side affects may allocate resources. If you don't need them don't use them so wait until you need them.
It also has the benefit of making the declaration near the code that uses it so it makes it real easy to see the type of the object you are using (as it is just there with the code).
Encapsulation
struct Person {
You seem to be making all your objects publicly accessible. This does not help encapsulation. You should make all your data members private by default. Then provide methods (which are verbs) that act on the object.
class Object
{
static int const maxMemoryOfObjects = 200;
static int totalMemoryOfObjects = 0;
static int lastObjectID = 0; | {
"domain": "codereview.stackexchange",
"id": 12500,
"lm_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++, file",
"url": null
} |
thermodynamics, electrochemistry, energy, free-energy
Title: What is the difference between standard Gibbs energy and Gibbs energy of formation? Good day guys,
I am reading a book on electrochemical engineering, I came across some definitions of Gibbs energy and I am a bit confused as the book does not go into a lot of detail.
The book first introduces Gibbs energy of a reaction
$$\Delta G_{Rx} = \Delta G_f^{products} - \Delta G_f^{reactants}$$
and it mentions that $\Delta G_f$ is the gibbs energy of formation for a compound. And it refers me to a list in the appendix on Gibbs energy of formation values at ambient/standard conditions as $\Delta G$ and it does not mention pressures.
Later on in the book, the standard gibbs energy for a cell reaction is introduced as:
$$ \Delta G^o_{Rx} = \sum_i s_i \Delta G_{f,i}^o $$
where $s_i$ are the stoichiometric coefficients and $\Delta G_{f,i}^o $ is the Gibbs energy of formation at standard/ambient conditions. | {
"domain": "chemistry.stackexchange",
"id": 17784,
"lm_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, electrochemistry, energy, free-energy",
"url": null
} |
statistical-mechanics, mathematical-physics, phase-transition, ising-model, lattice-model
The situation does not seem to be much more interesting in terms of the Gibbs measure, I think, but I may be missing something.
Note that the problem becomes much more interesting when you use a square box with $-$ boundary condition, as in this case there is a nontrivial competition between the boundary condition and the magnetic field. In that case, the critical scale is $a_n = 1/n$ (as this makes the contribution to the energy due to the magnetic field and the one due to the boundary condition of the same order $O(n)$). For such a choice, there is a value $h_c\in (0,\infty)$ such that | {
"domain": "physics.stackexchange",
"id": 61608,
"lm_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, mathematical-physics, phase-transition, ising-model, lattice-model",
"url": null
} |
python, proteins, protein-structure, biopython
but this fails with the following error:
Traceback (most recent call last):
File "test_biopython_internal_coords.py", line 97, in <module>
main(args)
File "test_biopython_internal_coords.py", line 89, in main
ic_chain_bound.internal_to_atom_coordinates()
File "/software/anaconda/installation/envs/alphafold/lib/python3.7/site-packages/Bio/PDB/internal_coords.py", line 661, in internal_to_atom_coordinates
verbose=verbose, start=start, fin=fin
File "software/anaconda/installation/envs/alphafold/lib/python3.7/site-packages/Bio/PDB/internal_coords.py", line 415, in assemble_residues
Dict[AtomKey, numpy.array], ric.assemble(verbose=verbose)
File "/software/anaconda/installation/envs/alphafold/lib/python3.7/site-packages/Bio/PDB/internal_coords.py", line 1732, in assemble
atomCoords = self.get_startpos()
File "/software/anaconda/installation/envs/alphafold/lib/python3.7/site-packages/Bio/PDB/internal_coords.py", line 1632, in get_startpos | {
"domain": "bioinformatics.stackexchange",
"id": 2134,
"lm_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, proteins, protein-structure, biopython",
"url": null
} |
c#, xml, api
private readonly IList<XmlCmd> _xmlCommands = new List<XmlCmd>();
public XmlCmdBuilder()
{
_xmlCommands = new List<XmlCmd>();
}
public void Add(XmlCmd cmd)
{
_xmlCommands.Add(cmd);
}
public void Clear()
{
_xmlCommands.Clear();
}
public XElement GetXml()
{
return new XElement(
Namespace + "Commands",
new XAttribute(XNamespace.Xmlns + "cmd", Namespace),
_xmlCommands.Select(cmd => cmd.GetXml()));
}
public IEnumerator<XmlCmd> GetEnumerator()
{
return _xmlCommands.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
public class XmlCmd : IEnumerable<XmlCmdParameter>
{
public static readonly XNamespace Namespace = XmlCmdBuilder.Namespace;
private readonly IList<XmlCmdParameter> _parameters;
public XmlCmd(string name)
: this(name, new List<XmlCmdParameter>())
{} | {
"domain": "codereview.stackexchange",
"id": 5668,
"lm_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#, xml, api",
"url": null
} |
coordinate
If you pick a star with a smaller proper motion in Stellarium, like Deneb (only 2 mas/year for each axis), the J2000 coordinates change much more slowly.
As for the difference between J2000 RA/Dec and apparent (on date) RA/Dec, this is caused by the fact that the J2000 frame's equator/equinox was fixed at the mean position of the equator/equinox in 2000 (mean position means that the small periodic effects of nutation are averaged out). So the apparent coordinates on Jan 1 2000 are slightly different because apparent coordinates take into account nutation N of the rotational axis R around the mean P (precession): | {
"domain": "astronomy.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": "coordinate",
"url": null
} |
ros, ros2, dds
Originally posted by broomstick on ROS Answers with karma: 111 on 2020-04-13
Post score: 0
I'm not very clear on the relationship, if any, between eProssima's Fast RTPS and eclipse's cyclonedds.
Apart from the fact that they both implement (partially, in the case of Fast RTPS) the DDS standard, there is none.
I was under the impression that they are separate DDS implementations.
Exactly.
Is that accurate?
Yes.
I may be missing something pretty fundamental here... Or perhaps cyclonedds and its rmw interface is now sufficiently mature that it's bundled with eloquent, and I am just looking at outdated websites.
Fast RTPS is still the default -- afaik and on 2020-04-14.
It may help if you could describe how you've installed ROS 2? Are you installing binaries (ie: .debs from the ROS 2 repositories), or building from source?
Originally posted by gvdhoorn with karma: 86574 on 2020-04-14
This answer was ACCEPTED on the original site
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 34760,
"lm_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, ros2, dds",
"url": null
} |
cv-bridge
==11677== by 0x4759603: image_transport::RawSubscriber::internalCallback(boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> const&, boost::function<void ()(boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> const&)> const&) (function_template.hpp:1013) | {
"domain": "robotics.stackexchange",
"id": 11204,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "cv-bridge",
"url": null
} |
java, error-handling
Title: Error handling for parsing a date Is this return style acceptable? Would the code be more readable if I assigned the MonthDay.parse() return value to a variable and returned that variable on the last line?
Also, is it a bad idea to both log and rethrow inside a catch block?
/**
* Parses showing date from the header text.
*
* @throws PageStructureException if the date string does not conform to the expected format
*/
public MonthDay parseShowingDate( String date ) throws PageStructureException {
Preconditions.checkNotNull( date ); | {
"domain": "codereview.stackexchange",
"id": 2271,
"lm_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, error-handling",
"url": null
} |
general-relativity, black-holes, event-horizon, singularities
The coordinate singularity on the horizon enters in step 2, because the coordinate transform itself is singular. The fact that we started with a non-singular metric shows that the singularity on the horizon is an artifact of the coordinate system.
Non-rotating black hole with extremal charge
Let $d\Omega^2$ denote the standard metric on the unit sphere, and use the letters $w,r$ for the other two coordinates. Start with the metric
$$
dw^2-dr^2-V(r)(dw+dr)^2-r^2 d\Omega^2
\tag{1}
$$
where $V(r)$ is smooth and finite for all $r>0$. Define a function $f(r)$ by
$$
\frac{d}{dr}f(r)=\frac{V(r)}{V(r)-1},
\tag{2}
$$
and define a new coordinate $t$ by
$$
w = t + f(r).
\tag{3}
$$
Substitute (3) into (1) and use (2) to get this identity, after a little algebra:
$$
dw^2-dr^2-V(r)(dw+dr)^2-r^2 d\Omega^2
=
\big(1-V(r)\big)dt^2-\frac{dr^2}{1-V(r)}-r^2d\Omega^2.
\tag{4}
$$ | {
"domain": "physics.stackexchange",
"id": 72540,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "general-relativity, black-holes, event-horizon, singularities",
"url": null
} |
energy
Title: Relatively how much energy do fluorescent light tubes take to turn on? Fluorescent lights are already efficient when they’re running but I’ve heard that it takes a lot of energy to turn a fluorescent light tube on. So is it more efficient to turn off a fluorescent tube immediately when you’ve finished using it or is it better to leave it on and then wait until you’re more likely to not use it again for a while? A fluorescent light uses as much energy getting started as it des to run for 23.3 seconds. In other words, that is a bit of a myth about leaving it on for very long. If you’re going to be in the room and gone for less than 23.3 seconds there’s no point it on, basically. You might as well turn it off because it uses not very much more energy. To put that in comparison, an LED has to run for 1.28 seconds before it uses as much energy. The good old-fashioned incandescent lamp: 0.36 seconds before it’s used as much energy it does running as it does to turn it on. | {
"domain": "physics.stackexchange",
"id": 5595,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "energy",
"url": null
} |
algorithms, time-complexity, space-complexity, radix-sort
}
std::cout << "Before sorting: \n";
print_array(arr);
radix_sort(arr);
std::cout << "After sorting: \n";
print_array(arr);
return 0;
}
The time complexity is O(kn) and space complexity is O(k + n). Here n is the number of elements and k is the number of bits required to represent largest element in the array. My problem is with k and I am not able to understand how that effects the complexity. In the above code the number of times the outermost while loop runs depends on the number of digits of maximum value. Until recently I assumed that k represented this number of digits of maximum value. However, that is not the case. Can anyone please explain in simpler terms?
Edit: Pseudocode
1) Take the array as input
2) Initialize a variable `rad` as 1
3) Find maximum value element in the array
4) Until all the digits in maximum value element are visited:
i) Create buckets for digits from 0 to 9. | {
"domain": "cs.stackexchange",
"id": 12259,
"lm_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, time-complexity, space-complexity, radix-sort",
"url": null
} |
And similarly we can obtain all the other elements of $\mathrm{G}(\mathbf{K}/\mathbb{Q})$. My question is then, since we only defined $\Psi_{1,2}$ in terms of its action on $\alpha_1$, how do we determine the action of this $\Psi_{1,2}$ on $\alpha_2$ and $\alpha_3$ without actually computing numerically? That is, without using the fact that we know the numerical values of the $\alpha_i$? Can we?
Some preliminaries we know: $\Psi_{1,2}$ maps roots of polynomials onto other roots of the same polynomial, so I really only need to figure out if $\Psi_{1,2}(\alpha_2)$ is $\alpha_1$ or if it is $\alpha_3$.
I've tried using the properties of $\mathbf{K}$ as a vector space over $\mathbb{Q}$:
$$\Psi_{1,2}(\alpha_2) = \Psi_{1,2}(a_0 + a_1\alpha_1 + a_2\alpha_1^2) = a_0 + a_1\alpha_2 + a_2\alpha_2^2,$$ where $a_i \in \mathbb{Q}.$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9907319879873276,
"lm_q1q2_score": 0.8190498192322087,
"lm_q2_score": 0.8267117940706735,
"openwebmath_perplexity": 92.97965961086115,
"openwebmath_score": 0.9551321864128113,
"tags": null,
"url": "https://math.stackexchange.com/questions/1421573/general-way-to-find-actions-of-automorphisms-of-the-group-of-x3-2-over-math/1421592"
} |
condensed-matter, hamiltonian, greens-functions, second-quantization
\partial_\tau G_{k l}(\tau) &= -\delta(\tau) \delta_{k l} - \sum_{m} h_{k m} G_{m l}(\tau) \\
\delta_{k l} &= \sum_{m} (i\omega \cdot \delta_{k m} - h_{k m}) G_{m l}(i\omega) ~. \tag{1} \end{align}$$
We see that $G(i\omega)$ -- understood as a matrix -- is inverse to $Q$ with $Q_{k l} := (i\omega \cdot \delta_{k l} - h_{k l})$. Another approach is given by the resolvent $\mathcal{G}(z) = (z - \tilde{H})^{-1}$. Then $\mathcal{G}_{k l}(i \omega) = \langle k \vert (i \omega - \tilde{H})^{-1} \vert l \rangle$ which apparently satisfies Eq. (1) and therefore $\mathcal{G}_{k l}(i \omega) = G_{k l}(i\omega)$. This is a useful relation and used at several occasions in the previous research from students and my research. | {
"domain": "physics.stackexchange",
"id": 15851,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "condensed-matter, hamiltonian, greens-functions, second-quantization",
"url": null
} |
standard-model, strong-force, gluons
$$\begin{pmatrix}1 & 0 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & -1\end{pmatrix}$$
which is physically valid, and the conclusions are all the same. This shows you why this gluon, despite containing colors and anticolors in equal combinations, is not white.
Note that the technical term for what you think of as "white" is "$SU(3)$ singlet". | {
"domain": "physics.stackexchange",
"id": 62893,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "standard-model, strong-force, gluons",
"url": null
} |
quantum-mechanics, heisenberg-uncertainty-principle, measurement-problem
Title: Is the uncertainity principle a practical reality, a theoretical law or a measurement problem? I understand we cannot state with arbitrary precision the position and momentum of a micro-particle as we superpose infinite waves to create a wave packet at the exact position of the particle and hence cannot say which wave is corresponding to its momentum. This is theoretically said. Also some people say that measurement of one disturbs the other and some say it's reality.
Firstly, the theoretical explanation: why should I consider that a wave out of many superposed will give us the momentum or position? We might use another single wave which is not sine in nature and might get the results. Or why won't a single sine wave suffice? This all considers the micro-particle as wave because of de Broglie.
Secondly, the practical thing seems legit. | {
"domain": "physics.stackexchange",
"id": 16734,
"lm_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, heisenberg-uncertainty-principle, measurement-problem",
"url": null
} |
thermodynamics, black-holes, entropy, information
...1.1) The question I asked you is if you actually know the following. Given that an observer has crossed an event horizon of any astrophysical black hole (further BH), possible nonstationary, can the observer escape it, under any processes, still in the GR picture.
...2) All perturbed BHs, including rotating ones, are known to settle down by emitting gravitational radiation. This is supported by perturbation theory and numerical relativity. If you throw in an observer, considering him as a perturbation, the system will settle down in the end, and hence the observer shall get static and get absorbed in the black hole solution, hence find himself on a singularity. | {
"domain": "physics.stackexchange",
"id": 2665,
"lm_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, black-holes, entropy, information",
"url": null
} |
statistical-mechanics, field-theory, ising-model
In the mean-field theory one suppresses the fluctuations by setting them to zero. Of course this is justified only if on average the fluctuations are much smaller than the magnitude of the mean-field itself. Therefore the Ginzburg criterion is actually written as:
$$\left< \left(\delta \phi\right)^2\right>\ll \left< \phi^2\right>,$$
where $\delta \phi$ is the fluctuation from the mean-field. Mathematically, one can then write the Ginzburg criterion as
$$\frac{\sqrt{\left<\phi^2\right> - \left<\phi\right>^2}}{\left<\phi\right>}\ll 1,$$
i.e. the relative fluctuations of the $\phi$ field are negligible. | {
"domain": "physics.stackexchange",
"id": 58657,
"lm_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, field-theory, ising-model",
"url": null
} |
Clearly all fractions are of that it can't be the terminating decimals because they're rational. How To Find Irrational Numbers Between Two Decimals DOWNLOAD IMAGE. 0.5 can be written as ½ or 5/10, and any terminating decimal is a rational number. The vast majority are irrational numbers, never-ending decimals that cannot be written as fractions. The only candidates here are the irrational roots. Rational numbers. In mathematics, a number is rational if you can write it as a ratio of two integers, in other words in a form a/b where a and b are integers, and b is not zero. 9 years ago. Include the decimal approximation of the ...” in Mathematics if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions. Learn the difference between rational and irrational numbers, and watch a video about ratios and rates Rational Numbers. Take this example: √8= 2.828. In short, rational numbers are whole numbers, fractions, and decimals — the | {
"domain": "consumercredentials.com",
"id": null,
"lm_label": "1. Yes\n2. Yes",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9877587218253718,
"lm_q1q2_score": 0.8716258229992327,
"lm_q2_score": 0.8824278680004706,
"openwebmath_perplexity": 324.3653039637664,
"openwebmath_score": 0.7487418055534363,
"tags": null,
"url": "https://consumercredentials.com/avdcz/8a9c97-how-to-find-irrational-numbers-between-decimals"
} |
everyday-chemistry, photochemistry, applied-chemistry
Probably not! The energy released from the excited state of the 3-aminophthalate dianion formed in the oxidation of luminol (or rather its dianion) by hydrogen peroxide in alkaline is released in form of light. There's little to no heat released in this chemoluminescent reaction. | {
"domain": "chemistry.stackexchange",
"id": 2807,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "everyday-chemistry, photochemistry, applied-chemistry",
"url": null
} |
java, beginner, object-oriented, file, git
Random remarks about the code: | {
"domain": "codereview.stackexchange",
"id": 16686,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, beginner, object-oriented, file, git",
"url": null
} |
Methods twenty Multiple Choice Questions as well as Answers, Numerical method multiple selection question, Numerical method brusk question, Numerical method question, Numerical method fill upwards inward the blanks, Numerical method viva question, Numerical methods brusk question, Numerical method query as well as answer, Numerical method query answer. Syllabus for the subject MA6452 MA6452 Statistics and Numerical Methods can be downloaded in tnscholars. The goal of the course is to understnad how the digital computer is used to solve problems in mathematical analysis. This course gives an introduction to numerical methods and statistics essential in a wide range of engineering disciplines. Numerical methods for finding the roots of a function The roots of a function f(x) are defined as the values for which the value of the function becomes equal to zero. background for understanding numerical methods and giving information on what to expect when using them. Numerical analysis — Data | {
"domain": "sicituradastra.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9814534349454033,
"lm_q1q2_score": 0.8262126789622931,
"lm_q2_score": 0.8418256532040708,
"openwebmath_perplexity": 1277.6425196467615,
"openwebmath_score": 0.262675940990448,
"tags": null,
"url": "http://sicituradastra.it/ieih/questions-on-numerical-methods.html"
} |
GMAT Question of the Day - Daily to your Mailbox; hard ones only
It is currently 21 Nov 2018, 08:10
# LBS is Calling R1 Admits - Join Chat Room to Catch the Latest Action
### GMAT Club Daily Prep
#### Thank you for using the timer - this advanced tool can estimate your performance and suggest more practice questions. We have subscribed you to Daily Prep Questions via email.
Customized
for You
we will pick new questions that match your level based on your Timer History
Track
every week, we’ll send you an estimated GMAT score based on your performance
Practice
Pays
we will pick new questions that match your level based on your Timer History
## Events & Promotions
###### Events & Promotions in November
PrevNext
SuMoTuWeThFrSa
28293031123
45678910
11121314151617
18192021222324
2526272829301
Open Detailed Calendar
• ### All GMAT Club Tests are Free and open on November 22nd in celebration of Thanksgiving Day!
November 22, 2018
November 22, 2018
10:00 PM PST
11:00 PM PST | {
"domain": "gmatclub.com",
"id": null,
"lm_label": "1. Yes\n2. Yes",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9496693674025232,
"lm_q1q2_score": 0.8145960988234274,
"lm_q2_score": 0.8577681104440172,
"openwebmath_perplexity": 3012.7435268109807,
"openwebmath_score": 0.5769270062446594,
"tags": null,
"url": "https://gmatclub.com/forum/if-t-is-a-set-of-35-consecutive-integers-of-which-17-are-negative-254845.html"
} |
ros, nodelets
The problem with that is that it is slow. So much so that for larg(e)(ish) messages (typically anything above the L1 cache size of your cpu) the time spend on (de)serialisation can actually start to dominate the time it takes to send and receive a message. It would be nice if we could avoid (de)serialising messages all together, but due to the isolation that processes 'enjoy', we can't.
Enter nodelets: threads by definition share a single address space (as they live in a single process), which basically means that they share each other's memory. This completely removes the need for (de)serialisation and thus the overhead incurred by that process and makes it possible to exploit something called zero-copy data-transfer, which in this case comes down to exchanging pointers to message objects instead of copying message objects. | {
"domain": "robotics.stackexchange",
"id": 27154,
"lm_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, nodelets",
"url": null
} |
java
Title: Linearized Fit to Data I'm creating a class to describe a "zigzag line" fit to a set of data. It implements my interface Fittable, which just contains evaluate() (I have mulitple kinds of curves that all implement this interface). I created the private inner class Node to describe a vertex. It will give the slope going to the left and the slope to the right.
I'm doing a double-check in evaluate(). I am determining the value based off both the floor() and ceiling() values. However, sometimes I get values that don't match up and the IllegalStateException is being thrown. This is because the values for the slopes aren't the same, which lends me to believe that there's a problem with my while loop in the constructor, but I need a fresh set of eyes.
Of course, optimizations are always welcome.
import java.util.Comparator;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.TreeSet; | {
"domain": "codereview.stackexchange",
"id": 2111,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java",
"url": null
} |
c++, template, pointers
// Use the const version
template<typename T>
T &Smart_pointer_base<T>::operator*()
{
const auto& res = const_cast<const Smart_pointer_base*>(this)->operator*();
return const_cast<T&>(res);
}
// Use the const version
template<typename T>
T *Smart_pointer_base<T>::operator->()
{
const auto* res = const_cast<const Smart_pointer_base*>(this)->operator->();
return const_cast<T*>(res);
}
#endif // !BLOB_SMART_POINTER_BASE_TPP
Shrd_ptr.h
#ifndef BLOB_SHRD_PTR_H
#define BLOB_SHRD_PTR_H
#include <cstddef>
#include "Smart_pointer_base.h"
#include <functional>
#include <utility>
template <typename Y> const Y safe_increment(Y*);
template <typename Y> const Y safe_decrement(Y*); | {
"domain": "codereview.stackexchange",
"id": 33417,
"lm_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++, template, pointers",
"url": null
} |
genetics
What confuses me is the fact that our textbook discusses dihybrid and trihybrid (concerning 2 genes and 3 genes, respectively) crosses under the Mendelian inheritance chapter, when to me it seems like these crosses are non-Mendelian because they deal with multiple genes. However, Gregor Mendel did in fact use the dihybrid cross to deduce the law of independent assortment, so I'm completely confused. Could someone please clarify this for me? I'm afraid that I'm maybe misinterpreting something. You can discuss multiple genes within the framework of Mendelian inheritance; what you're probably thinking of, though, is the fact that Mendelian inheritance doesn't recognize the idea of multiple genes that contribute to a single trait. | {
"domain": "biology.stackexchange",
"id": 4996,
"lm_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",
"url": null
} |
quantum-mechanics, probability, quantum-interpretations, foundations
In general, the meaning of $P\in {\cal P}(H)$ is something like
"the value of the observable $Z$ belongs to the subset $I \subset \mathbb R$" for some observable $Z$ and some set $I$. There is a procedure to integrate such a class of projectors labelled on real subsets to construct a self-adjoint operator $\hat{Z}$ associated to the observable $Z$, and this is nothing but the physical meaning of the spectral decomposition theorem.
If $P, Q \in {\cal P}(H)$, there are two possibilities: $P$ and $Q$ commute or they do not.
Von Neumann's fundamental axiom states that commutativity is the mathematically corresponding of physical compatibility.
When $P$ and $Q$ commutes, $PQ$ and $P+Q-PQ$ still are orthogonal projectors, that is elements of ${\cal P}(H)$. | {
"domain": "physics.stackexchange",
"id": 31229,
"lm_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, probability, quantum-interpretations, foundations",
"url": null
} |
imu, navigation, ros-melodic, robot-localization
I have read several posts of interest and tried different things but none of them worked.
The IMU frequency is 70Hz vs 30Hz of the robot localization. I tried using 70 Hz for the filter and reduce the sensor timeout to avoid queuing messages.
I have tried to set the initial_estimate_covariance for the angular rate z to be 100 as suggested in other posts and I ensured that the process_noise_covariance for this angular component is bigger compared to the IMU. It is easy since the covariance of the IMU is really small.
Thanks so much! I appreciate anybody who takes the time to read this :)
Originally posted by xaru8145 on ROS Answers with karma: 105 on 2020-05-06
Post score: 0
I have been on the same situation...its memory leak it's pretty common , set the IMU publisher and EKF freq. to 50 it will sync. never publish any publishers at 70Hz, always go with [10,20,50,80,100,120,150]Hz, these are values worked for me try it out and let me know | {
"domain": "robotics.stackexchange",
"id": 34907,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "imu, navigation, ros-melodic, robot-localization",
"url": null
} |
rust, union-find
self.roots.insert(insertion_idx);
Ok(insertion_idx)
} else {
Err(elem)
}
}
/// If present, returns an immutable reference to the element at `elem_idx`.
pub fn get(&self, elem_idx: usize) -> Option<&T> {
// Nothing in our code actually mutates node.elem: T using &self.
// Even find_root_idx uses interior mutability only
// to modify node.parent. And the caller can't
// call get_mut or iter_mut_set while the &T here is
// still in scope. So it all works out!
Some(unsafe { &*self.get_raw(elem_idx)? })
} | {
"domain": "codereview.stackexchange",
"id": 40739,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "rust, union-find",
"url": null
} |
qiskit, quantum-gate, linear-algebra
So more needs to be specified. Do you want to write the gate as a sum over projection operators, like $U = \sum_{i={0,1}} |i\rangle\langle i| U_i$? That's not possible in general (consider the swap gate). Do you want a decomposition with the minimum number of terms? That sounds tricky, especially the n-qubit case. Probably worth a separate question!
It's not too bad to say something useful about the two-qubit case, using the Cartan decomposition. Any two-qubit unitary can be written as
$$U = U_1 \otimes U_2 \exp(-i(c_x X\otimes X + c_y Y\otimes Y + c_z Z\otimes Z)) V_1^\dagger \otimes V_2^\dagger$$ | {
"domain": "quantumcomputing.stackexchange",
"id": 4711,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "qiskit, quantum-gate, linear-algebra",
"url": null
} |
organic-chemistry, solubility
Title: Can I solubilize lemon essence in water somehow? I have a water based solution (95% water, the rest are salts) to which I want to add a lemon fragrance. I bought "water based lemon essence", but upon putting a mere drop in about 500 mL, the solution turned from crystal clear to milky off-white.
I researched and found that lemon essence is apparently one of many essential oils (citral, citronellal, cintronellol). None of which are water-soluble. That's why the result is an emulsion, and it's not translucent. (It mixed very well and it's very stable, that's not my problem)
I was wondering then if it's possible to give lemon fragrance to a water solution without turning it into a milky emulsion. Some hints are provided by Wikipedia:Lemon liqueur: | {
"domain": "chemistry.stackexchange",
"id": 15121,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "organic-chemistry, solubility",
"url": null
} |
orbital-motion, atmospheric-science, earth, space
Title: Why can atmospheric re-entry heat up the air into plasma?
The adiabatic processes of re-entering earth from a spaceship, creates intense heat. Heat in the range of 1700-2000 degrees Celsius.
I've read the the temperature in the air molecules generate a very hot plasma which glows in the red-orange spectrum.
But Di-nitrogen should only turn plasma 10.000 + degrees Celsius.
How is this possible? I'm guessing the 1700-2000 temperature is only at the spacecraft, while only the surrounding air are reaching these plasma temperatures. But I can't find sources. Nice question. By re-entering atmosphere spaceship transfers it's kinetic energy to impacting air molecules, thus molecules starts to move at a spaceship speed too. Knowing average molecules speed (which would be an aircraft speed) we can calculate shock-wave zone gas temperature :
$$ T={m{\overline {v^{2}}} \over 3k_{B}} $$ | {
"domain": "physics.stackexchange",
"id": 65297,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "orbital-motion, atmospheric-science, earth, space",
"url": null
} |
java, object-oriented, android, mvvm
.. Other fragment specific methods
}
public class AddEditXFragmentViewModel extends AndroidViewModel {
private XRepository xRepository;
public AddEditXFragmentViewModel(@NonNull Application application) {
super(application);
xRepository = new XRepository(application);
}
public void insert(X x) { xRepository.insert(x); }
public void update(X x) { xRepository.update(x); }
public void delete(X x) { xRepository.delete(x); }
.. Other fragment specific methods
}
public class YListingFragmentViewModel extends AndroidViewModel {
private YRepository yRepository;
private LiveData<List<Y>> allYs; | {
"domain": "codereview.stackexchange",
"id": 37127,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, object-oriented, android, mvvm",
"url": null
} |
java, finance
private boolean isTxTransaction(Transaction trnObj) {
return trnObj.getTransactionType().toLowerCase().equals("tx");
}
private boolean verifyAuthPin(User user, User userRecord) {
return userRecord.getAccount().getAuthPin().intValue() ==
user.getAccount().getAuthPin().intValue();
}
private boolean verifyMobilePhone(User user, User userRecord) {
return userRecord.getMobileNumber().intValue() ==
user.getMobileNumber().intValue();
}
We have many small methods now, but we can easily move them to their related class.
For example, we move isTxTransaction and hasBigAmount right in the Transaction class:
Transaction.java :
public boolean isTx() {
return getTransactionType().toLowerCase().equals("tx");
}
public boolean hasBigAmount() {
return getTransactionAmount().intValue() > 1000;
} | {
"domain": "codereview.stackexchange",
"id": 17476,
"lm_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, finance",
"url": null
} |
java, design-patterns
@Override
public void addSauce() {
prepareTips.addSauceTips();
}
@Override
public void addToppings() {
List<String> myToppings = Arrays.asList("Mushrooms", "Onions", "Green peppers", "Pineapple");
pizza.setToppings(new ArrayList<>(myToppings));
}
@Override
public void addMeat() {
pizza.setBacon("Uncured Belly Rashers(bara)");
pizza.setPepperoni("Peppers Pepperoni");
}
@Override
public void addCheese() {
pizza.setCheese("Mozzarella with Extra Cheese: Cheddar, Provolone, Grated Parmesan");
}
@Override
public void putPizzaInOven() throws InterruptedException {
System.out.println("Final 10-sec baking of cheese pizza...");
oven.setTimer(10);
}
public Pizza takeOutPizzaFromOven() {
return pizza;
}
} | {
"domain": "codereview.stackexchange",
"id": 25093,
"lm_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, design-patterns",
"url": null
} |
c#, performance, memory-optimization, chess
class Program
{
static void GetPaths(List<Square> path, Square currentRookPosition, Square destinationPosition, int level)
{
path.Add(currentRookPosition);
if (currentRookPosition == destinationPosition)
{
pathsFound++;
return;
} | {
"domain": "codereview.stackexchange",
"id": 42340,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, performance, memory-optimization, chess",
"url": null
} |
quantum-mechanics, energy, quantum-states
If the 'absolute' energy comes out negative, it just means that it is possible to harvest work from the system while you take it from the reference state to the state you're interested, just like positive-energy states require work to be put in to take them there from the reference. Zero-energy states are in the middle - they don't require any net work transfers for that transition. | {
"domain": "physics.stackexchange",
"id": 55069,
"lm_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, energy, quantum-states",
"url": null
} |
machine-learning, probability, decision-theory, probability-distribution
Title: Why is the entire area of a join probability distribution considered when it comes to calculating misclassification? In the image given below, I do not understand a few things
1) Why is an entire area colored to signify misclassification? For the given decision boundary, only the points between $x_0$ and the decision boundary signify misclassification right? It's supposed to be only a set of points on the x-axis, not an area.
2) Why is the green area with $x < x_0$ a misclassification? It's classified as $C_1$ and it is supposed to be $C_1$ right?
3) Similarly, why is the blue area a misclassification? Any $x >$ the decision boundary belongs to $C_2$ and is also classified as such... The misclassifications that could arise if $\hat{x}$ is used as decision boundary are:
a) Classifying a point as $C_2$ when actually it was $C_1$ -- which will only happen when $x > \hat{x}$ as only the points greater than $\hat{x}$ are being classified as $C_2$. | {
"domain": "ai.stackexchange",
"id": 1311,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "machine-learning, probability, decision-theory, probability-distribution",
"url": null
} |
php, object-oriented, parsing, reinventing-the-wheel
/**
* API class that allows static usage of the master INI controller
*
* Provides a static interface for direct manipulation of INI files. All methods in this class directly read from and
* write to INI files.
*
* @api
* @package SierraKomodo\INIController
* @uses \SierraKomodo\INIController\Controller
* @version 0.1.0-dev Currently in development; Not fully tested yet.
*/
class StaticController extends Controller
{
/**
* Adds/sets a specified key=value pair to an INI file.
*
* @param string $parFile
* @param string $parSection
* @param string $parKey
* @param string $parValue
* @param bool $parCreateFile If set to bool 'TRUE', will attempte to create $parFile if it doesn't already exist. Defaults to bool 'FALSE'
* @return bool True on success
* @uses \SierraKomodo\INIController\Controller::$fileArray
* @uses \SierraKomodo\INIController\Controller::readFile() | {
"domain": "codereview.stackexchange",
"id": 25560,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "php, object-oriented, parsing, reinventing-the-wheel",
"url": null
} |
situations discussed in the following sense 1... Standard deviation of the atom simulator and select the exponential-logarithmic distribution \beta =1\, \ = 1 Y\ are! Assume that \ ( \pm \ ) standard deviation of the exponential lifetime of the distribution... Cashier is three minutes where [ math ] \beta =1\, \ the shape parameter and note the and! Constant average rate as: Taboga, Marco ( 2017 ) theory and mathematical statistics Third! Mathematically define the exponential distribution is often concerned with the amount of time ( beginning now ) until earthquake! Define the exponential distribution is one exhibiting a random arrival pattern in the following sense: 1 \beta. Which half of the exponential distribution continuously and independently at a constant average rate also a Weibull distribution where math... Full sample case, the amount of time until some specific event occurs life is the sample mean value... Is one exhibiting a random arrival pattern in the chapter on | {
"domain": "ibizasailing.net",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9697854120593483,
"lm_q1q2_score": 0.82999195900592,
"lm_q2_score": 0.8558511488056151,
"openwebmath_perplexity": 679.9590414879955,
"openwebmath_score": 0.8454276919364929,
"tags": null,
"url": "https://ibizasailing.net/aatwy2/69a78e-exponential-distribution-mean"
} |
organic-chemistry, hybridization
Title: Why and how does carbon hybridize itself according to its need? Sometimes carbon forms sp3 orbital and sometimes sp2 and sp. Also, carbon chains are more stable with sp3 orbitals. So, why and how does carbon hybridize itself to other orbitals?
My question is more about stability. It's not about how it is significant to organic chemistry. For example, Methane which has 'sp3' orbitals is stable because of its sigma bonds. But, ethene, which has a pi bond is not stable and is more reactive than methane. So, why does carbon form this 'pi bond' while on the other hand has a better option of a sigma bond. Hybridization is part of the language chemists use to speak to one another. When someone says that a carbon atom is $\ce{sp^2}$ hybridized, it's a shorthand way of telling others | {
"domain": "chemistry.stackexchange",
"id": 4372,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "organic-chemistry, hybridization",
"url": null
} |
java, io
For simplicity sake I would still recommend you use a forward cursor, and a circular buffer. This will work for all files regardless of the size, but the performance will be related to the size. On my system though, even 20MB files were done within moments (0.3 seconds according to the bash 'time' command). So that are not too large (a couple of megabytes), and is easy:
String[] lines = new String[10];
int count = 0;
String line = null;
while ((line = bufferedReader.readLine()) != null) {
lines[count % lines.length] = line;
count++;
} | {
"domain": "codereview.stackexchange",
"id": 11888,
"lm_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, io",
"url": null
} |
operators, hamiltonian, commutator, partition-function
$$
e^{-\beta \tilde H} = Ue^{-\beta H}U^\dagger
$$
and finally, using that the trace is invariant by conjugacy, you get:
$$
\text{Tr}[e^{-\beta \tilde H}] = \text{Tr}[e^{-\beta H}]
$$
i.e. both partition functions are equal.
Hope this helps. | {
"domain": "physics.stackexchange",
"id": 98384,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "operators, hamiltonian, commutator, partition-function",
"url": null
} |
z-transform
Title: Inverse $\mathcal Z$-transform when region of convergence goes outwards from the inner pole? I am looking for the inverse $\mathcal Z$-transform of the following:
$$
\frac{1}{1-\frac 12 z^{-1}}+\frac{1}{1+\frac 13 z^{-1}}
$$
When the region of convergence is $z > 1/3$. I have found the $\mathcal Z$-transform for when $z > 1/2$ as a right sided signal:
$$
\left(\frac{1}{2}\right)^n u[n] + \left(-\frac{1}{3}\right)^n u[n]
$$
I can't seem to find a inverse $\mathcal Z$-transform when the ROC goes outwards from the inner pole. Does the inverse $\mathcal Z$-transform not exist for $z>1/3$? There exist $3$ sequences with the given expression as their $\mathcal{Z}$-transform. These $3$ sequences correspond to $3$ different regions of convergence (ROCs):
$|z|>\frac12$: right-sided
$\frac13<|z|<\frac12$: two-sided
$|z|<\frac13$: left-sided | {
"domain": "dsp.stackexchange",
"id": 6072,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "z-transform",
"url": null
} |
cosmology, big-bang, quantum-chromodynamics, quarks, confinement
Title: If free quarks can't exist, how did the universe form? As I understand, the Big Bang started with a photon gas that then created the other particles. Thus obviously there would be some free quarks in the early Universe unless quarks are always created in pairs for some reason. How does physics resolve this? "Free quarks can't exist" is simply an oversimplification of the actual situation in quantum chromodynamics (QCD). A better statement is "free quarks cannot exist at low energies", where "low energy" means below the deconfinement scale. | {
"domain": "physics.stackexchange",
"id": 38476,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "cosmology, big-bang, quantum-chromodynamics, quarks, confinement",
"url": null
} |
Excellent. Thanks. Let me see if I understand. Say the game ends in 7 rounds. The possible outcomes are:
$$25 \cdot 24 \cdot 23 \cdot 22 \cdot 21 \cdot 20 \cdot 19$$
One way to make this happen is to draw 1-1-1-2-3-4-5, which gets us:
$$25 \cdot 4 \cdot 3 \cdot 20 \cdot 15 \cdot 10 \cdot 5$$
favorable outcomes.
The three equal cards can be in $\binom 7 3$ positions. So the probability is:
$$P(\text{game ends in 7, with 3-of-a-kind}) = \frac{\text{#favorable outcomes}}{\text{#total outcomes}} =\binom 7 3 \cdot \frac{25 \cdot 4 \cdot 3 \cdot 20 \cdot 15 \cdot 10 \cdot 5}{25 \cdot 24 \cdot 23 \cdot 22 \cdot 21 \cdot 20 \cdot 19} \approx 6.5\%$$
Yep!
(Let's continue before considering game end in 5 or 6.) | {
"domain": "mathhelpboards.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9770226267447513,
"lm_q1q2_score": 0.8304410744113625,
"lm_q2_score": 0.8499711794579723,
"openwebmath_perplexity": 602.8479321860061,
"openwebmath_score": 0.5511772036552429,
"tags": null,
"url": "https://mathhelpboards.com/threads/suits-but-no-values-a-card-game-not-a-law-firm-description.8359/#post-38654"
} |
c++, linked-list, iterator
/* Useful functions for internal purposes */
constexpr void deallocate(ForwardList& other) noexcept {
if (!other.m_head) { return; }
Node* current_node = other.m_head;
while (current_node != nullptr) {
Node* next_node = current_node->next;
delete current_node;
current_node = next_node;
}
other.m_head = nullptr;
other.m_tail = nullptr;
other.m_size = 0;
}
public:
using value_type = Type;
using size_type = std::size_t;
using difference_type = std::ptrdiff_t;
using reference = value_type&;
using const_reference = const value_type&;
using pointer = Type*;
using const_pointer = const pointer;
using iterator = forward_iterator<value_type>;
using const_iterator = forward_iterator<const Type>; | {
"domain": "codereview.stackexchange",
"id": 40611,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, linked-list, iterator",
"url": null
} |
java, gui
If you held all these Line2D as an array named lines could refactor the above as:
for (Line2D line : lines) {
g2.draw(line);
}
Similarly, if you declare your Point2DFloat as an array you could simply match the right points using index e.g.
pointfloats[0] = new Point2D.Float(245, 88);
// etc...
for (int i = 0, j = 0; i < lines.length; i++, j += 2) {
lines[i] = new Line2D.Float(pointfloats[j], pointfloats[j + 1]);
}
Do note that we're still declaring the points line by line. This is undesirable and you have 'magic numbers' all over the place. A better approach would be to externalize this data, and read it all into a data array so you can just have 3 arrays and loops to connect them. This also has the added benefit of not needing to compile for a data change.
This really goes for most of this code, as all that needs to be done is to hold the objects in an array e.g. your ActionListener setSelected procedure should just be 1 loop. | {
"domain": "codereview.stackexchange",
"id": 26523,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, gui",
"url": null
} |
$\blacksquare$
## Proof 2
Let $x \in S$ througout.
$\ds$ $\ds x \in \relcomp S {T_1 \cup T_2}$ $\ds$ $\leadsto$ $\ds x \notin \paren {T_1 \cup T_2}$ Definition of Relative Complement $\ds$ $\leadsto$ $\ds \neg \paren {x \in T_1 \lor x \in T_2}$ Definition of Set Union $\ds$ $\leadsto$ $\ds x \notin T_1 \land x \notin T_2$ De Morgan's Laws: Conjunction of Negations $\ds$ $\leadsto$ $\ds x \in \relcomp S {T_1} \land x \in \relcomp S {T_2}$ Definition of Relative Complement $\ds$ $\leadsto$ $\ds x \in \relcomp S {T_1} \cap \relcomp S {T_2}$ Definition of Set Intersection $\ds$ $\leadsto$ $\ds \relcomp S {T_1 \cup T_2} \subseteq \relcomp S {T_1} \cap \relcomp S {T_2}$ Definition of Subset | {
"domain": "proofwiki.org",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9895109090493823,
"lm_q1q2_score": 0.8288340913558332,
"lm_q2_score": 0.8376199633332891,
"openwebmath_perplexity": 365.37121669382265,
"openwebmath_score": 0.9547641277313232,
"tags": null,
"url": "https://proofwiki.org/wiki/De_Morgan%27s_Laws_(Set_Theory)/Relative_Complement/Complement_of_Union"
} |
c++, queue, breadth-first-search
// add input filters to the list
for(BaseFilterMap::const_iterator it = m_Filters.begin(); it != m_Filters.end(); it++)
{
string FilterName = (*it).first;
const CBaseFilter *filter = (*it).second;
if(filter->IsInputFilter())
{
//push the input filter
filtersBFS.push(FilterName);
filtersToRun.push(FilterName);
alreadyFoundFilters.insert(FilterName);
}
}
while (!filtersBFS.empty())
{
string filterName = filtersBFS.front();
filtersBFS.pop();
//get the OutputPin connections for the next filter
FilterConnection* filterConnection = m_Connections[filterName];
ASSERT(filterConnection != NULL);
PinConnectionVector& outPinConnections = filterConnection->GetOutputPinConnections(); | {
"domain": "codereview.stackexchange",
"id": 5841,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, queue, breadth-first-search",
"url": null
} |
field-theory, definition, greens-functions, correlation-functions, propagator
$$
where $\Theta(x) = 1$ for $x > 0$ and $= 0$ otherwise. The Wightman function is defined as
$$
W(x,x^\prime) = \langle0| \varphi(x) \varphi(x^\prime) |0\rangle\,,
$$
i.e. without the time ordering constraint. But guess what? It solves $L_x W(x,x^\prime) = 0$. It's a kernel. The difference is that $\Theta$ out front, which becomes a Dirac $\delta$ upon taking one time derivative. If one uses the kernel with Neumann boundary conditions on a time-slice boundary, the relationship
$$
G_R(x,x^\prime) = \Theta(x^0 - x^{\prime\,0}) K(x,x^\prime)
$$
is general.
In quantum mechanics, the evolution operator
$$
U(x,t; x^\prime, t^\prime) = \langle x | e^{-i (t-t^\prime) \hat{H}} | x^\prime \rangle
$$
is a kernel. It solves the Schroedinger equation and equals $\delta(x - x^\prime)$ for $t = t^\prime$. People sometimes call it the propagator. It can also be written in path integral form.
Linear response and impulse response functions are Green functions. | {
"domain": "physics.stackexchange",
"id": 58786,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "field-theory, definition, greens-functions, correlation-functions, propagator",
"url": null
} |
• That is a better example thanks. I'm still confused as to why (0,0) is an undulation point for $f(x)=x^4$ though. Doesn't the sign of the derivative change either side of (0,0)? Jan 6 '15 at 18:41
• @GridleyQuayle: Yes, the derivative changes sign, but that is irrelevant to the definition of undulation point. The second derivative (and therefore the curvature) do not change sign, and that is what is relevant. Jan 6 '15 at 19:03
• If you go to the Wikipedia page for 'Inflection Point' and go to the section 'a necessary but not sufficient condition' the example is at the end of the first paragraph. Jan 6 '15 at 21:24
• @GridleyQuayle: Ah, yes, I see, you are right. I shall edit my answer accordingly. I referred to the graph later in the article. Jan 6 '15 at 22:21
• As a future visitor I thank You! Aug 17 '16 at 21:01
Who said it's not a local minimum? It certainly is. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9433475730993028,
"lm_q1q2_score": 0.8324361979222075,
"lm_q2_score": 0.8824278788223265,
"openwebmath_perplexity": 204.19805400145395,
"openwebmath_score": 0.7896084189414978,
"tags": null,
"url": "https://math.stackexchange.com/questions/1093323/what-is-the-difference-between-an-undulation-point-and-other-critical-values"
} |
general-relativity, dirac-delta-distributions
Title: 4D Dirac delta differential relation I'm self teaching from the Anthony Zee Book "Einstein Gravity in a Nutshell", and I came across the following expression.
$$\partial_\mu\delta^{(4)}(x-q_a(\tau_a))=\frac{\partial}{\partial x^\mu}\delta^{(4)}(x-q_a(\tau_a))=-\frac{\partial}{\partial q^\mu_a}\delta^{(4)}(x-q_a(\tau_a))$$
where $x$ is a position in 4-space, $\delta^{(4)}$ is the delta function in 4-space, $q_a$ is the wordline of particle $a$, and $\tau_a$ is the proper time of particle $a$. I'm having some trouble seeing how the middle term is equivalent to the third term. My only guess is that for some reason $\frac{\partial q_a^\mu}{\partial x^\mu}$ is somehow equal to negative one, but I can't see why. Any help would be appreciated. The relation Zee uses here is a fancy version of the following:
$$ \frac{\partial}{\partial x } f( x - y ) =
- \frac{\partial}{\partial y } f( x - y ).
$$
Can you see how this comes about? | {
"domain": "physics.stackexchange",
"id": 78397,
"lm_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, dirac-delta-distributions",
"url": null
} |
#### HallsofIvy
I have a basic question about taking partial derivatives.
Say I have a function of 3 variables and i want the derivative of only one. Do I take the derivative of the one variable and HOLD THE OTHER TWO CONSTANT? Or, do I take the derivative of the variable and TREAT THE OTHER TWO AS CONSTANTS?
What do you understand as the difference between "HOLD THE OTHER TWO CONSTANT" and "TREAT THE OTHER TWO AS CONSTANTS"?
For example
If I have f(x,y,z) = xy2+z3 and I want to find fx
Does that mean I get 2xy or 2xy+z3?
Like does that z drop out or do I literally not touch it? This isn't a homework question. I'm just trying to understand what the rule is.
Neither as you have been told. Whether you "TREAT THE OTHER TWO AS CONSTANTS" or
"HOLD THE OTHER TWO CONSTANT", what is the derivative of f(x)= xb2+ c, where b and c are constants.
#### Psycopathak
No,you are correct $$f_x$$ is the partial with respect to x.
#### Psycopathak | {
"domain": "physicsforums.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9787126482065489,
"lm_q1q2_score": 0.8091132850999184,
"lm_q2_score": 0.8267117898012104,
"openwebmath_perplexity": 705.6031875168701,
"openwebmath_score": 0.8236455917358398,
"tags": null,
"url": "https://www.physicsforums.com/threads/partial-differentiation-question.297361/"
} |
visible-light, popular-science, frequency, atmospheric-science
"The Distribution of Energy in the Visible Spectrum of Daylight". A. H. TAYLOR and G. P. KERR. J. Opt. Soc. Am. 31 no. 1, pp. 3-8 (1941)
. Also available here (pdf). | {
"domain": "physics.stackexchange",
"id": 10553,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "visible-light, popular-science, frequency, atmospheric-science",
"url": null
} |
special-relativity, particle-physics, kinematics
Title: Particle physics threshold energy I read the article Threshold energy on Wikipedia about colliding particles and their threshold energy.
Consider the case where a particle 1 with lab energy $E_1$ (momentum $p_1$) and mass $m_1$ impinges on a target particle 2 at rest in the lab, i.e. with lab energy and mass $E_2 = m_2$. The threshold energy $E_{1,thr}$ to produce three particles of masses $m_a,m_b,m_c$, i.e.
$1+2 \rightarrow a+b+c$
is then found by assuming that these three particles are at rest in the center of mass frame (symbols with hat indicate quantities in the center of mass frame):
$$E_{cm}=m_ac^{2}+m_bc^{2}+m_cc^{2}=\hat{E}_1+\hat{E}_2=\gamma(E_1-\beta p_1c)+\gamma m_2c^{2}$$
Here $E_{cm}$ is the total energy available in the center of mass frame.
Using $\gamma = \frac{E_1+m_2c^{2}}{E_{cm}}$, $\beta =\frac{p_1c}{E_1+m_2c^2}$, and $\ p_1^2c^2=E_1^2-m_1^2c^4$
one derives that
$$E_{1,thr}=\frac{(m_ac^2+m_bc^2+m_cc^2)^2-(m_1c^2+m_2c^2)^2}{2m_2c^2}$$ | {
"domain": "physics.stackexchange",
"id": 59226,
"lm_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, particle-physics, kinematics",
"url": null
} |
c#, image
if(Data.Length != Width * Height)
{
throw new Exception("size of the file does not match the expected number of channels");
}
}
public BlcResults CalculateBlackLevel()
{
long channelGR = 0;
long channelR = 0;
long channelGB = 0;
long channelB = 0;
long size = Width * Height;
switch(ColorSpace)
{
case 0: //RGGB, maybe make an union for the colorspaces
{
for(long offset = 0; offset < size;)
{
long line_end = offset + Height;
while(offset < line_end)
{
channelR += Data[offset++];
channelGR += Data[offset++];
} | {
"domain": "codereview.stackexchange",
"id": 14237,
"lm_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#, image",
"url": null
} |
The fact that the series for $e^A$ is easy to prove using matrix norms. In particular, you should try to prove the inequality $$\left\|e^A \right\| \leq e^{\|A\|}$$ if $\|\cdot\|$ is a norm (such as the Frobenius norm) which satisfies $\|AB\| \leq \|A\| \cdot \|B\|$ for all matrices $A,B$.
It is, in fact, a well known result that a matrix $A$ will be such that $e^{tA}$ is orthogonal for every $t \in \Bbb R$ if and only if $A$ is skew-symmetric, which is to say that $A^T = -A$. This is a commonly used result in the context of Lie Groups and Lie Algebras.
At the very least, you should try to prove that if $A^T = -A$, then $e^A$ is orthogonal.
I am not sure whether there are any other matrices $A$ for which $e^A$ is orthogonal.
A matrix $A$ such that $e^A$ is orthogonal but $A\neq A^T$: $$\pmatrix{0&1\\0&2\pi i}$$ or better yet $$\pmatrix{0&-1\\ 4 \pi^2 & 0}$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9817357221825194,
"lm_q1q2_score": 0.8026420710058255,
"lm_q2_score": 0.817574478416099,
"openwebmath_perplexity": 267.15227822623467,
"openwebmath_score": 0.9188372492790222,
"tags": null,
"url": "https://math.stackexchange.com/questions/1477541/for-which-orthogonal-matrices-does-the-matrix-exponential-converge"
} |
lambda-calculus, combinatory-logic, extensionality
Title: Algorithm for extensional equality in combinator calculus I'm dealing with combinator calculus, using the $S$ and $K$ combinators as a basis. Sometimes my code generates expressions that define equivalent functions, such as
$$
(S\, K\, K) \qquad\text{and}\qquad (S\, K\, (S\, (S\, S)\, K )),
$$
which both represent the identity function, but one of them is needlessly more complicated than the other.
"Extensional equality" is the terminology used when we consider two expressions to be equal if they represent the same function in this way. I would like to know whether there is an algorithm to determine whether two expressions are in fact extensionally equal. That is, can I determine in general whether two expressions represent the same mapping? | {
"domain": "cstheory.stackexchange",
"id": 5793,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "lambda-calculus, combinatory-logic, extensionality",
"url": null
} |
homework-and-exercises, general-relativity, astrophysics, kerr-metric, accretion-disk
Title: Effective potential for Kerr geometry In the review Foundations of Black Hole Accretion Disk Theory, the authors defines an effective potential for Kerr geometry as (Chap. 2, eqn. 23)
$$\mathcal{U}_{eff}=-\frac{1}{2}\ln\left|g^{tt}-2lg^{t\phi}+l^2g^{\phi\phi}\right|$$ where $l=\dfrac{\mathcal{L}}{\mathcal{E}}=-\dfrac{u_\phi}{u_t}$ is the specific angular momentum, $\mathcal{L}=p_\phi$ is the angular momentum and $\mathcal{E}=-p_t$ is the energy.
It is mentioned that this form of the potential is chosen because using the potential $\mathcal{U}_{eff}$, the rescaled energy $\mathcal{E}^*=\ln\mathcal{E}$ and $V=u^ru_r+u^\theta u_\theta<<u^\phi u_\phi$, slightly non-circular motion can be characterized by the the equation
$$\frac{1}{2}V^2=\mathcal{E}^*-\mathcal{U}_{eff}$$ | {
"domain": "physics.stackexchange",
"id": 61141,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises, general-relativity, astrophysics, kerr-metric, accretion-disk",
"url": null
} |
error-correction, experimental-realization, noise
Title: Exponential Growth of Noise in Quantum Computers I recently listened to a presentation for Introductory Quantum Computing. It was very general and meant to give the listeners an idea about the potential for Quantum Computing.
The speaker ended the talk with a kind of "On the Other Hand" talking point by mentioning that some people are concerned that the noise in Quantum Computers will grow at such a rate that limits their overall potential.
I was wondering if anyone on this channel has any experience with this issue or knowledge about it? Is this a theoretical limit of physics of an engineering problem? What is the current state of thinking about this issue and do recent breakthroughs in Quantum Error Correction do anything to address it? According to so-called threshold theorem, it is possible to get rid of errors in quantum computation with arbitrary precision. However, there is an assumption that you have enough qubits. | {
"domain": "quantumcomputing.stackexchange",
"id": 1588,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "error-correction, experimental-realization, noise",
"url": null
} |
java, unit-testing, collections, junit
@Test(expected = UnsupportedOperationException.class)
public void testPutNonNullKey() {
final Map<Integer, Object> autoKeyedMap = new HashCodeMap<>(new HashMap<Integer, Object>());
autoKeyedMap.put(0, TEST_VALUE);
}
This test is violating TDD and just ticking off checkboxes and code coverage. If a feature is unsupported, why does it have tests to ensure that it is not accidentally supported? Throw IllegalArgumentException instead; You don't allow non-null keys, so passing in a non-null argument is illegal.
* <p>
* If the key is not <code>null</code> then this method will throw an {@link UnsupportedOperationException}.
*
* This is due to the fact that the key is automatically derived by {@link #getKey(Object)} and should not be
* provided manually.
* </p>
You're violating Map's contract here: put's UnsupportedOperationException tends to mean "cannot put at all". From the documentation: | {
"domain": "codereview.stackexchange",
"id": 20662,
"lm_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, collections, junit",
"url": null
} |
cameras
Title: what's the difference among rgb-d camera, depth camera, 3d camera, and stereo camera? I'm very new in this field so my question may be very stupid. I apologize for this at first.
I'm trying to use a proper camera to run a SLAM algorithm. As suggested by some people, stereo camera may be a good choice. When I searched online, I found terms "stereo camera", "depth camera", "3d camera", and "rgb-d camera", and I feel confused. My understanding is "rgb-d camera" is more than "depth camera" because it has rgb channels while simple "depth camera" only makes white-black images. However, I have no idea about the difference from "stereo camera" and "3d camera". I know some camera options such as ZED, BumbleBee, Kinect, Intel RealSense, to me they are all "stereo camera".....
Anyone can give me some instructions? Thanks a lot in advance! 3D/Depth-Camera:
The most inclusive terms, only means that the camera gives you 3d data.
Stereo-Camera: | {
"domain": "robotics.stackexchange",
"id": 1689,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "cameras",
"url": null
} |
quantum-mechanics, hilbert-space, eigenvalue, observables
the same intellectual work minimalisation principles apply to functions spaces as much as they do to $\mathbb{R}^3$. Energy- or probability-conservative system transformations are then unitary and so on and so forth. | {
"domain": "physics.stackexchange",
"id": 10226,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, hilbert-space, eigenvalue, observables",
"url": null
} |
quantum-mechanics, operators, quantum-information, hilbert-space
Title: What is the condition for local operations on bipartite entangled state? I have an entangled state between Alice and Bob $|\psi\rangle_{AB}$ ( both Alice and Bob have states in Hiblert space of dimension $n$ ). Alice and Bob can only perform local meaurements. I assumed that POVM for measurements on the combined state will be of the form $E_A \otimes E_B$ where $E_A$ and $E_B$ ( both are operators on $n$ dimensional Hilbert space ) are local POVM's for Alice and Bob respectively . But the paper I am reading currently says the condition for measurement operators to be local is $[E_A,E_B]=0$ and here $E_A$ and $E_B$ are operators on $n^2$ dimensional Hilbert space. I can see my case is a specific case of the latter one but how does one explain this commuting condition for measurement operators to be local? Also can same analogy be extended to local unitary operations ? If we consider local operators $M_A$ and $N_B$ acting on Alice's and Bob's part, respectively, then it holds that | {
"domain": "physics.stackexchange",
"id": 22958,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, operators, quantum-information, hilbert-space",
"url": null
} |
robotic-arm, catkin, boost, find-package, cross-compiling
set(CMAKE_LIBRARY_PATH $ENV{HOME}/rpi/ros_catkin_ws/install_isolated $ENV{HOME}/rpi/ros_catkin_ws/install_isolated/lib)
set(BOOST_LIBRARYDIR /home/uav/rpi/rootfs/usr/lib)
set(Boost_LIBRARY_DIRS /home/uav/rpi/rootfs/usr/lib)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) | {
"domain": "robotics.stackexchange",
"id": 17770,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "robotic-arm, catkin, boost, find-package, cross-compiling",
"url": null
} |
automata
coming to your question ,its indeed an application of discrete mathematics in theory of automata ,so here is your answer. loosely speaking that countability of has little to no relation with being a set is finite or infinite. first thing , if a set is countable then the only condition associated of being it countable is that the cardinality the set ( total number of elements in set) should be lower or equal to that of natural number of positive integers. To simplify it more we can assign a unique natural number to all the elements of the set (please bear that although you may argue that the the list will go to infinte but as said in that infinite list we will have one-to-one correspondence on natural number to that of the elements of set. loosely speaking the condition of being countable is more of a theoritical aspect ) | {
"domain": "cs.stackexchange",
"id": 12229,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "automata",
"url": null
} |
nuclear-physics, mass-energy, binding-energy
Then we have the nuclear reaction for A
Some mass of A is transformed in energy, before the reaction there was a gravitational force on A from B (ignore for a moment the remaining interactions) and a related potential energy of this mass connected to the system B , but when transformed in energy where does this potential energy go? You use of potential energy is a bit off here. Potential energy remains constant through the calculation. Also the gravitational forces here are negligible. So we stay in special relativity. This makes the calculations easier. | {
"domain": "physics.stackexchange",
"id": 84502,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "nuclear-physics, mass-energy, binding-energy",
"url": null
} |
c++, object-oriented, parsing
while (iteratorPointingToTheElseToken <
iteratorPointingToTheEndIfToken) {
if (!counterOfIfBranches and
iteratorPointingToTheElseToken->text == "Else")
break;
if (iteratorPointingToTheElseToken->text == "If")
counterOfIfBranches++;
if (iteratorPointingToTheElseToken->text == "EndIf")
counterOfIfBranches--;
iteratorPointingToTheElseToken++;
}
if (iteratorPointingToTheElseToken <
iteratorPointingToTheEndIfToken) // If there is an "Else" token...
{
TreeNodes nodesThatTheRecursionDealsWith(
iteratorPointingToTheThenToken + 1,
iteratorPointingToTheElseToken);
nodesThatTheRecursionDealsWith =
parse(nodesThatTheRecursionDealsWith);
iteratorPointingToTheThenToken->children =
nodesThatTheRecursionDealsWith; | {
"domain": "codereview.stackexchange",
"id": 38968,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, object-oriented, parsing",
"url": null
} |
machine-learning, neural-network
Title: How to decide neural network architecture? I was wondering how do we have to decide how many nodes in hidden layers, and how many hidden layers to put when we build a neural network architecture.
I understand the input and output layer depends on the training set that we have but how do we decide the hidden layer and the overall architecture in general? Sadly there is no generic way to determine a priori the best number of neurons and number of layers for a neural network, given just a problem description. There isn't even much guidance to be had determining good values to try as a starting point.
The most common approach seems to be to start with a rough guess based on prior experience about networks used on similar problems. This could be your own experience, or second/third-hand experience you have picked up from a training course, blog or research paper. Then try some variations, and check the performance carefully before picking a best one. | {
"domain": "datascience.stackexchange",
"id": 1830,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "machine-learning, neural-network",
"url": null
} |
general-relativity, gravity, spacetime, quantum-gravity, carrier-particles
Title: What is the current most widely-accepted explanation of gravity? What do physicists typically say gives gravity the ability to act on a pair of objects?
I am not asking for a description of gravity as a scalar field, but rather what the current accepted theory is on how objects thousands of light years away from each other can exert force on each other?
If the answer involves gravitons, please explain how they could be able to interact over these distances to exert forces on objects. The current best theory of gravity is Einstein's general theory of relativity, which explains gravity as an effect of the curvature of spacetime by energy, momentum, stress, and pressure. Over the past century many alternative theories have been proposed, and many experiments and observations conducted to test these alternative theories and general relativity, and so far Einstein's theory has passed all challenges and remains the simplest theory which is in accord with all observations. | {
"domain": "physics.stackexchange",
"id": 99843,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "general-relativity, gravity, spacetime, quantum-gravity, carrier-particles",
"url": null
} |
ros, sensor-msgs, 2d-image, roslibjs
Originally posted by Swoncen on ROS Answers with karma: 23 on 2017-01-20
Post score: 1
Found a solution:
var imageTopic = new ROSLIB.Topic({
ros : ros,
name : '/camera/image/compressed',
messageType : 'sensor_msgs/CompressedImage'
});
the compressed image can be retrieved via:
var imagedata = "data:image/jpg;base64," + message.data;
Originally posted by Swoncen with karma: 23 on 2017-01-22
This answer was ACCEPTED on the original site
Post score: 1
Original comments
Comment by gvdhoorn on 2017-01-22:
I've converted your comment to an answer, as it would seem you have answered your own question (good!).
Could you accept your own answer? You can do so by ticking the checkmark to the left of the answer. | {
"domain": "robotics.stackexchange",
"id": 26786,
"lm_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, sensor-msgs, 2d-image, roslibjs",
"url": null
} |
java, strings
Generics
Use generics. Don't use raw collections - they can violate type safety. In your case, you might not realise the immediate benefit of doing so, but it is a good practice when scaling to larger programs. Here, using generics is as simple as changing LinkedHashSet knownChars = new LinkedHashSet(); to LinkedHashSet<Character> knownChars = new LinkedHashSet<>(); (JDK 1.7+ to get the diamond type inference, otherwise it has to be LinkedHashSet<Character> knownChars = new LinkedHashSet<Character>();, JDK 1.5+)
Space-time tradeoffs
To minimize the number of reallocations of the underlying buffers of StringBuilder or HashSet, initialize them with a default capacity of the largest possible size they could have, which is the length of the input String. Use the constructors which have an int capacity parameter. See the example code for details. | {
"domain": "codereview.stackexchange",
"id": 26268,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, strings",
"url": null
} |
because $x^0=e^{0log(x)}=e^0=1, x> 0$.
• who said $e^0 =1$? – MichaelChirico Jan 31 '17 at 6:13
• @MichaelChirico One way to see this is via a power series. – Henricus V. Jan 31 '17 at 6:17
• afaik power series involve the zeroth power for the constant term, so it's still circular – MichaelChirico Jan 31 '17 at 6:18
• @MichaelChirico The exponential function can be defined by $\exp'=\exp$ and $\exp(0)=0$. In that sense, $e^0=1$ is a convention, but of course the only useful one ... :) – Hagen von Eitzen Jan 31 '17 at 7:48
• @MichaelChirico You can explicitly move the first term out and have the series start at $1$. – Henricus V. Jan 31 '17 at 15:33
Let me start off by saying that I am not a mathematician, and that I will be using some pseudo-mathematical terms in the interest of writing something more akin to simplified English rather than accurate mathematical jargon.
The question as stated is:
Why does any non-zero number to the zeroth power equal one? | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9697854155523791,
"lm_q1q2_score": 0.8081460449761614,
"lm_q2_score": 0.8333246015211008,
"openwebmath_perplexity": 319.18654068669645,
"openwebmath_score": 0.7676352858543396,
"tags": null,
"url": "https://math.stackexchange.com/questions/2121796/why-does-any-nonzero-number-to-the-zeroth-power-1/2121811"
} |
art history, economics, and more. 7 Solving Nonlinear Systems. Practice problems here: Note: Use CTRL-F to type in search term. Improve your math knowledge with free questions in "Classify a system of equations" and thousands of other math skills. This is achieved by isolating the other variable in an equation and then substituting values for these variables in other another equation. Lesson 4 - Tables, Equations, and Graphs of Functions. U10_L2_T2_we1 Non-Linear Systems of Equations 1. 2 MB Math - 10 - Algebra - Worked Examples 4\138 Non-Linear Systems of Equations 2. The function fun can be specified as a function handle for a file. Unit 4 - Functions. In this case, adding y to both sides of the first equation gives:. Please check it here or on your Google Calendar App daily. Using Linear Relations to Solve Problems. The Systems of nonlinear equations exercise appears under the Algebra II Math Mission and Mathematics III Math Mission. In the 17th century, another innovation helped | {
"domain": "gesuitialquirinale.it",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9850429138459387,
"lm_q1q2_score": 0.8352846372368063,
"lm_q2_score": 0.847967764140929,
"openwebmath_perplexity": 746.1992919877321,
"openwebmath_score": 0.35932064056396484,
"tags": null,
"url": "http://gesuitialquirinale.it/qyms/solving-systems-of-nonlinear-equations-khan-academy.html"
} |
inorganic-chemistry, oxidation-state
Title: Oxidation state of ions in a unit cell Given that $\ce{Al2O3}$ is face-centered cubic (cubic-closest packed) with respect to oxide anions, I am instructed to find the oxidation state of each aluminum ion "fragment" in the unit cell. | {
"domain": "chemistry.stackexchange",
"id": 4654,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "inorganic-chemistry, oxidation-state",
"url": null
} |
c++, object-oriented, template, finance, numerical-methods
cout << "\nPlease enter the coupon rate in fraction of year (decimal): \n";
cin >> coupon; | {
"domain": "codereview.stackexchange",
"id": 42543,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, object-oriented, template, finance, numerical-methods",
"url": null
} |
python, strings, python-3.x
split.extend(s[start:].split())
split = [elem.strip() for elem in split]
split = list(filter(None, split))
It works, but I'm wondering if there's some more elegant/shorter/more readable way to do that in Python(3) ? The best way to do what you want with the standard library would be shlex.split():
>>> import shlex
>>> s = r' "C:\Program Files (x86)\myeditor" "$FILEPATH" -n$LINENO "c:\Program Files" -f$FILENAME -aArg2'
>>> shlex.split(s)
['C:\\Program Files (x86)\\myeditor', '$FILEPATH', '-n$LINENO', 'c:\\Program Files', '-f$FILENAME', '-aArg2']
Note that the quotes are not retained. | {
"domain": "codereview.stackexchange",
"id": 30061,
"lm_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, strings, python-3.x",
"url": null
} |
semiconductor-physics, electronics
Title: Diffusion and Drift Current under no biasing of a PN junction Diode In a PN diode, I get the point that total current is zero due to drift and diffusion current contribution cancels their effect when depletion region is formed.
My question is even though just for a moment suppose statistically electron in large amount diffused to p side and due to phenomena of recombination after some distance it will recombine. Then how does one say they constitute a current if they just diffuse by any means to p side, i.e. how does one say or calculate current or current flows if so they recombine with the holes.
If my question doesn't make you understand what i asked, so say in Forward biasing as diffusion will now easily takes place of majority charge carrier and we say a diffusion current is formed. But the majority carrier just simply recombines every time so what constitutes the diffusion current and how do we measure this current flowing in diode. | {
"domain": "physics.stackexchange",
"id": 80034,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "semiconductor-physics, electronics",
"url": null
} |
• Welcome to Mathematica.SE! 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – user9660 Dec 18 '15 at 10:47
• @Kuba I could not get this to work. When I try this on a matrix with two columns, it returns an error of the type RankedMax::rvec: "Input {{0.757069},{0.211864}} is not a vector of reals or integers.", and so on for each row in mat. In this example the first row is {0.757069},{0.211864} – Bjoj Dec 18 '15 at 12:37
• @Kuba Yes, you are right. Is that important? To derive mat I used Transpose to cobine two other (single column) matrices – Bjoj Dec 18 '15 at 12:45 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9525741268224331,
"lm_q1q2_score": 0.8115482017998976,
"lm_q2_score": 0.8519528076067262,
"openwebmath_perplexity": 1714.045856864165,
"openwebmath_score": 0.2062503844499588,
"tags": null,
"url": "https://mathematica.stackexchange.com/questions/102351/how-to-map-the-second-highest-value-in-each-row-of-a-matrix"
} |
You can choose a semicircle in the half-plane $\operatorname{Re} z \geqslant \sigma$. Then $e^{\alpha z}$ is bounded on the contour - $\operatorname{Re} (\alpha z) = \alpha\operatorname{Re} z \leqslant \alpha\sigma \leqslant 0$, and $\lvert e^{\alpha z}\rvert = e^{\operatorname{Re} (\alpha z)}$ - and the integral over the semicircle tends to $0$ for $R \to \infty$. Since the contour encloses no singularity, the contour integral is $0$, and hence
$$\int_{\sigma - i\infty}^{\sigma+i\infty} \frac{e^{\alpha z}}{z^2+1}\,dz = 0$$
for $\sigma > 0$ and $\alpha \leqslant 0$.
It is worth noting that
$$I(\alpha) = \int_{\sigma-i\infty}^{\sigma+i\infty} \frac{e^{\alpha z}}{z^2+1}\,dz = \begin{cases}\quad 0 &, \alpha \leqslant 0\\ 2\pi i\sin \alpha &, \alpha \geqslant 0 \end{cases}$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9830850899545226,
"lm_q1q2_score": 0.8558711873260572,
"lm_q2_score": 0.8705972616934406,
"openwebmath_perplexity": 159.16764421459962,
"openwebmath_score": 0.9719287157058716,
"tags": null,
"url": "https://math.stackexchange.com/questions/620513/contour-integration-choice-of-contour"
} |
javascript, jquery
<div>
<label for="form-horizontal-text">Payment received</label>
<input placeholder="YYYY-MM-DD" class="payment-received" type="text" name="job[payment_received]" id="job_payment_received" readonly="readonly">
<div>
<input name="job[payment_received_checkbox]" type="hidden" value="0"><input class="payment-obsolete" type="checkbox" value="1" name="job[payment_received_checkbox]" id="job_payment_received_checkbox">
<span class="invoice-sent">obsolete</span>
<input name="job[payment_received_checkbox]" type="hidden" value="0"><input class="payment-pending" type="checkbox" value="1" name="job[payment_received_checkbox]" id="job_payment_received_checkbox">
<span>pending</span>
</div>
</div>
How can I refactor the code, so that I avoid unnecessary duplication? There seem to be some bugs in the code: | {
"domain": "codereview.stackexchange",
"id": 30331,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, jquery",
"url": null
} |
From https://math.stackexchange.com/a/3680889/27978 we see that if $$K = K_1 \cup \cdots \cup K_m$$, a disjoint union, then $$\sum_{n \in K} a_n = \sum_{n \in K_1} a_n + \cdots + \sum_{n \in K_m} a_n$$.
Since $$I'=I_1 \cup \cdots \cup I_m \subset I$$ we see that $$\sum_{n \in I} a_n \ge \sum_{n \in I'} a_n = \sum_{k=1}^m \sum_{n \in I_k} a_n$$. It follows that $$\sum_{n \in I} a_n \ge \sum_{k=1}^\infty \sum_{n \in I_k} a_n$$. This is the 'easy' direction.
Let $$\epsilon>0$$, then there is some finite $$J \subset I$$ such that $$\sum_{n\in J} a_n > \sum_{n \in I} a_n -\epsilon$$. Since $$J$$ is finite and the $$I_k$$ are pairwise disjoint we have $$J \subset I'=I_1 \cup \cdots \cup I_m$$ for some $$m$$ and so $$\sum_{k=1}^\infty \sum_{n \in I_k} a_n \ge \sum_{k=1}^m\sum_{n \in I_k} a_n \ge \sum_{k=1}^m\sum_{n \in J \cap I_k} a_n = \sum_{n\in J} a_n > \sum_{n \in I} a_n -\epsilon$$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.982557516796073,
"lm_q1q2_score": 0.8571314735082184,
"lm_q2_score": 0.8723473779969194,
"openwebmath_perplexity": 174.6296223630094,
"openwebmath_score": 0.9980955123901367,
"tags": null,
"url": "https://math.stackexchange.com/questions/3678244/if-series-is-absolutely-convergent-then-sum-limits-n-in-ia-n-sum-limits"
} |
astrophysics, planetary-science, lunar-libration
In History of Science and Mathematics SE:
How did Cassini measure the "Cassini state" of the Moon? What measurements were made; what did the data look like? (currently unanswered)
In addition to the effects of eccentricity and axial and orbital inclinations I suppose that:
for a just recently locked body there could still be residual pendulum-like harmonic motion that hasn't yet been damped out. See Is there any residual oscillation left from the Moon rotation?
there could be motion excited by third body gravitational effects
there could be "inner sloshing" of magma, liquid core, or subsurface (or surface) oceans What are all the contributions to libration; is there a self-consistent formalism?
Related: | {
"domain": "astronomy.stackexchange",
"id": 6189,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "astrophysics, planetary-science, lunar-libration",
"url": null
} |
php, mysql, memcache
Get from memcache
// Get memcache data
function getCache($key) {
$memcache_obj = new Memcache;
$memcache_obj = memcache_connect(memcache_host, 11211);
$res = $memcache_obj->get($key);
if(empty($res)) {
$res = false; // Expired
}
return $res;
}
Get data from memcache (or store in memcache if not present)
// Get data from either memcache or mysql
function _getData($userid,$table,$fields,$server) {
$toSelect = explode(",",$fields);
$toPush = array();
foreach($toSelect AS &$value) {
// Check if data is available from cache
$key = $userid."_".$table."_".$value;
$res[$value] = getCache($key);
if(empty($res[$value])) {
// Not cached, so must be pushed
$toPush[] = $value;
}
} | {
"domain": "codereview.stackexchange",
"id": 20391,
"lm_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, mysql, memcache",
"url": null
} |
PROBABILITY THEORY - PART 2 INDEPENDENT RANDOM VARIABLES MANJUNATH KRISHNAPUR CONTENTS 1. Introduction 2 2. Some basic tools in probability2 3. Applications of first and second moment methods5 4. Applications of Borel-Cantelli lemmas and Kolmogorov’s zero-one law10 5. A short preview of laws of large numbers and other things to come12 6 dwell time in two adjacent states is the sum of two non-identical exponential random variables. In equation (9), we give our main result, which is a concise, closed-form expression for the entropy of the sum of two independent, non-identically-distributed exponential random variables. Beyond the specific applications given above, some | {
"domain": "amscoglobal.org",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9473810451666345,
"lm_q1q2_score": 0.8014298340877339,
"lm_q2_score": 0.8459424411924673,
"openwebmath_perplexity": 435.74312929616787,
"openwebmath_score": 0.8664855360984802,
"tags": null,
"url": "https://amscoglobal.org/gladesville/pdf-of-sum-of-three-exponential-random-variables.php"
} |
newtonian-mechanics, forces
Title: Velocity while pulling up a object using a rope Suppose I had a body tied to a rope, and the rope attached to the axle of a motor which rotates I can pull up the object at a constant velocity. Using Newton's second law of motion I conclude that the tension in the rope is equal to mg.
My question is by what physical process is the motor able to achieve this. The force applied upward on the body is always(?) mg, how is the motor-rope arrangement then able to accelerate the body to the said constant velocity? To begin to lift the body the upward force of the motor (due to its torque) must be greater than $mg$ in order to accelerate the body. Once the body starts moving the upward force of the motor can be reduced to equal $mg$, for a net force of zero, and the body will continue to move upward at constant speed. | {
"domain": "physics.stackexchange",
"id": 98570,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "newtonian-mechanics, forces",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.