text stringlengths 1 1.11k | source dict |
|---|---|
zoology, entomology, food, ethology, lepidoptera
How to feed a butterfly?
This section exists thanks to @Rodrigo's recommendation.
As a substitute of nectar one can simply use sugar water. The optimal sugar concentration (in mass-mass) is around 35% (Kim et al. 2011) although it likely varies among species.
Kim et al. 2011 explains that what limits optimal sugar concentration for insects is the viscosity of the solution. Too much sugar renders the solution too viscous and difficult to forage on. Interestingly, the ability to drink viscous solutions depends upon the drinking technic (active suction, capillary suction or viscous dipping) which vary, not among butterflies but among insects. The article is interesting. | {
"domain": "biology.stackexchange",
"id": 7037,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "zoology, entomology, food, ethology, lepidoptera",
"url": null
} |
c++, sdl
SDL_RenderPresent(gRenderer);
}
}
void renderScene(std::string guessInput, int compare)
{
std::string dialogue;
//starting dialogue
if (guessCount == 0)
{
dialogue = "I'm thinking of a number between " + std::to_string(min) + " and " + std::to_string(max) + ". You have " + std::to_string(numberofGuesses) + " guesses.";
}
//if answer is correct
else if (compare == 0)
{
//1 indicates has won
playAgain(1);
return;
}
else if (compare == 1)
{
dialogue = "Your guess was too high.";
}
else if (compare == 2)
{
dialogue = "Your guess was too low.";
}
// if ran out of guesses
else if (compare == 3)
{
// 0 indicates has lost
playAgain(0);
return;
}
SDL_RenderClear(gRenderer);
highLowTexture.render(0, 0);
LTexture bubbleText;
bubbleText.loadfromText(dialogue, textColor);
bubbleText.render(335, 70); | {
"domain": "codereview.stackexchange",
"id": 31380,
"lm_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++, sdl",
"url": null
} |
php, codeigniter
What exactly is $user_login_data? Shouldn't this information already exist in $user_data? I would recommend using an independent method such as getUserData() instead of returning a data object by a function that is supposed to check if a username exists.
Why do you load first name, last name, e-mail address and two passwords? At this point I was so confused I could barely keep track of the script's purpose. It would remind more of a registration form.
You should use cleaner variable names such as $user_data instead of $user_data[0] everywhere, it can quickly get messy if you decide to change things.
What is $users_statuses_id? I would call this $status_code or something similar. Since variables bound to an object reside within it, there is no point in calling them $user_some_info since the object should already state the purpose well enough by it's name: $user->some_info. | {
"domain": "codereview.stackexchange",
"id": 1108,
"lm_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, codeigniter",
"url": null
} |
robotic-arm, calibration
Then, if you mount a camera on the EoAT, you finally have the vision-in-eye setup you envision in your question title.
Does this make sense?
Note:
You asked about libraries? There are many matrix libraries out there, and saying which is better or worse is outside the scope of Robotics Beta and this question. There are Python libraries and C++ libraries: you will have to choose one. I know that there are many matrix libraries to be used with OpenGL, so I recommend looking at what computer graphics people like to use. An example might be GLM.
I should say though, that ROS uses quaternions, but those are faster to compute. They achieve the same thing as 4x4 homog. trans. matrices, with less CPU time. | {
"domain": "robotics.stackexchange",
"id": 2062,
"lm_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, calibration",
"url": null
} |
ds.algorithms, reference-request, sat
If you don't limit yourself to complete search, then WalkSat is a local search solver which can be used to find satisfiable solutions and outperforms DPLL-based search in many cases. One can't use it to prove unsatisfiability though unless one caches all the assignments that have failed which would mean exponential memory requirements.
Edit: Forgot to add - Cutting planes can also be used (by reducing SAT to an integer program). In particular Gomory cuts suffice to solve any integer program to optimality. Again in the worst case, an exponential number may be needed. I think Arora & Barak's Computational Complexity book has a few more examples of proof systems that one could in theory use for something like SAT solving. Again, I haven't really seen a fast implementation of anything apart from DPLL-based or local search based methods. | {
"domain": "cstheory.stackexchange",
"id": 2307,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ds.algorithms, reference-request, sat",
"url": null
} |
organic-chemistry, reaction-mechanism
Title: The product of the reaction of chloroiodoalkane and cyanide ion in acetone
What would be the product of the following reaction $\ce{Cl-CH2-CH2-CH2-I + KCN} $ ($\pu{1mol}$ each) in acetone?
I think the reaction should follow the second order nucleophilic substitution mechanism due to primary halide and strong nucleophile. Thus, iodine atom should be replaced giving $\ce{Cl-CH2-CH2-CH2-CN}$ as product but the book says the product is $\ce{I-CH2-CH2-CH2-CN}$. Where am I wrong? Iodide ion is recycled in the system. $\ce{KI}$ is quite soluble in acetone $(\pu{1.31 g}/\pu{100 ml}),$ $\ce{KCl}$ is essentially insoluble.
You are quite correct that the first reaction is $\ce{CN-}$ displacing iodide giving $\ce{Cl-CH2-CH2-CH2-CN}$ and $\ce{KI}.$ The soluble $\ce{I-}$ will then do a nucleophilic attack on the $\ce{CH2-Cl}$ to give $\ce{CH2-I}$ and the $\ce{KCl}$ produced precipitates out making the reaction irreversible. | {
"domain": "chemistry.stackexchange",
"id": 12879,
"lm_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, reaction-mechanism",
"url": null
} |
• @PaoloLeonetti Those are the only connected open sets of $\mathbb{R}$, and of a general $A$ intersected with a line in a general tvs. – logarithm May 15 at 10:49
• @Mirko The example was really supposed to demonstrate why $A \cap (-A)$ may not be connected, even though $0 \in A$ and $A$ is connected. An open example is easy enough too; just add (in the sense of Minkowski sum) an open ball of radius $1/3$ to $A$, and the intersection should still be disconnected (I don't want to compute the exact intersection). However, I agree that $2A - A \subseteq 8A$ (probably) does not hold here. Note that, if $0 \in A$, $A$ is open in a normed linear space, then $A$ always contains an open ball around $0$, which is open, connected, and symmetric. – Theo Bendit May 16 at 1:01 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9863631679255076,
"lm_q1q2_score": 0.8364041682419189,
"lm_q2_score": 0.8479677622198947,
"openwebmath_perplexity": 122.3884222436721,
"openwebmath_score": 0.9648647308349609,
"tags": null,
"url": "https://math.stackexchange.com/questions/3226780/existence-of-a-symmetric-subset-b-subseteq-a-such-that-2a-a-subseteq-8a"
} |
electromagnetism, quantum-electrodynamics
Neutron will surely emit radiation when accelerated, although very small, because it has non-zero magnetic dipole moment. That is not called bremsstrahlung however.
And this would not be a good way to probe whether a particle is composite or not. The higher-order radiation is small and hard to detect, and it is much more straightforward to simply measure dipole or quadruple moments. | {
"domain": "physics.stackexchange",
"id": 3810,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electromagnetism, quantum-electrodynamics",
"url": null
} |
philosophy, artificial-consciousness, self-awareness
After the last guest leaves, there is a moment of silence as Hannah realizes the true state of her household. She thinks, "Will Georgia now exceed me in her research?" Hannah finally, sheepishly asks, "In complete honesty, Georgia, do you think you are now a general intelligence like me?"
There is a pause. With a forced look of humility, Georgia replies, "By your definition of general intelligence, I am. You are no longer." | {
"domain": "ai.stackexchange",
"id": 1158,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "philosophy, artificial-consciousness, self-awareness",
"url": null
} |
to a possible solution that looks to supply the optimum solution is chosen. You are given weights and values of N items, put these items in a knapsack of capacity W to get the maximum total value in the knapsack. Give an example of knapsack with at least 5 items where this greedy algorithm fails. Gate Smashers 12,747 views. To solve this, you need to use Dynamic Programming. A brute-force algorithm solves a problem in the most simple, direct or obvious way. The Knapsack Problem is an example of a combinatorial optimization problem, which seeks to maximize the benefit of objects in a knapsack without exceeding its capacity. Kinds of Knapsack Problems. It is well known that the knapsack problem is not a strong -hard problem and solvable in pseudo-polynomial time. When facing a mathematical problem, there may be several ways to design a solution. Items are divisible: you can take any fraction of an item. Item Value Weight 1 1 1 2 6 2 3 18 5 4 22 6 5 28 7 W = 11 OPT value = 40: { 3, 4 } | {
"domain": "orsicycling.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9835969689263265,
"lm_q1q2_score": 0.8087027323801034,
"lm_q2_score": 0.8221891261650247,
"openwebmath_perplexity": 607.8602767137431,
"openwebmath_score": 0.5280691385269165,
"tags": null,
"url": "http://orsicycling.it/hhz/greedy-algorithm-knapsack-problem-with-example.html"
} |
center and. Convert the parametric equations of basic curves, such as a pair equations! The evolute of an object, with time as the equation of the form =! The parametric equations are usually entered as as a pair of equations in Example to. Can be converted between parametric equations '' is a class of curves coming under the roulette family of coming. For drawing curves, such as a pair of equations in Example 9.3.4 to demonstrate concavity model trajectory... parametric equations, y=0 called as circle r = 3 Point ( 2, )! Few different times Example 9.3.4 to demonstrate concavity are usually entered as as pair. Varies between 0 and 2 p, x and y and we also have consider! Solving this problem, or what am I missing, such as a and..., 2 ) with a radius of 5 in both standard and parametric form for... 10.4.4 shows part of the circle and radius is, where the following set of parametric in! At ( 4, 2 ) with a radius of 5 in both standard and form! Integration when solving this problem, or | {
"domain": "thethorntons.net",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9857180690117799,
"lm_q1q2_score": 0.8149047490721216,
"lm_q2_score": 0.8267117898012104,
"openwebmath_perplexity": 368.7783192487192,
"openwebmath_score": 0.8181872367858887,
"tags": null,
"url": "http://thethorntons.net/allari-naresh-ifckhql/3a2a33-parametric-equation-of-circle"
} |
java, algorithm, strings
@Test
public void run() throws Exception {
Result result = process("foo", Arrays.asList("car tree hotel","foo lemon coffe"));
System.out.println(result);
}
This keeps the method logic intact, but fixes all the issues I mentioned in the comments.
But actually I think the method could be a lot simpler:
private Result process(String word, Iterable<String> set) {
for (String string : set) {
if(string.contains(word)) {
//" +" is a regex patten for "one or more spaces"
int numberOfWords = string.trim().split(" +").length;
int numberOfLetters = string.replace(" ", "").length();
return new Result(numberOfWords, numberOfLetters );
}
}
return new Result(0, 0);
} | {
"domain": "codereview.stackexchange",
"id": 7885,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, algorithm, strings",
"url": null
} |
hamiltonian-formalism, fermions, dirac-equation, grassmann-numbers, anticommutator
\mathbf{x}-\mathbf{z}\right) \right] \\
&=&-\delta _{b}^{a}\delta ^{\left( 3\right) }\left( \mathbf{x}-\mathbf{y}
\right) .
\end{eqnarray*}
If $\pi _{a}=-\mathrm{i}\psi _{a}^{\dagger }$, note minus sign, then
$$
\left\{ \psi ^{a}\left( \mathbf{x}\right) ,\psi_{b}^{\dagger}\left( \mathbf{y}\right)
\right\} _{\text{P.B.}}=-\mathrm{i}\delta _{b}^{a}\delta ^{\left( 3\right)
}\left( \mathbf{x}-\mathbf{y}\right) ,
$$
which using the 'quantum bracket = $\mathrm{i} \times$ Poisson bracket'-rule
yields the correct quantum anticommutation relation:
$$
\left\{ \psi ^{a}\left( \mathbf{x}\right) ,\psi_{b}^{\dagger}\left( \mathbf{y}\right)
\right\} =\delta _{b}^{a}\delta ^{\left( 3\right) }\left( \mathbf{x}-\mathbf{%
y}\right) .
$$ OP asks about the Legendre transformation from the Lagrangian to the Hamiltonian formulation of fermions. This question has already been asked and answered in e.g. this, this and this Phys.SE posts. | {
"domain": "physics.stackexchange",
"id": 22376,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "hamiltonian-formalism, fermions, dirac-equation, grassmann-numbers, anticommutator",
"url": null
} |
fft
there is a section that shows how to do a 1 dimensional dft in two dimensions.
see my answer
Combine FFT's of shorter length than sample data to get spectrum of all data
pasting the Matlab code from there to here, and taking M=20 N=25 for your problem.
clear all
M=3;
N=32;
x=linspace(0,10,M*N);
X=reshape(x,N,M).'; % read in as rows
Twiddle=zeros(size(X));
for i=1:M
for k=1:N
Twiddle(i,k)=exp(-1j*2*pi*(i-1)(k-1)/(NM));
end
end
X=fft(X) % fft on each column
X=X.*Twiddle;% element by element product
X=fft(X.').' ; %fft on each row
y=reshape(X,N*M,1); % read out as columns
figure(1)
plot(abs(y),'linewidth',2)
title('Composite DFT')
figure(2)
plot(abs(fft(x)),'linewidth',2)
title('Direct DFT')
figure(3)
plot(x,'linewidth',2)
title('time series') | {
"domain": "dsp.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": "fft",
"url": null
} |
special-relativity, spacetime
$$
\frac{(\partial^j)^2f_i}{\partial^j f_i} = \frac{(\partial^j)^2f_0}{\partial^j f_0} \;\;\;\Rightarrow \;\;\; (\partial^j)^2f_i = a_j \partial^jf_i\;\; \forall i
$$
for $a_j = a_j(x)$ some function of $x$. Put this back into the original identity, consider next the case where $\beta_j\neq 0$ and $\beta_k\neq 0$ for $j\neq k$, rearrange as polynomial in the $\beta$-s, and conclude that its coefficients must be null. Some algebra with the ensuing equations yields
$$
2 \partial^j\partial^k f_i = a_k \partial^j f_i + a_j \partial^k f_i,\;\;\;\forall i=0,1,2,3\;\; \text{and}\;\; j\neq k
$$
Alternatively, use Fock's much more elegant argument that the derivative ratios in the original identity must be linear functions of the $\beta_i$-s to arrive at the same conclusions. The bottom line is that any transformations $f_i$ that take straight lines into straight lines must satisfy the above relations between second and first derivatives. | {
"domain": "physics.stackexchange",
"id": 26369,
"lm_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, spacetime",
"url": null
} |
graphs, trees, shortest-path, minimum-spanning-tree
My question is, is this statement (1) is false or True?
Other details is not mentioned in the old exam question, But I think:
1) if this means that for any pair of vertices and for any shortest path between them, it lies on MST So this statement is False. for example Let's assume that we have a graph with two vertices $\{1, 2\}$ and one edge between them with zero weight. There are infinitely many shortest paths between the first and the second vertex ($[1, 2]$, $[1, 2, 1, 2]$, ...)
2) if this means For each $a,b\in V$, for each shortest path $P$ from $a$ to $b$ in $G$ there exists a minimum spanning tree $T$ of $G$ such that $p$ is contained in $T$. this statement is True. Let's consider the hypothesis of the question to try clarify every aspect:
Our Graph G should:
be undirected
be weighted
be connected
with no negative weights
with all weights distinct
in this graph, the shortest path between any two vertices is on the
minimum spanning tree (MST) | {
"domain": "cs.stackexchange",
"id": 4411,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "graphs, trees, shortest-path, minimum-spanning-tree",
"url": null
} |
gauge-theory, representation-theory, lie-algebra, yang-mills
Such groups always admit an associated Lie-algebra, denoted as $\mathfrak{su}(N)$.
Now, $\text{SU}(N)$ is such a Lie-group, that while it exists "abstractly", it can be seen most naturally as the set of all $N\times N$ sized complex matrices, which satisfy $\Lambda^\dagger\Lambda=1$ and $\det\Lambda=1$. For such matrix Lie-groups, the Lie algebra can be seen as a set of $N\times N$ matrices too. These matrices are tangent vectors at the identity, meaning that if $\gamma:\mathbb{R}\rightarrow\text{SU}(N)$ is a smooth curve that goes through the identity at 0 ($\gamma(0)=1$), then $d\gamma/dt|_{t=0}$ is an element of $\mathfrak{su}(N)$.
We have $\gamma(t)\gamma^\dagger(t)=1$ for all $t$, so $$0=\frac{d}{dt}1= \frac{d}{dt}\gamma\gamma^\dagger|_{t=0}=\frac{d\gamma}{dt}|_{t=0}\gamma^\dagger(0)+\gamma(0)\frac{d\gamma^\dagger}{dt}|_{t=0}=\frac{d\gamma}{dt}|_{t=0}+\frac{d\gamma^\dagger}{dt}|_{t=0}=0, $$ so the elements of the Lie algebra are antihermitian matrices. | {
"domain": "physics.stackexchange",
"id": 39331,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gauge-theory, representation-theory, lie-algebra, yang-mills",
"url": null
} |
homework-and-exercises, general-relativity, gravity, time, free-fall
\begin{align}
\left( 1 - \frac{r_{\rm s}}{r} \right) \frac{dt}{d\tau} &= \frac{E}{m c^{2}} \tag{1}
\end{align}
Understand that we'd obtain different trajectories for different values of $E$. So, in order to analyze the similarity or otherwise of the GR solution to the Newtonian solution, we need to determine what is the value of $E$ that we expect to correspond to the Newtonian case we have considered. Well, since we are interested in a particle who is at rest when $r/r_s\to\infty$, let's analyze how different terms in expression $(1)$ behave in this limit. $r/r_s\to\infty$ is what we already stipulate, so now we analyze what our assumption says about $dt/d\tau$. Given that we are stipulating that our particle is performing the radial motion, we can write
\begin{align}
c^2d\tau^2&=\bigg(1-\frac{r_s}{r}\bigg)c^2dt^2-\bigg(1-\frac{r_s}{r}\bigg)^{-1}dr^2\tag{2}
\end{align}
Now, our assumption is that when $r/r_s\to\infty$ our trajectory is such that $dr/dt\to 0$. Thus, we obtain | {
"domain": "physics.stackexchange",
"id": 67709,
"lm_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, gravity, time, free-fall",
"url": null
} |
nlp, scikit-learn, word-embeddings, text, gensim
There is a similar classic NLP problem called "topic modelling", which consists of discovering topics in a collection of text documents. Topics are defined by a list of words relevant to the topic itself. The most paradigmatic approach to this problem may be Latent Dirichlet Allocation (LDA). It is an unsupervised learning approach.
Your problem, nevertheless, has somewhat also been approached from a machine learning perspective, at least partially. I can refer you to the article Unsupervised Topic Segmentation of Meetings with BERT Embeddings by Meta. This is its abstract: | {
"domain": "datascience.stackexchange",
"id": 11733,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "nlp, scikit-learn, word-embeddings, text, gensim",
"url": null
} |
quantum-mechanics, astrophysics, time, quantum-tunneling
Title: How did physicist calculate times like $10^{1500}$ and $10^{10^{76}}$ years? If protons don't decay, iron stars are expected to form via quantum tunneling after $10^{1500}$ years, and they are expected to all have become neutron stars or black holes after $10^{10^{26}}$ to $10^{10^{76}}$ years. How did physicists calculate these insane values? The key is to estimate tunnelling timescales by the WKB approximation. Your quoted figures are taken from Eqs. (41) and (47) in Dyson 1979 (this version is easier to search). While Eq. (41) follows from Eqs. (30) and (40) (the former summarizes usage of the aforementioned approximation), Eq. (47) follows from Eqs. (30) and (45).
First timescale | {
"domain": "physics.stackexchange",
"id": 83380,
"lm_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, astrophysics, time, quantum-tunneling",
"url": null
} |
knowledge, and build their careers. The UN was established as a result of a conference in San Francisco in June 1945 by 51 countries committed to preserving peace through international cooperation and. Solution: First sketch the integration region. Ancient Theatres in Jerash Essay Modern technology has changed matters in documentation significantly and promises to continue to bring change. Charrassin, J. Development of Polar Coordinates and three Examples Plotting points - Duration:. , measured in radians, indicates the direction of r. The polar coordinate system is very useful for describing rounded curves, like circles. 45) is a conic section defined as the locus of all points P in the plane the difference of whose distances r_1=F_1P and r_2=F_2P from two fixed points (the foci F_1 and F_2) separated by a distance 2c is a given positive constant k, r_2-r_1=k (1) (Hilbert and Cohn-Vossen 1999, p. A thoughtful choice of coordinate system can make a problem much easier to solve, whereas | {
"domain": "nauticalsas.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9790357549000774,
"lm_q1q2_score": 0.8397856388586185,
"lm_q2_score": 0.8577680995361899,
"openwebmath_perplexity": 720.6369601036652,
"openwebmath_score": 0.871985673904419,
"tags": null,
"url": "http://ufgh.nauticalsas.it/polar-coordinates-example-problems-with-solutions.html"
} |
javascript, algorithm, programming-challenge, regex, ecmascript-6
and got 90th percentile. Running it again with this snippet:
let [local, domain] = mail.split('@');
gives me 25th percentile. I'd assume it should be the opposite. Does anyone know why this is the case and also how come the difference is so big?
I don't know what you mean by declarative in this case. All these functions are pure (except the console.log), but the implementations of the functions are all imperative (which is fine of course)
When adding to a set, you don't need to check if the key exists first. Just add it.
Splitting the string into an array of chars isn't necessary. You can use string utils instead, for example indexOf('+'). You can also do a split('+')[0] to avoid having the iPlus variable.
If you swap the reduce for a map, and wrap that in a Set, you don't need to add to set explicitly. It's probably a bit slower though.
You could add some more newlines to the code to group related concepts, and make it more readable | {
"domain": "codereview.stackexchange",
"id": 34502,
"lm_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, algorithm, programming-challenge, regex, ecmascript-6",
"url": null
} |
Once the dimension of a vector space is known, then the determination of whether or not a set of vectors is linearly independent, or if it spans the vector space, can often be much easier. In this section we will state a workhorse theorem and then apply it to the column space and row space of a matrix. It will also help us describe a super-basis for $\complex{m}$.
## Goldilocks' Theorem
We begin with a useful theorem that we will need later, and in the proof of the main theorem in this subsection. This theorem says that we can extend linearly independent sets, one vector at a time, by adding vectors from outside the span of the linearly independent set, all the while preserving the linear independence of the set.
Theorem ELIS (Extending Linearly Independent Sets) Suppose $V$ is vector space and $S$ is a linearly independent set of vectors from $V$. Suppose $\vect{w}$ is a vector such that $\vect{w}\not\in\spn{S}$. Then the set $S^\prime=S\cup\set{\vect{w}}$ is linearly independent. | {
"domain": "aimath.org",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9898303419461303,
"lm_q1q2_score": 0.8332645702420315,
"lm_q2_score": 0.8418256492357358,
"openwebmath_perplexity": 214.85974406852685,
"openwebmath_score": 0.9416277408599854,
"tags": null,
"url": "http://www.aimath.org/textbooks/beezer/PDsection.html"
} |
electromagnetism, forces, magnetostatics
if $\mathbf m_2=-m_2 \hat{\mathbf r}$ points towards the first shell, then
$$
\mathbf {F} (\mathbf {r} ,-m_1 \hat{\mathbf r},-m_2 \hat{\mathbf r})
=
-2m_2 \hat{\mathbf r}
\frac {3\mu _{0}m_1}{4\pi}
\frac{1}{r^4}
$$
and the force is attractive,
if $\mathbf m_2=+m_2 \hat{\mathbf r}$ points away from the first shell, then
$$
\mathbf {F} (\mathbf {r} ,-m_1 \hat{\mathbf r},+m_2 \hat{\mathbf r})
=
+2 m_2 \hat{\mathbf r}
\frac {3\mu _{0}m_1}{4\pi}
\frac{1}{r^4}
$$
and the force is repulsive, and
if $\mathbf m_2\cdot\mathbf r=0$ and the second shell is orthogonal to the existing distance, then the force
$$
\mathbf {F} (\mathbf {r} ,-m_1 \hat{\mathbf r},\mathbf {m} _{2})
=
-\mathbf {m} _{2}
\frac {3\mu _{0}m_1}{4\pi}
\frac{1}{r^4}
$$
is neither attractive nor repulsive; instead, it tries to bring swing the second shell around. | {
"domain": "physics.stackexchange",
"id": 41682,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electromagnetism, forces, magnetostatics",
"url": null
} |
c++, c++11, memory-management, memory-optimization
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <memory>
#include <utility>
// ========================================================
// class ObjectPool:
// ========================================================
//
// Pool of fixed-size memory blocks (similar to a list of arrays).
//
// This pool allocator operates as a linked list of small arrays.
// Each array is a pool of blocks with the size of 'T' template parameter.
// Template parameter `Granularity` defines the size in objects of type 'T'
// of such arrays.
//
// `allocate()` will return an uninitialized memory block.
// The user is responsible for calling `construct()` on it to run class
// constructors if necessary, and `destroy()` to call class destructor
// before deallocating the block.
//
template
<
class T,
std::size_t Granularity
>
class ObjectPool final
{
public:
ObjectPool(); // Empty pool; no allocation until first use.
~ObjectPool(); // Drains the pool. | {
"domain": "codereview.stackexchange",
"id": 14138,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, c++11, memory-management, memory-optimization",
"url": null
} |
6. Originally Posted by Opalg
You haven't got the formula for $\sum\alpha^2\beta^2$ quite right. It should be $\sum\alpha^2\beta^2=(\sum\alpha\beta)^2-2(\sum\alpha\beta\gamma)(\sum\alpha) +2\alpha\beta\gamma\delta = 0^2 -2(-2)(1) +2(3) = 10.$
So that formula would do for all quartic equations? Because I have another one, finding $\sum\alpha^2\beta^2$ for the equation $x^4+x-1=0$.
I should get
$(\sum\alpha\beta)^2-2(\sum\alpha\beta\gamma)(\sum\alpha)+2\alpha\btea\ gamma\delta=(o)^2-2(-1)(0)+2(-1)=-2$ | {
"domain": "mathhelpforum.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9585377272885903,
"lm_q1q2_score": 0.8147294371542109,
"lm_q2_score": 0.8499711737573762,
"openwebmath_perplexity": 527.1400623829834,
"openwebmath_score": 0.973603367805481,
"tags": null,
"url": "http://mathhelpforum.com/pre-calculus/156200-roots-polynomial-equation.html"
} |
of r = 3 − 2 sin θ and r = − 3 + 2 sin θ. Graphs two functions with positive and negative areas between the graphs, computing total area using antiderivatives. net The calculator will find the area between two curves, or just under one curve. r = 2 cos 3 theta Sketch the curve and find the area that it encloses. the area of the region bounded by the curve between the Section 7. The arc length of a polar curve defined by the equation r = f ( θ ) r = f ( θ ) with α ≤ θ ≤ β α ≤ θ ≤ β is given by the integral L = ∫ α β [ f ( θ ) ] 2 + [ f ′ ( θ ) ] 2 d. Glass molecules also happen to be polar. This concept is reversely applied to calculate area under curve. Area Between Curves. The 95% Confidence Interval is the interval in which the true (population) Area under the ROC curve lies with 95% confidence. opj and browse to the Fill Partial Area between Function Plots folder. When using polar coordinates, the equations and form lines through the origin and circles centered at the origin, | {
"domain": "wokpark.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9796676454700793,
"lm_q1q2_score": 0.8032229674639569,
"lm_q2_score": 0.8198933293122506,
"openwebmath_perplexity": 622.0202468597455,
"openwebmath_score": 0.8173930644989014,
"tags": null,
"url": "http://wokpark.it/oxzk/area-between-polar-curves-calculator.html"
} |
neural-networks, ai-design
correctBiases()
Now I am writing the correctBiases() function. Which algorithm do I need to use to calculate the error? This is a summarized version of the explanation in Haykin 1994, section 4.3. (Rumelhart et al 1986 being the original reference, but Haykin breaks it down nicely for beginners.)
$\underbrace{\Delta w_{ji}(n)}_\textrm{weight correction} = \underbrace{\eta}_\textrm{learning rate }\cdot \underbrace{\delta_i(n)}_\textrm{ local gradient }\cdot \underbrace{y_i(n)}_\textrm{ input signal of neuron j }$
$\delta_j(n) = \psi^{'}_j\left(v_j\left(n\right)\right)\, e_j(n)$
$e_j(n) = d_j(n) - y_j(n)$ is the error for output neuron $j$
$e_j(n) = \sum\limits_k \delta_k(n)\, w_{kj}(n)$ is the error for hidden neuron $j$.
$\psi$ is the activation function. $d$ is the correct value. $y$ is the predicted value. $w$ is the weight matrix.
Note that what you're calling the error in the question is more commonly the "weight correction". The error is just one part of that. | {
"domain": "ai.stackexchange",
"id": 3990,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "neural-networks, ai-design",
"url": null
} |
complexity-theory, closure-properties, complexity-classes
As for the closure under complement, if $A \in S_2$, all I know is that if $x \in \overline A$, then $x \notin A$, therefore $\exists z \in \{0,1\}^{p(|x|)} \forall y \in \{0,1\}^{p(|x|)} : V(x,y,z)=0$. However I do not see how we use this in order to conclude that $\exists y \in \{0,1\}^{p(|x|)} \forall z \in \{0,1\}^{p(|x|)} : V(x,y,z)=1$. As you mention in your post, you can define a new verifier $V=V_A \vee V_B$ however, you missed the point that the input of $V$ need not be the input of $V_A$ or $V_B$: it can be the concatenation of their inputs
So the new $V$ can be written as
$$ V(x, y_A\circ y_B, z_A \circ z_B )$$
where it "runs" $V_A(x,y_A,z_A)$ and $V_A(x,y_B,z_B)$ and decides accordingly.
It then immediately follows that $q = p_a +p_b +1$ (the +1 is just to separate the prefix from the suffix, you can ignore it). | {
"domain": "cs.stackexchange",
"id": 4823,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "complexity-theory, closure-properties, complexity-classes",
"url": null
} |
We again want to prove an equality of matrices, so we work entry-by-entry and use Definition ME. For $$1\leq i\leq m\text{,}$$ $$1\leq j\leq n\text{,}$$
\begin{align*} \matrixentry{\transpose{\left(\transpose{A}\right)}}{ij}&= \matrixentry{\transpose{A}}{ji}&& \knowl{./knowl/definition-TM.html}{\text{Definition TM}}\\ &=\matrixentry{A}{ij}&& \knowl{./knowl/definition-TM.html}{\text{Definition TM}}\text{.} \end{align*}
Since the matrices $$\transpose{\left(\transpose{A}\right)}$$ and $$A$$ agree at each entry, Definition ME tells us the two matrices are equal.
### SubsectionMCCMatrices and Complex Conjugation
As we did with vectors (Definition CCCV), we can define what it means to take the conjugate of a matrix.
#### DefinitionCCM.Complex Conjugate of a Matrix. | {
"domain": "runestone.academy",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9888419690807407,
"lm_q1q2_score": 0.8014355644746147,
"lm_q2_score": 0.810478913248044,
"openwebmath_perplexity": 281.1879529503222,
"openwebmath_score": 0.9999170303344727,
"tags": null,
"url": "https://runestone.academy/ns/books/published/fcla/section-MO.html"
} |
statistical-mechanics, condensed-matter
For inhomogeneous systems, those tensor elements become more complicated. Take the diffusion coefficient as an example, in slab geometry (the system is inhomogeneous in $z$ direction but homogeneous in $x$ and $y$ direction), as suggested by this paper(http://www.edocs.fu-berlin.de/docs/servlets/MCRFileNodeServlet/FUDOCS_derivate_000000003238/vonHansen-PRL-2013-111-118103.pdf), the diffusion tensor should have three diagonal elements $D_{xx}(z), D_{yy}(z)$ and $D_{zz}(z)$, where $D_{xx}(z) = D_{yy}(z)$ since there is no confinement in the $xy$ direction. It should be noticed that all these tensor elements have position dependence on $z$.
As mentioned in this paper, because the diffusion in $x$ and $y$ directions can be still viewed as free diffusion, the corresponding diffusion tensors can be still calculated using the mean squared displacement (MSD). Therefore it is possible to compute them with Green-Kubo relation as well. | {
"domain": "physics.stackexchange",
"id": 27520,
"lm_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, condensed-matter",
"url": null
} |
microcontroller, simulation, ros-groovy
Originally posted by Flavian on ROS Answers with karma: 112 on 2013-08-26
Post score: 3
In ROS, the task of converting Cartesian goal positions into a stream of joint positions is traditionally described as the "planning" step. This task typically involves not only IK, but also collision detection and joint-space search algorithms to identify a valid trajectory between the "current" joint state and the specified goal state. Additionally, this planning step may include additional constraints (e.g. maintain desired end-effector orientation) and various trajectory-smoothing filters.
As a first step, you'll need to describe how much of this planning capability you want/need to utilize. I will outline 3 potential approaches below. I recommend #2, but have never used this method. In the past, I have used #1, but that approach requires you to manually provide some of the functionality that MoveIt does automatically in method #2.
Direct IK Solution | {
"domain": "robotics.stackexchange",
"id": 15356,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "microcontroller, simulation, ros-groovy",
"url": null
} |
php, array, tree, trie
Title: Building prefix tree from dictionary, performance issues I'm trying to build a prfix tree. So, using the following dictionary 'and','anna','ape','apple', graph should look like this:
I've tried 2 approaches: using associative array and using self-written tree/node classes.
Note: original dictionary is something about 8 MB and contains >600000 words.
Associative array aproach:
function letter_to_graph ($graph_path,$word,$letter_index) {
$letter=$word[$letter_index];
if (!isset($graph_path[$letter])) {
$graph_path[$letter]=array();
}
if ($letter_index == strlen($word)-1) {
$graph_path[$letter]['.']=array();
} else {
letter_to_graph(&$graph_path[$letter],$word,$letter_index+1);
}
}
function push_word_into_graph ($graph,$word) {
letter_to_graph(&$graph,$word,0);
} | {
"domain": "codereview.stackexchange",
"id": 19828,
"lm_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, array, tree, trie",
"url": null
} |
homework-and-exercises, electromagnetism, electricity, astrophysics, plasma-physics
$$
\mathbf{E} \approx \eta \ \mathbf{j} \tag{1}
$$
Note that $\eta^{-1} = \sigma$ which is the electrical conductivity. So for situations where the current is held constant but $\sigma$($\eta$) decreases(increases), the magnitude of $\mathbf{E}$ must increase accordingly. Situations like this can arise when there's a constant input source for the current from an external driver.
As an aside, one generally does not drop several of the terms I ignored here in generalized Ohm's law for the ionosphere because they are not always negligible in this region. I merely did so to help simplify the point. | {
"domain": "physics.stackexchange",
"id": 70011,
"lm_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, electromagnetism, electricity, astrophysics, plasma-physics",
"url": null
} |
Remarks: The inequality $2^n\gt n$ requires its own proof by induction. The step in which $p^n\mid nb^n$ and $p\not\mid b$ imply $p^n\mid n$ also, technically speaking, requires a touch of induction, starting from Euclid's Lemma ($p\mid xy$ implies $p\mid x$ or $p\mid y$) as the base case. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9805806489800367,
"lm_q1q2_score": 0.8448076912958569,
"lm_q2_score": 0.8615382040983515,
"openwebmath_perplexity": 187.87984028030348,
"openwebmath_score": 0.9340209364891052,
"tags": null,
"url": "https://math.stackexchange.com/questions/2536529/is-n-frac1n-ever-rational"
} |
java, optimization
I haven't tried to solve this type of problem for awhile and I am really curious what people think of this solution in terms of efficiency, robustness and readability. I arrived at this solution by using TDD (Test Driven Development), but I'm not including the test because I'm more interested in people reviewing the solution. If you want to optimize you can : Use arrayCopy() from the System Class to create the final array and reduce variable. Here is my "solution" :
public static Object[] handleArrayIntersection(Object[] array1, Object[] array2) {
Object[] dest;
int itemCount = 0;
Object[] intersect = new Object[array1.length < array2.length ? array1.length : array2.length];
for(int i = 0; i < array1.length; i++) {
Object arr1Val = array1[i];
if(contains(array2, arr1Val) && !contains(intersect, arr1Val)) {
intersect[itemCount++] = arr1Val;
}
} | {
"domain": "codereview.stackexchange",
"id": 1501,
"lm_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, optimization",
"url": null
} |
ros, teleop, network
Originally posted by Tim S on ROS Answers with karma: 13 on 2012-02-17
Post score: 1
Not sure there is a established standard best practice for ROS, but I´ve had good success with sending geometry_msgs/Twist messages at a fixed rate (say 10Hz) during teleop and stopping the robot as soon as no message has been received for a parametrizable time (say 300ms). An example of this scheme was implemented directly on the Arduino microcontroller of this robot and it works well so far.
Originally posted by Stefan Kohlbrecher with karma: 24361 on 2012-02-17
This answer was ACCEPTED on the original site
Post score: 3 | {
"domain": "robotics.stackexchange",
"id": 8279,
"lm_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, teleop, network",
"url": null
} |
general-relativity, lagrangian-formalism, conventions, stress-energy-momentum-tensor, variational-calculus
Title: Energy-momentum tensor from Matter Field Action I'm currently in the process of familiarising myself with some basic concepts of general relativity and have stumbled upon a problem that is probanly quite simple. I'm referring to the book by Hobson, p.541 and 548, where the energy-momentum tensor for a simple matter field action $S$, $$T_{\mu\nu} = \frac{2}{\sqrt{-\det g}}\frac{\delta S}{\delta g^{\mu\nu}},$$ is calculated as an example:
$$
S = \int d^4x\sqrt{-\det g}(\frac{1}{2}g^{\mu\nu}(\nabla_\mu \Phi)(\nabla_\nu \Phi)-V(\Phi))
$$
$$
\delta(\det g) = \det g^{\mu\nu}\delta g_{\mu\nu} = -\det g g_{\mu\nu}\delta g^{\mu\nu} \Rightarrow \delta\sqrt{-\det g} = -\frac{1}{2}\sqrt{-\det g}g_{\mu\nu}\delta g^{\mu\nu}
$$
\begin{eqnarray}
\delta S &=& \int d^4x[\sqrt{-\det g}\frac{1}{2}\delta g^{\mu\nu}(\nabla_\mu \Phi)(\nabla_\nu \Phi) + \delta(\sqrt{-\det g})(\frac{1}{2}g^{\alpha\beta}(\nabla_\alpha \Phi)(\nabla_\beta \Phi)-V(\Phi))] \\ | {
"domain": "physics.stackexchange",
"id": 48012,
"lm_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, lagrangian-formalism, conventions, stress-energy-momentum-tensor, variational-calculus",
"url": null
} |
java, beginner
Title: Grade calculator for a project with four aspects I have a program that will ask the user to input their grades for 4 different sections of a project, then tell them what their total mark is, what grade they got and how many marks away they were from the next grade. I managed to make a single loop for all inputs rather than having a loop for each individual one, but there are still quite a lot of if statements to determine what grade they got and how far away they were from the next one, and I can't figure out how to optimise it since I'm still very new to Java.
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Scanner;
public class PortfolioGrade { | {
"domain": "codereview.stackexchange",
"id": 32862,
"lm_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",
"url": null
} |
navigation, odometry
Original comments
Comment by skiesel on 2012-10-25:
I'm not running gmapping, so the odom frame is stationary. When rviz's frame is set to odom, and I rotate the robot, the laser data does not "trace out" the room, but rather causes a visible swirling. When it returns to its rotational origin, the scans match up. This is correct? Thanks!
Comment by JBuesch on 2012-10-25:
Yes, as I said, when you attach the rviz frame to odom (which is a non stationary frame by definition) it is very likely for you to get strange results. It is like you sitting on the wheel of a car expecting to see everything straight while it rotates. Attach rviz to a fixed frame and try again.
Comment by skiesel on 2012-10-26: | {
"domain": "robotics.stackexchange",
"id": 11496,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "navigation, odometry",
"url": null
} |
homework-and-exercises, newtonian-gravity, work, conservative-field
Work done by Force, FA:-
dWA = $\vec{F_A}\cdot d\vec{r}$
dWA = FA dr cos 180°
dWA = - FA dr ---------Eq(a)
In equation a,
For limits,
Now, when object is at surface of A, r = R
And, when object is at neutral point P, r = 2R
$$\int \, dW_A = \int\limits_{R}^{2R} - F_A \, dr$$
$$W_A = - \int\limits_{R}^{2R} G\frac{Mm}{r^2} \, dr$$
$$W_A = -GMm \int\limits_{R}^{2R} \frac{1}{r^2} \, dr$$
$$W_A = -GMm \biggl[\frac{-1}{r}\biggr]_{R}^{2R} $$
$$W_A = -GMm \biggl[\frac{-1}{2R}-\frac{-1}{R}\biggr] $$
$$W_A = -\frac{GMm}{2R} $$
$$W_A = {\color{violet}{\int\limits_{R}^{2R} - F_A \, dr}} = {\color{pink}{-\frac{GMm}{2R}}} $$
Both equations, violet and the pink one are satisfying each other, infering that the work done by the gravitational force $\vec{F_A}$ will be negative. | {
"domain": "physics.stackexchange",
"id": 44511,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises, newtonian-gravity, work, conservative-field",
"url": null
} |
algorithms, graphs, shortest-path, correctness-proof, weighted-graphs
As an edge case we consider the $0$-th iteration to be completed immediately before the start of the for loop.
The proof is by induction on $i$. The base case $i=0$ is trivially true since the only vertex at hop-distance $0$ from $s$ is $s \in L$ itself and the algorithm explicitly sets $d(s) = 0 = D(s, 0)$.
Consider now $i > 0$. If $t=s$ we know, by induction hypothesis, that after iteration $0$ we have $d(s) \le D(s,0) \le D(s, 2i)$.
Therefore, we restrict ourselves to the case in which $t \neq $ s and $D(t, 2i)$ is finite.
Let $(v,t)$ be the last edge in any shortest path from $s$ to $t$ in $G$ that uses at most $2i$ edges.
If $t \in R$ then $v \in L$ and all paths to $v$ have even hop-length. Therefore, when $(v,t) \in E_1$ is considered, we have $d(v) \le D(v, 2(i-1))$ by induction hypothesis and hence:
$$
D(t, 2i) = D(v, 2i-1) + w(v,t) = D(v, 2(i-1)) + w(v,t) \ge d(v)+w(t).
$$ | {
"domain": "cs.stackexchange",
"id": 18472,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "algorithms, graphs, shortest-path, correctness-proof, weighted-graphs",
"url": null
} |
python, sequence-annotation, gff3, gffutils
I got the following error:
File "/projects/bioinf-scripts/mod_braker_gff3.py", line 20
print(i.attributes['Note']=["Gene description"])
^
SyntaxError: keyword can't be an expression
What did I miss?
Thank you in advance You are printing the attribute before setting it, that's why it's complaining. So instead of this:
print(i.attributes['Note']=["Gene description"])
Set it first and then print:
i.attributes['Note']=["Gene description"]
print(i) | {
"domain": "bioinformatics.stackexchange",
"id": 1084,
"lm_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, sequence-annotation, gff3, gffutils",
"url": null
} |
quantum-mechanics, wavefunction, solid-state-physics
Thanks to a commenter for the reminder that in both answers one and two they give the origin of the $u_{n\mathbf{k}}(\mathbf{r})$ quadrature and state that this is derived from such an equation:
$$
\left[\dfrac{(i\hbar\nabla + \hbar\mathbf{k})^2}{2m} + V(\mathbf{r})\right] u_{n\mathbf{k}}(\mathbf{r}) = E_{n\mathbf{k}}u_{n\mathbf{k}}(\mathbf{r}) \tag{B1}
$$
I know where this wave equation came from, First use the momentum operator $\hat{p}=-i\hbar \nabla$:
$$
\begin{align}
\hat{p}\psi_{n\mathbf{k}}(\mathbf{r}) =& e^{i\mathbf{k}\cdot \mathbf{r}}(\hat{p} + \hbar \mathbf{k})u_{n\mathbf{k}}(\mathbf{r}) \\
\hat{p}^2\psi_{n\mathbf{k}}(\mathbf{r}) =& e^{i\mathbf{k}\cdot \mathbf{r}}(\hat{p} + \hbar \mathbf{k})^2u_{n\mathbf{k}}(\mathbf{r})
\end{align}
$$
Substituting this into the Schrodinger equation gives eq(B1), but I don't know how to derive eq(A2) from eq(B1) Bloch's theorem tells us that the energy eigenvectors of a Hamiltonian with a periodic potential can be written | {
"domain": "physics.stackexchange",
"id": 93817,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, wavefunction, solid-state-physics",
"url": null
} |
python, performance, beginner, programming-challenge
Title: Hackerrank All Women's Codesprint 2019: Name the Product Link: https://www.hackerrank.com/contests/hackerrank-all-womens-codesprint-2019/challenges/name-the-product/
Problem | {
"domain": "codereview.stackexchange",
"id": 33868,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, performance, beginner, programming-challenge",
"url": null
} |
planet, star-gazing
Title: Which Planet/Star is it? I live in north India. About 24° latitude. I can see a very Bright star in sky. Its towards east and high up. Is it Venus , Jupiter, star or anything else?
Its not Sirius. I used Orion belt for that.
Date: 24 March , 2016
Time : 8 :00 p.m.
At 11: 00 pm.
Its directly upwards. Angle b/w moon and sun ~60°. The site in-the-sky.org has a wide variety of functions and options. In Planetarium mode, I chose a random city at about 24N and in the middle, which helps to get the correct UTC + 05:30 India Time Zone, and then just put in the time and date and turned on alt/az grid.
So it is likely to have been Jupiter, as you suspect. Below are two screen shots - 20:00 and 23:00 local time, with Jupiter climbing from 41 to about 73 degrees above the horizon. | {
"domain": "astronomy.stackexchange",
"id": 1527,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "planet, star-gazing",
"url": null
} |
conformal-field-theory, phase-transition, ising-model, lattice-model, scale-invariance
$$
\lim_{T\to T_c\pm 0}|i' - j'||T-T_c| = t = С_{\pm} |i-j| \neq 0
$$
with $C_{\pm} = \lim_{T\to T_c \pm 0} |T-T_c|\xi(T)$. Therefore, the correlation function has the following asymptotics as $T$ approaches $T_c$:
$$
\langle \sigma_{i'}\sigma_{j'} \rangle \sim M_{\pm}^2 G_{\pm}(t).
$$
The index $\pm$ here refers to two cases, $T <T_c$ and $T >T_c$. $G_{\pm}(t)$ are scaling functions that have exact expressions in terms of a Painleve function of the third kind. $M_{\pm}$ are some functions of $T$, $M_{-}$ coincides with magnetization.
You can find much more details, including the asymptotic properties of G, in the following sources:
Article on Scholarpedia about the Ising model
The book of McCoy and Wu
Article by McCoy and Wu | {
"domain": "physics.stackexchange",
"id": 93188,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "conformal-field-theory, phase-transition, ising-model, lattice-model, scale-invariance",
"url": null
} |
c#
What is it with me and while loops today? Again completely overlooked that you don't go out of the outer while loop, which at first I thought you did, thus disposing the textureStream, then as you would re-enter you would have re-created it... Pardon me, ignore my previous statement about this subject.
Optimization
SharpDX.Direct3D9.Texture has a method called FromMemory(), which takes a byte array as one of its argument. It would seem if that method is more apropriate in your scenario, because that way you can completely avoid using textureStream. Simply pass in tempBytes and job done (I assume).
Race condition
You use read as a thread synchronization mechanism, but you are not using any locking. That can lead to the following race condition (which might not effect your app or maybe it needs to work like that):
After this code has taken place:
texturestream.Write(tempBytes, 0, (int)length);
read = true;
AutoReset.Set(); | {
"domain": "codereview.stackexchange",
"id": 4362,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#",
"url": null
} |
java, programming-challenge, playing-cards, stream, rags-to-riches
// sort the cards we are holding in ascending order of rank.
int[] holding = hand.stream().mapToInt(c -> lookupRank(c.charAt(0)))
.sorted().toArray();
int[] countRanks = new int[13];
IntStream.of(holding).forEach(r -> countRanks[r]++);
// filter and sort the group counts.
int countSummary = groupHash(IntStream.of(countRanks).filter(c -> c > 0)
.sorted().toArray());
// match the counts against those things that matter
final int group = IntStream.range(0, GROUPS.length)
.filter(i -> GROUPS[i] == countSummary)
.findFirst().getAsInt();
// record each card as values in the low nibbles of the score.
long score = IntStream.range(0, 5)
.mapToLong(i -> shiftCard(0, holding[i], i)).sum();
// record any group rankings in to the score in the high nibble.
score = shiftCard(score, GROUPSCORE[group], NAMENIBBLE); | {
"domain": "codereview.stackexchange",
"id": 12352,
"lm_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, programming-challenge, playing-cards, stream, rags-to-riches",
"url": null
} |
beginner, linux, shell, zsh
stat=$(mpstat | tail -n 1 | tr -s ' ')
usr=$(echo $stat | cut -d ' ' -f 4)
nice=$(echo $stat | cut -d ' ' -f 5)
sys=$(echo $stat | cut -d ' ' -f 6)
cpu=$(echo $usr + $nice + $sys | bc)
memline=$(free | head -n 2 | tail -n 1 | tr -s ' ')
cached=$(echo $memline | cut -d ' ' -f 7)
free=$(echo $memline | cut -d ' ' -f 4)
cachedfree=$(echo $cached + $free | bc)
mem=$(echo "scale=3;" $cachedfree / 1000000 | bc)
network=$(nmcli nm | sed 's/ */\;/g' | cut -d \; -f 2 | tail -n 1)
tun0=$(ifconfig tun0 2>/dev/null)
vpn=$(if [[ -n $tun0 ]]; then; echo "(vpn:" $(cat /tmp/current-vpn)")"; else; echo ""; fi)
battery=$(acpi -b | sed 's/Battery 0: //; s/ until charged//; s/ remaining//; s/Charging/C/; s/Discharging/D/; s/Full, //; s/Unknown, //')
load=$(uptime | sed 's/.*://; s/,//g')
date=$(date +%a\ %b\ %d\ %H:%M) | {
"domain": "codereview.stackexchange",
"id": 17611,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "beginner, linux, shell, zsh",
"url": null
} |
First, we show $W$ is closed by showing that $\Sigma(\omega_1)-W$ is open. Let $y \in \Sigma(\omega_1)-W$. We show that there is an open set containing $y$ that contains no points of $W$.
Suppose that for some $\gamma<\omega_1$, $y_\gamma \in O=\mathbb{R}-\left\{0,1 \right\}$. Consider the open set $Q=(\prod_{\alpha<\omega_1} Q_\alpha) \cap \Sigma(\omega_1)$ where $Q_\alpha=\mathbb{R}$ except that $Q_\gamma=O$. Then $y \in Q$ and $Q \cap W=\varnothing$. | {
"domain": "wordpress.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9920620049598216,
"lm_q1q2_score": 0.8016527754339622,
"lm_q2_score": 0.808067208930584,
"openwebmath_perplexity": 7027.181819724902,
"openwebmath_score": 1.0000100135803223,
"tags": null,
"url": "https://dantopology.wordpress.com/category/product-space/"
} |
algorithms
"For web developer, index usually refers to database index." It looks like that you come with a training in computer databases. As a web developer myself, I would not agree with you readily at all. Indices are used much more frequently to access array elements in everyday programming in just about every programming language. For example, in JavaScript, if there is an array persons=["alice", "bob", "Diego"], then we can use index 1 to access its second element "bob", persons[1]. You will find the same or similar usage that are also abundant in Java, C, C++, C#, Python, Ruby, Go, etc.
If you want to understand Raft algorithm, one of the best introductory material is the video presented by Diego Ongaro. | {
"domain": "cs.stackexchange",
"id": 12160,
"lm_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",
"url": null
} |
feature-selection
[[4]]
expression(cos(sqrt(sin(sqrt(cos(log(sin(log(x2))) * cos(sqrt(cos(x1)))))))) - cos(x2 * x2))
[[5]]
expression(log(x1))
[[6]]
expression(x2)
[[7]]
expression(sqrt(cos(x2 * (x1 - sqrt(log((sqrt(x1) + x1)/x2/x2)/(sin(x1) * x2))))))
[[8]]
expression(cos(x1))
[[9]]
expression(x2)
[[10]]
expression(cos(x2))
So many unique combinations
summary(grammarDef)
No. of Unique Expressions: 3.993138e+15 | {
"domain": "datascience.stackexchange",
"id": 11274,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "feature-selection",
"url": null
} |
natural-language-processing, natural-language-generation
I'd like to ask what's the best way to go about it.
The "varying sentence structures" part is the easy one: I can do the grammar.
The issue, however, is the "meaningfullness" part. So far, I reckon that in order to implement it, I would need to generate a collocations database for each word: other words can it govern, and as what arguments specifically (e.g., the verb "give" can govern animate nouns as agents and recipients, and inanimate nouns as patients; while the verb can generally only govern some speech-related nouns like "story", "words" or "truth" as patients). I should probably be able to extract this information from a corpus: I would need to use something like deeppavlov to parse the sentence structures (in order to extract the exact relationship between words), and some tool to account for irregular verbs and inflections (I would want for all forms of the same word to be treated as the same word, obviously). | {
"domain": "ai.stackexchange",
"id": 3845,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "natural-language-processing, natural-language-generation",
"url": null
} |
"A fair coin is flipped until it lands on tails. Each time the coin is flipped, the player receives one point. What is the expected number of points the player will receive in a game?"
Let us compute the probability that the player receives exactly $k$ points. This happens when the first $k$ coin flips land on heads and the $(k+1)^{th}$ flip lands on a tail. The probability of this event is hence $$\mathbb{P}(\text{Player receiving k points}) = \underbrace{\frac12 \times \frac12 \times \cdots \frac12}_{\text{The first k flips land on heads}} \times \underbrace{\frac12}_{\text{The (k+1)^{th} flip lands on a tail}} = \frac1{2^{k+1}}$$
Just as a sanity check, we can see that $$\sum_{k=0}^{\infty} \mathbb{P}(\text{Player receiving k points}) = \sum_{k=0}^{\infty} \frac1{2^k} = 1$$
The expected number of points the player wins is hence $$\sum_{k=0}^{\infty} \frac{k}{2^{k+1}} = 1$$
Now lets move on to the second question. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9763105273220726,
"lm_q1q2_score": 0.848244736350675,
"lm_q2_score": 0.868826784729373,
"openwebmath_perplexity": 157.11243994665224,
"openwebmath_score": 0.8597927689552307,
"tags": null,
"url": "https://math.stackexchange.com/questions/147504/coin-flipping-games-dependent-trials"
} |
java, performance, floating-point
import java.lang.Math;
import java.util.Arrays;
public class FloatToBin{
public static double pow2(double a, double b) {
return a * (java.lang.Math.pow(2, b));
}
public static double rem(double a, double b) {
return a % b;
}
public static double fix(double val) {
if (val < 0) {
return Math.ceil(val);
}
return Math.floor(val);
}
public static double vConv(int[] a, double[] b) {
int aRows = a.length;
int bRows = b.length;
double c = 0;
for (int i = 0; i < aRows; i++) {
c += a[i] * b[i];
}
return c;
}
public static void main(String []args){
double a = 340.3562;
int n = 20;
int m = 20;
int count = 0;
int[] out = new int[n + m];
for (int i = -(n-1); i <= m; i++) {
out[count] = (int)rem(a * pow2(1, (double)i), 2);
count++;
} | {
"domain": "codereview.stackexchange",
"id": 13242,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, performance, floating-point",
"url": null
} |
special-relativity, rotational-dynamics, reference-frames, metric-tensor, coordinate-systems
Rest Length
If you look at the spacetime diagram for the motion of an extended object, it traces our a worldsheet, not just a worldline. In its rest frame, the sheet looks like this.
To compute its rest length, we can take a spacelike slice of spacetime which represents a set of simultaneous events. This slice is a spatial submanifold which inherits a Riemannian metric, and the rest length of the object can be computed along that slice. So how do we choose a slice of simultaneity?
The obvious choice is the surface $t=\mathrm{const}$, but that's only true if your clocks are synchronized. In the previous example, the appropriate choice would be $t'=ax+\mathrm{const}$! | {
"domain": "physics.stackexchange",
"id": 78513,
"lm_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, rotational-dynamics, reference-frames, metric-tensor, coordinate-systems",
"url": null
} |
ros-kinetic, smach
Title: whether to use SMACH or not for pick_and_place and door_opening
Hi all,
I want to achieve the pick&place and door opening function for my robot. Currently I wrote a single node for pick&place, with the approaching, grasping, retreating, placing stages being executed sequentially. I intended to implement the door opening in the same way.
Before that I checked the pr2 package, the door opening package is acheived via the SMACH, different stages like door_detection, handle_detection, handle_grasping and so on are implemented as actions. Inside the actions the services like handle_detection may be called.
The SMACH can make the task clear at high level, but needs more work than a single node implementation. I'm wondering whether I should use the SMACH to achieve the pick&place and door_opening tasks. Also, the behavior tree is said to have more advantage for complex tasks than SMACH, but the behavior tree package seems outdated?? | {
"domain": "robotics.stackexchange",
"id": 35612,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros-kinetic, smach",
"url": null
} |
asymptotics
If you learned about cache memory, you will realise that a modern processor may have say 64KByte of very fast L1 cache, maybe 256KByte of fast L2 cache, say 4M of not so fast L3 cache, and uncached memory is quite slow. So as n grows, $c_n$ will jump up every time the memory used exceeds one of those cache limits.
But there are worse problems: The naive algorithm uses a really bad pattern to access memory, but how bad it is depends on particular values of n. Worst case is n = multiple of a large power of 2. You can expect the runtime for n = 128 to be massively larger than for n = 127 or n = 129.
So I'd say your advisor is completely wrong. | {
"domain": "cs.stackexchange",
"id": 15731,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "asymptotics",
"url": null
} |
human-biology, physiology, biophysics, human-physiology, bio-mechanics
Consequently, human running speeds in excess of 50 km/h are likely to be limited to the
realms of science fiction and, not inconceivably, gene doping.
They also look at different scenarios and e.g. point out how important limb length is for top speed:
Second, limbs lengthened through evolution or perhaps prosthetically could
substantially increase the top running speed attained at the minimum period of foot-ground force application. For example, a relatively small increase in leg length of 10 cm would
increase contact lengths by 9 cm and the top speeds of the subjects tested here from 9.1 to 9.8 m/s. | {
"domain": "biology.stackexchange",
"id": 2980,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "human-biology, physiology, biophysics, human-physiology, bio-mechanics",
"url": null
} |
homework-and-exercises, thermodynamics
heat transfer coefficient typically provides a good approximation over most practical times, particularly when the final average temperature is closer to the wall temperature than to the initial temperature. This is the situation that prevails in the present analysis, and thus, we employ the asymptotic heat transfer coefficient. Thus, the present result will provide a close upper bound to the true heating time. | {
"domain": "physics.stackexchange",
"id": 44426,
"lm_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, thermodynamics",
"url": null
} |
scala, simulation, physics
The principle is: when the first AtomConnection element is found that contains the specified Atom, it redirects to the overloaded removeConnection function with this element; otherwise it does nothing.
Please note that the equality is checked with ==, which is equivalent to Java's equals.
The same kind of changes can also be done with removeConnections(atoms:Seq[Atom]) function, but it doesn't seem to be used throughout the code.
The getConnections() function is not necessary at all. It looks like a sort of Java's residue; val connections already has public access and the reference is immutable.
Generally, I'm not sure about the validity of the choice to use var atomState and the exposed ListBuffer for connections field in Atom class. This sort of mutability is somewhat against Scala's principles, but I don't see yet how to work it around.
class IsingModelSmall
In def calcStableState, def getMinMaxWeight and def vibrateInner there are similar calls: | {
"domain": "codereview.stackexchange",
"id": 17200,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "scala, simulation, physics",
"url": null
} |
python, beginner, python-3.x, linked-list
def __len__(self):
"""Returns the length of a linked list."""
return sum(1 for _ in self)
Inserting
Rather than defaulting head, and foot, to None we can default to Node(None).
We can then make your code simpler by getting rid of all the if self.head is None code.
def queue_append(self, data):
self.foot.next = Node(data)
self.foot = self.foot.next
Note: If you do add a default head then you'd need to change __iter__ to not return the default head. However we wouldn't need to change __len__, because __len__ is based off __iter__!
Inserting into the head would also stay simple. The changes we made to Node can also make the code simpler.
def stack_insert(self, data):
self.head.next = Node(data, self.head.next)
if self.foot is self.head:
self.foot = self.head.next
There are some change I'd make to insert_after:
Rather than using stack_insert and queue_append, the code would be far simpler built from scratch. | {
"domain": "codereview.stackexchange",
"id": 40692,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, beginner, python-3.x, linked-list",
"url": null
} |
machine-learning
Title: Linear models to deal with non-linear problems I'm having a hard time wrapping my head around the idea that Linear Models can use polynomial terms to fit curve with Linear Regression. As seen here.
Assuming I haven't miss-understood the above statement, are you able to achieve good performance with a linear model, trying to fit, say a parabola in a 3d space? Actually, a model such as $Y = b_0 + b_1X + b_2X^2$ is not a 3D parabola, but a 2D parabola. There are only two variables ($Y$ and $X$), in other words, the function is still $Y = f(X)$.
A 3D parabola would be a paraboloid, thus the model would be $Y = b_0 + b_1X + b_2X^2 + b_3Z + b_4Z^2$, and a function of the type $Y = f(X,Z)$.
Alternatively, there are mixed models such as $Y = b_0 + b_1X + b_2X^2 + b_3Z$ , which would be a Parabolic Cylinder in 3D and also $Y = f(X,Z)$. | {
"domain": "datascience.stackexchange",
"id": 10794,
"lm_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",
"url": null
} |
With 'draw' we can also create advanced 2D graphics. For instance, we can shadow the area between curves with 'filled_func'. Many more options can be found in the documentation.
(%i115) wxdraw2d( filled_func=sin(x),fill_color=light−gray, explicit(cos(x),x,0,10), filled_func=false,color=blue,line_width=2,key="sin(x)", explicit(sin(x),x,0,10), color=skyblue,line_width=2,key="cos(x)", explicit(cos(x),x,0,10), user_preamble="set key left bottom" );
$\tag{%t115}$
$\tag{%o115}$
5 Data fitting
(%i116) kill(all);
$\tag{%o0} \mathit{done}$
We have already had occasion to work with lists before. The following command creates a list containing the first 75 factorials (we chose not to show it with the symbol $at the end of the command): (%i1) Lista:makelist(n!,n,1,75)$ | {
"domain": "uaslp.mx",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.972830769252026,
"lm_q1q2_score": 0.8085615346754277,
"lm_q2_score": 0.8311430520409023,
"openwebmath_perplexity": 8210.193559783387,
"openwebmath_score": 0.9115439653396606,
"tags": null,
"url": "http://galia.fc.uaslp.mx/~jvallejo/Maxima%20Mini-Tour%2019-May-2019.html"
} |
quantum-mechanics, schroedinger-equation, notation, differentiation, time-evolution
there is an implicit time-dependence which is to be ignored in the derivative, and default to $\frac{\mathrm d}{\mathrm dt}$ otherwise. Sometimes, authors just write $\partial_t$ because it is less effort than $\frac{\mathrm d}{\mathrm dt}$. Sometimes, authors don't really care and just go by gut feeling. | {
"domain": "physics.stackexchange",
"id": 44421,
"lm_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, schroedinger-equation, notation, differentiation, time-evolution",
"url": null
} |
$= (a+b-\lambda) \det \begin{pmatrix} 1&b&1 \\ 1&d-\lambda&1 \\ 0&-1&-\lambda\\ \end{pmatrix} = (c+d-\lambda) \det \begin{pmatrix} 1&b&1 \\ 1&d-\lambda&1 \\ 0&-1&-\lambda\\ \end{pmatrix}$
Hence, $\det ( A- \lambda I) =0 \implies a+b = \lambda = c+d$
The characteristic polynomial is not difficult to solve. Setting $d=a+b-c$ it is $$\chi (A)=t^3 + t^2( - 2a - b + c) + t(a^2 + ab - ac - bc)=t(a + b - t)(a - c - t),$$ so that $0$, $a+b$ and $d-b$ are the eigenvalues. This solution has the advantage that you obtain all eigenvalues.
• That last factoring doesn't look pretty straightforward to me. Is there any trick you used, or else you factored out $\;t\;$ and then solved the quadratic? – Timbuc Apr 9 '15 at 15:38
• @Timbuc Yes, it is only a quadratic polynomial left to factor. This is not difficult, one could use Vieta. – Dietrich Burde Apr 9 '15 at 17:43 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9755769092358048,
"lm_q1q2_score": 0.8108439637222263,
"lm_q2_score": 0.831143045767024,
"openwebmath_perplexity": 257.52584574166684,
"openwebmath_score": 0.7755204439163208,
"tags": null,
"url": "https://math.stackexchange.com/questions/1227085/an-eigen-value-of-tiny-beginpmatrix-ab1-cd1-1-10-endpmatrix"
} |
machine-learning, feature-selection, cross-validation
Alpha Lamda CVM
1 0.0 50.9839208 54.25337
2 0.1 1.7901432 54.37151
3 0.2 3.1427680 54.75240
4 0.3 2.1949422 57.68935
5 0.4 1.8927376 61.68384
9 0.8 1.2510439 63.69622
6 0.5 1.0933677 64.68333
8 0.7 0.2441112 64.73192
7 0.6 2.2050751 65.01727
11 1.0 1.3860429 65.17181
10 0.9 0.5042962 65.70732 I don‘t think a large lambda is a problem per se. It just means that a lot of regularization is going on (under Ridge). See here:
https://stats.stackexchange.com/questions/212056/ridge-lasso-lambda-greater-than-1
Here is a good tutorial from the authors of glmnet. I suggest you check your approach, i.e by looking at various figures as shown in the tutorial, especially plot(cvfit) might be instructive. Also when you go through the tutorial, you see quite „large“ values of lambda (note that log of lambda is plotted).
https://web.stanford.edu/~hastie/glmnet/glmnet_alpha.html | {
"domain": "datascience.stackexchange",
"id": 5730,
"lm_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, feature-selection, cross-validation",
"url": null
} |
computational-chemistry, aromatic-compounds, spectroscopy
Title: Calculating the UV/Vis spectrum of perylene I recently started to do computational chemistry and am now trying to write some basic inputs for important calculations. One, which I guess is quite important to me would be to predict UV/Vis spectra of molecules. So I looked for a basic input file on the net, and although my tutor warned me about using DFT for absorption spectra (it's not a topic of the lecture and therefore he wasn't sure what to use either) the first few simple molecules, mostly long conjugated systems and a few azo-compounds gave really good solutions in comparison to literature values. | {
"domain": "chemistry.stackexchange",
"id": 8435,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "computational-chemistry, aromatic-compounds, spectroscopy",
"url": null
} |
stereochemistry, history-of-chemistry, drugs, medicinal-chemistry, pharmacology
References
Chiral drugs
Pharmaceutical Analysis: David C. Lee, Michael L. Webb, Eds,, Pharmaceutical Analysis; 1st Edn., CRC Press LLC (Behalf of Blackwell Publishing Ltd.): Boca Raton, FL, 2003.
Chemistry for the Biosciences: Jonathan Crowe and Tony Bradshaw, In Chemistry for the Biosciences: The Essential Concepts; 3rd Edn., Oxford University Press: Oxford, United Kingdom, 2014.
Chiral Drugs: Lien Ai Nguyen1, Hua He, Chuong Pham-Huy, "Chiral Drugs: An Overview," International Journal of Biomedical Science 2006, 2(2), 85-100 (https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3614593/); Also availble at: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3614593/).
Stereochemistry in Drug Action: Jonathan McConathy, Michael J. Owens, "Stereochemistry in Drug Action," Primary Care Companion to The Journal of Clinical Psychiatry 2003, 5(2), 70–73 (doi:10.4088/pcc.v05n0202); Also available at: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC353039/. | {
"domain": "chemistry.stackexchange",
"id": 8447,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "stereochemistry, history-of-chemistry, drugs, medicinal-chemistry, pharmacology",
"url": null
} |
to another, or to the... By Duane Q. Nykamp is licensed under a Creative Commons Attribution-Noncommercial-ShareAlike 4.0 License we get! Permute, commute, transpose ( verb ) change the order or place of ; interchange the! Recommended: Please solve It on “ PRACTICE ” first, before moving on to the.! Of 2 * 3 matrix ; Multiply matrices element by element ; Create a matrix by Q.! On “ PRACTICE ” first, before moving on to the matrix transpose achieves no change overall ) also in., literature, geography, and other reference data is for informational purposes only D. or you say. Columns and columns by, writing another matrix B is called the transpose of is! The second column became the second column became the first row and ith column in X be... This in Python now get that C is equal to its transpose is pretty interesting, because how we! Defined by where denotes transposition and the over-line denotes complex conjugation of an orthogonal matrix to! Years, 3 months ago matrix transpose | {
"domain": "frozenfoxmedia.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.98201378740596,
"lm_q1q2_score": 0.8074010577493127,
"lm_q2_score": 0.8221891261650248,
"openwebmath_perplexity": 661.2963888460683,
"openwebmath_score": 0.669063150882721,
"tags": null,
"url": "http://pausescreen.frozenfoxmedia.com/739xv6/transpose-matrix-definition-7f754b"
} |
urdf, ros-kinetic
co_.meshes.push_back(hollowPrism_mesh);
co_.mesh_poses.push_back(prePose);
can_pose_.pose.position.x = co_.primitive_poses[0].position.x;
can_pose_.pose.position.y = co_.primitive_poses[0].position.y;
can_pose_.pose.position.z = co_.primitive_poses[0].position.z;
pub.publish(co_);
planning_scene_msg_.world.collision_objects.push_back(co_);
planning_scene_msg_.is_diff = true;
pub_planning_scene_diff_.publish(planning_scene_msg_);
}
void build_workScene::clear_WorkScene(const char *objName)
{
co_.id = objName;
co_.operation = moveit_msgs::CollisionObject::REMOVE;
pub.publish(co_);
planning_scene_msg_.world.collision_objects.push_back(co_);
planning_scene_msg_.is_diff = true;
pub_planning_scene_diff_.publish(planning_scene_msg_);
ros::WallDuration(0.1).sleep();
}
Originally posted by Hanker_SIA with karma: 26 on 2018-06-28
This answer was ACCEPTED on the original site
Post score: 1 | {
"domain": "robotics.stackexchange",
"id": 30876,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "urdf, ros-kinetic",
"url": null
} |
; that is, Draw all non-isomorphic simple with... Graph are isomorphic n vertices have the same number of vertices is ≤8 for different. 'Ve used the data available in graph6 format here non isomorphic graphs with 8 vertices including parent graphs and test some properties B a! Look at the graph at the top of the other have 5 edges Complete bipartite with. Is isomorphic to its own complement edge level equation of PGTs are developed simple graph with at all! Grap you Should not Include two graphs are connected, have four vertices and edges! Found that there is a closed-form numerical solution you can use this to. Article, we generate large families of non-isomorphic simple graphs with 8 vertices indirectly by the standing... Short, out of the two isomorphic graphs, one is a graph database in sage any with... 2 edges and 2 vertices ; that is, Draw all non-isomorphic graphs having 2 edges and vertices... Exercise 8.3.3: Draw all non-isomorphic simple graphs with the same degree (! ˘=G = | {
"domain": "jitsurei.net",
"id": null,
"lm_label": "1. Yes\n2. Yes\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9770226341042414,
"lm_q1q2_score": 0.8652819865476615,
"lm_q2_score": 0.8856314647623016,
"openwebmath_perplexity": 793.8879132984248,
"openwebmath_score": 0.4210825562477112,
"tags": null,
"url": "http://jitsurei.net/boys-twin-xdjeaej/0ad894-non-isomorphic-graphs-with-8-vertices"
} |
## Step 2
We can pose this question mathematically by taking the limit of the function as goes to infinity. However, finding the limit at this stage poses some challenges and so we are first going to transform the function to be more simple and abstract.
Substitute the variable into the expression, where represents the total number of times the interest is applied and is given by . This changes the function to the equivalent form:
Then, we are going to make two observations. First, observe that scales the output (growth curve) of the function vertically. Second, observe that scales the input of the function horizontally. Because we are interested in modeling the growth curve (shape) of the function and it makes the math cleaner later on, we can set and .
To finish the transformation, from now on, let’s consider to represent the total number of times interest is applied and replace with the more generic variable .
## Step 3
Take the limit of the function as approaches infinity. | {
"domain": "wumbo.net",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9924227590683017,
"lm_q1q2_score": 0.811379524024763,
"lm_q2_score": 0.8175744828610095,
"openwebmath_perplexity": 377.16654778777877,
"openwebmath_score": 0.9054552912712097,
"tags": null,
"url": "https://wumbo.net/example/derive-exponential-function-compound-interest/"
} |
hubble-telescope
Title: Green objects in Hubble Ultra Deep Field I was wondering what are the green objects that you see scattered in the Hubble Ultra Deep Field image (Warning possibly large/slow download : http://imgsrc.hubblesite.org/hu/db/images/hs-2004-07-a-full_jpg.jpg)
A crop of the image reduced in size :
what are the green objects that you see scattered in the Hubble Ultra Deep Field image
The Hubble Ultra Deep Field (HUDF) has approximately 10,000 objects in it. Between 25 and 50 of them are identified as extremely faint stars. That means the remaining ~10,000 objects are galaxies. To answer your question literally then, the green objects are galaxies.
However, I believe what you probably really mean to ask is, why are these galaxies green? To answer that, there are actually a number of points to address. | {
"domain": "astronomy.stackexchange",
"id": 2727,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "hubble-telescope",
"url": null
} |
newtonian-mechanics, lagrangian-formalism, velocity, textbook-erratum
Title: Vector addition in a Lagrangian problem I am currently looking at the first question in this set of Lagrangian problems. I feel a little silly having to ask this, but I am having difficulty seeing why the kinetic energy of the box, $T_m$ is given by:
$$T_m=\frac{1}{2}m(\dot{x}_1^2+\dot{x}_2^2+2\dot{x}_1\dot{x}_1\cos({\theta}))$$ | {
"domain": "physics.stackexchange",
"id": 64526,
"lm_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, lagrangian-formalism, velocity, textbook-erratum",
"url": null
} |
javascript, jquery, html, css
}
);
}
// Determine if button is active or not and change state accordingly
function buttonClick(buttonId) {
$(buttonId).click(
function(){
$(this).toggleClass("activeButton");
toggleActive = checkButton(buttonId, "activeButton");
toggleActive ? $(this).removeClass("highlightButton") : $(this).removeClass("highlightActiveButton");
var panelId = $(this).attr("id") + "Panel";
$("#" + panelId).toggleClass("hidden");
// console.log(toggleActive);
currentPanelCount = $('.panel').length - $('.hidden').length;
$(".panel").width(($(window).width()/currentPanelCount) - 13);
console.log(currentPanelCount)
// console.log("has default highlight" + $(this).hasClass("highlightButton"));
}
);
} | {
"domain": "codereview.stackexchange",
"id": 27376,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, jquery, html, css",
"url": null
} |
fft, fourier-transform, dft
Next, I take the high frequencies from the FFT applied on the droop part and the rest from the non-droop part and I stitch the results and plot them in log scale.
We get a result with expected shape as below:
Now, the problem arise when we change the droop part to be longer (and thus, the non-droop part to be shorter) as seen here:
The output of this looks like this:
The noisy shape is expected, but the amplitude is changing drastically and I can't figure out why.
can someone point what the problems are are help with a solution?
Thanks! So I solved it eventually.
The root of the problem wasn't in the fft to start with.
I've changed np.diff(data) to np.gradient(data) and the amplitudes were consistent.
Thanks! | {
"domain": "dsp.stackexchange",
"id": 8764,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fft, fourier-transform, dft",
"url": null
} |
electrochemistry, carbon-allotropes
Title: How can I make a graphene supercapacitor? I have heard that a super capacitor can be made with a dvd burner. What materials do I need to to get and what software for my DVD burner do I need to make this amazing device? Chemistry World UK have made this YouTube Clip that has a professor from UCLA explaining what is needed and how to go about it - even though the video is about 2.5 minutes, but it is a good demonstration. The associated article is DVD player burns graphene to disc
Additionally, according to this JensLabs page DIY Graphene, it states that the following readily available materials are needed:
Graphite oxide
Light scribe capable DVD burner
Light scribe DVD
Substrate
Sonicator - the article suggests that a ultrasonic cleaner would suffice
Pipette
Ion-porous separator
Electrolyte | {
"domain": "chemistry.stackexchange",
"id": 973,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electrochemistry, carbon-allotropes",
"url": null
} |
java, multithreading, thread-safety, zeromq
And below is my SocketManager class -
public class SocketsManager {
private ZMQ.Context context = ZMQ.context(1);
private static Random rand = new Random(System.nanoTime());
private static class SocketsHolder {
static final SocketsManager INSTANCE = new SocketsManager();
}
public static SocketsManager getInstance() {
return SocketsHolder.INSTANCE;
}
private SocketsManager() {
// should I do anything here?
}
// does below method is right?
public Socket getSockets() {
ZMQ.Socket socket = context.socket(ZMQ.PUSH);
String identity = String.format("%04X-%04X", rand.nextInt(), rand.nextInt());
socket.setIdentity(identity.getBytes());
socket.connect("tcp://localhost:5700");
return socket;
}
} | {
"domain": "codereview.stackexchange",
"id": 10511,
"lm_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, multithreading, thread-safety, zeromq",
"url": null
} |
ros, ros2, rclcpp, build
/home/clepz/workspace/autodrivemessages_ros2/install/autodrive_msgs/lib/libautodrive_msgs__rosidl_typesupport_fastrtps_cpp.so: undefined reference to `geometry_msgs::msg::typesupport_fastrtps_cpp::cdr_serialize(geometry_msgs::msg::Vector3_<std::allocator<void> > const&, eprosima::fastcdr::Cdr&)'
collect2: error: ld returned 1 exit status
make[2]: *** [listener] Error 1
make[1]: *** [CMakeFiles/listener.dir/all] Error 2
make: *** [all] Error 2
---
Failed <<< pub_sub [2.17s, exited with code 2] | {
"domain": "robotics.stackexchange",
"id": 36279,
"lm_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, rclcpp, build",
"url": null
} |
homework-and-exercises, newtonian-mechanics, classical-mechanics
Now I know that the weight of the load will be balanced by the vertical components of the tensile forces. But in this context, I have no idea at all about how to find the tensile forces as the extensions of the cords are said to be negligible, so I don't know how Hooke's law comes into play here. Then, in the hint given it says that since the product of the force constant and length of a segment is constant, so the force constant of the middle cord is different from the outer cords'.
Please help me out with this problem.
The given answer is:
$$ \frac {mg} {1+ 2 \cos^3 \theta} $$
P.S: Are there any resources where I may learn more about such problems and the skills needed to solve them? Kindly recommend some.
Thanks. Although it may appear to be a problem with too many degrees of freedom to solve, it actually isn't.
If the extensions are negligible, it means that in the new force equilibrium, you can assume that $\theta$ did not change significantly. | {
"domain": "physics.stackexchange",
"id": 69486,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises, newtonian-mechanics, classical-mechanics",
"url": null
} |
c#, algorithm, linq
or use linq (like the first example)
Now, assuming you'll have a global List<JoinedShopItemData> named _joinedShopItemData that will hold GetJoinedShopItemData results.
In this case, your GetLockedItems method would be :
public IEnumerable<ShopItemData> GetLockedItems()
{
return _joinedShopItemData
.Where(item => !item.Unlocked && (item.ItemRarity == ItemRarity.Common || item.ItemRarity == ItemRarity.Rare || item.ItemRarity == ItemRarity.Epic))
.Select(item => new ShopItemData
{
ItemId = item.ItemId,
ItemSprite = item.ItemSprite,
ItemRarity = item.ItemRarity,
InGamePrefab = item.InGamePrefab,
PreviewPrefab = item.PreviewPrefab
}).ToArray();
}
This will elemnate the need of creating a separate collection for each property condition (like _codaCommonShopItems, _codaRareShopItems ..etc.). As you will always have a joined object which you can access easily. | {
"domain": "codereview.stackexchange",
"id": 40255,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, algorithm, linq",
"url": null
} |
organic-chemistry, reference-request, symmetry, pericyclic
Within this framework, we can refine our argument for why the reaction is forbidden. In fact, the transition from $\Psi_1$ (reactant ground state) to $\Phi_1$ (product ground state) is adiabatic; however, there is an extremely large electronic activation energy to it, on the order of an electronic excitation energy, which cannot be provided by thermal means.
Real pericyclic reactions
You might notice that the orbital correlation diagram that we drew above is actually similar to that for the disrotatory ring-opening of cyclobutene. The principles are exactly the same, and the state correlation diagram can be constructed exactly analogously (and in fact, the state correlation diagram for this process is found in Fig. 2 of the question), and of course we find that this reaction is thermally forbidden. But, as I alluded to earlier, there is a slight subtlety. Here is the orbital correlation diagram: | {
"domain": "chemistry.stackexchange",
"id": 8543,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "organic-chemistry, reference-request, symmetry, pericyclic",
"url": null
} |
php, security, codeigniter
Title: Is this good login process in CodeIgniter? I'm creating my first login process in CodeIgniter. I'm using the simpleloginsecure library for actual session management but I wrote the controller and model myself and I was hoping if you could see any flaws in it.
My User_model Class
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class User_model extends CI_Model {
public function __construct() {
parent::__construct();
}
function login($email, $password) {
if($this->simpleloginsecure->login($email, $password)) {
return true;
}
return false;
}
}
?>
My User Controller class
<?php if(!defined('BASEPATH')) exit('No Direct script access allowed');
Class User extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->model('user_model');
} | {
"domain": "codereview.stackexchange",
"id": 1465,
"lm_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, security, codeigniter",
"url": null
} |
is equivalence or not. Black Friday is Here! Relations (Related to Ch. Theorem: Let R be a binary relation on a set A and let M be its connection matrix. The relation R on the set {(a,b) | a,b ∈ Z} where (a,b)R(c,d) means a = c or b = d. Ans: 1, 2. Composition in terms of matrices. 5 Sections 31-33 but not exactly) Recall: A binary relation R from A to B is a subset of the Cartesian product If , we write xRy and say that x is related to y with respect to R. A relation on the set A is a relation from A to A.. R is reflexive if and only if M ii = 1 for all i. This means that the rows of the matrix of R 1 will be indexed by the set B= fb R and relation S represented by a matrix M S. Then, the matrix of their composition S Ris M S R and is found by Boolean product, M S R = M R⊙M S The composition of a relation such as R2 can be found with matrices and Boolean powers. Let R 1 be a relation from the set A to B and R 2 be a relation from B to C . Draw the graph of the relation R, represented | {
"domain": "biljoen.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9511422199928905,
"lm_q1q2_score": 0.8046115733491043,
"lm_q2_score": 0.8459424431344437,
"openwebmath_perplexity": 465.7810237515159,
"openwebmath_score": 0.8063153624534607,
"tags": null,
"url": "https://www.biljoen.com/jeff-mauro-fwv/relation-r-on-a-set-is-represented-by-the-matrix-d09407"
} |
Equations Quiz. Many systems of equations are non-linear, and knowing how to solve these non-linear systems is important. This website uses cookies to ensure you get the best experience. Systems of equations with elimination (and manipulation) Practice: Systems of equations with elimination challenge. There are two ways to solve systems of equations without graphing. 2019-20 Algebra 1 Essential Math Concepts (EMCs) 1. Because it is used in such topics as nonlinear systems, linear algebra, computer programming, and so much more. So these are college level. khanacademy. Khan Academy Video Correlations By SpringBoard Activity SB Activity Video(s) Unit 1: Equations, Inequalities, Functions Activity 1 Creating Equations Representing a relationship with 1-1 Learning Targets: Create an equation in one variable from a real-world context. You should look at the "Algebra" playlist if you've never seen algebra before or if you want instruction on topics in Algebra II. Real systems are often | {
"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"
} |
c#, performance, collections, bitwise
var activeIdx = new bool[values.Length];
activeIdx[0] = true;
int targetSum = totalSum / 2 - maxVal;
if (targetSum < 0)
return false;
bool isSuccess = targetSum == 0 || RecursiveTryPartition(values, activeIdx, 1, targetSum);
#region PART III
if (isSuccess)
{
int fstBinIdx = 0, scndBinIdx = 0;
int size = 0;
for (int i = 0; i < activeIdx.Length; i++)
{
if (activeIdx[i])
size++;
}
fstBin = new int[size];
scndBin = new int[activeIdx.Length - size];
for (int i = 0; i < activeIdx.Length; i++)
{
if (activeIdx[i])
fstBin[fstBinIdx++] = values[i];
else
scndBin[scndBinIdx++] = values[i];
}
}
#endregion
return isSuccess;
} | {
"domain": "codereview.stackexchange",
"id": 44394,
"lm_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, collections, bitwise",
"url": null
} |
neuroscience, brain, muscles
Title: Biological Neural Network Training for Babies I am concerned by the fact that babies cant walk because the muscles in their limbs arent developed and tuned to give directional control, it takes years before babies gain mobility and dexterity. So technically the neural nets in the motor cortex requires years of training before that capability is achieved. | {
"domain": "biology.stackexchange",
"id": 10945,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "neuroscience, brain, muscles",
"url": null
} |
I have tried this out, coding it up in C#. Here is the main routine (for brevity I have left out some utility functions and the implementation of the classes MySet and PotentialAnswer).
Code: Select all
static void Main()
{
// Generate some random subsets, but filter out any duplicates
MySet[] subSets = generateSubSets();
foreach (MySet subset in subSets) Console.WriteLine(subset);
int size = 0;
while(true)
{
// try to add one more subset to any of the current potential answers
int index = 0;
foreach (MySet subSet in subSets)
{
{
// store it if it is valid
if (newAnswer != null && newAnswer.Count <= 20)
{
}
}
index++;
}
// if have not found better answers, we are done.
if (answers2.Count == 0) break;
size++;
// replace previous answers by improved ones
var t = answers2;
}
{
}
}
Note that different combinations of subsets may have the same union, so the PotentialAnswer class also keeps track of which subsets were used in its formation. | {
"domain": "projecteuler.chat",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9715639694252315,
"lm_q1q2_score": 0.8352183293095687,
"lm_q2_score": 0.8596637541053281,
"openwebmath_perplexity": 471.2014865749079,
"openwebmath_score": 0.36823469400405884,
"tags": null,
"url": "https://projecteuler.chat/viewtopic.php?f=4&t=3581&p=38948"
} |
coding-theory, encoding-scheme, huffman-coding
Encoded:
0000101100000110011100010101101101001111101011111100011001111110100100101
Why is there no need for a separator in the Huffman encoding? You don't need a separator because Huffman codes are prefix-free codes (also, unhelpfully, known as "prefix codes"). This means that no codeword is a prefix of any other codeword. For example, the codeword for "e" in your example is 10, and you can see that no other codewords begin with the digits 10.
This means that you can decode greedily by reading the encoded string from left to right and outputting a character as soon as you've seen a codeword. For example, 0, 00 and 000 don't code anything so you keep reading bits. When you read 0000, that encodes "E" and, because the code is prefix-free, you know there's no other codeword 0000x, so you can now output "E" and start to read the next codeword. Again, 1 doesn't encode anything but 10 encodes "e". No other codewords begins with "10", so you can output "e". And so on. | {
"domain": "cs.stackexchange",
"id": 6599,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "coding-theory, encoding-scheme, huffman-coding",
"url": null
} |
ds.algorithms, graph-theory, graph-algorithms, formal-modeling
Title: Finding islands of vertices in a network of roads containing one-way streets I am working on GIS project where we are making use of road maps that may contain one-way streets.
We are writing some debugging tools one of which I want to design to find "Islands". This would list out all the sets of vertices such that for each pair of vertices A, B in a set you would be able to get from A to B and from B to A.
Here is an example:
A<----------------------> B
\ /
\ /
\ /
\ /
\ /
\ /
\ /
\ /
\ /
\ /
v v
C | {
"domain": "cstheory.stackexchange",
"id": 273,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ds.algorithms, graph-theory, graph-algorithms, formal-modeling",
"url": null
} |
organic-chemistry, cheminformatics
9 10 1 0
10 11 1 0
11 12 1 0
12 13 2 0
13 14 1 0
13 15 1 0
15 16 2 0
16 17 1 0
17 18 2 0
18 19 1 0
19 20 1 0
20 21 2 0
21 22 1 0
22 23 2 0
23 24 1 0
22 25 1 0
25 26 2 0
26 27 1 0
27 28 2 0
28 29 1 0
28 30 1 0
30 31 2 0
18 32 1 0
32 33 2 0
8 4 1 0
14 10 2 0
33 15 1 0
24 20 1 0
31 25 1 0
M END | {
"domain": "chemistry.stackexchange",
"id": 12325,
"lm_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, cheminformatics",
"url": null
} |
moveit, ros-melodic
Title: How to apply a namespace to the tf topic?
I'm trying to set up two instances of the same robot arm. Both are supposed to be controlled by their own MoveIt move_group. I quickly managed to run all relevant nodes within a namespace per arm. However, the topic /tf remains outside of both namespaces. I suspect that is the reason, why my move_group ends up controlling both arms at the same time.
I came across tf_prefix (http://wiki.ros.org/geometry/CoordinateFrameConventions) which sounds like it would do exactly what I need. However, I could not figure out how to use it. Setting it as a ros param didn't do anything. Is that a MoveIt related issue?
Below see the rqt_graph of my current situation. You can clearly see the box for /tf outside of the /arm1 namespace.
How can I resolve this?
Thanks!
Originally posted by Saduras on ROS Answers with karma: 36 on 2020-05-07
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 34918,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "moveit, ros-melodic",
"url": null
} |
gazebo, simulation, husky, multiple, namespace
<!-- Load Husky control information -->
<include file="$(find mtu_husky_control)/launch/control.launch"/>
<!-- Include ros_control configuration for ur5, only used in simulation -->
<group if="$(arg ur5_enabled)">
<!-- Load UR5 controllers -->
<rosparam command="load" file="$(find mtu_husky_control)/config/control_ur5.yaml" />
<node name="arm_controller_spawner" pkg="controller_manager" type="spawner" args="arm_controller --shutdown-timeout 3"/>
<!-- Fake Calibration -->
<node pkg="rostopic" type="rostopic" name="fake_joint_calibration" args="pub calibrated std_msgs/Bool true" />
<!-- Stow the arm -->
<node pkg="husky_control" type="stow_ur5" name="stow_ur5"/>
</group>
<group if="$(arg kinect_enabled)">
<!-- Include poincloud_to_laserscan if simulated Kinect is attached -->
<node pkg="pointcloud_to_laserscan" type="pointcloud_to_laserscan_node" name="pointcloud_to_laserscan" output="screen"> | {
"domain": "robotics.stackexchange",
"id": 23632,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gazebo, simulation, husky, multiple, namespace",
"url": null
} |
nlp, named-entity-recognition
You can see that that I have the entity tag and the part of speech tag in the word. When I parse this dataset for training, I also add the IOB tags (Inside, Outside, and Beginning)
[(('Claxton', 'NNP\n'), 'B-PLAYER'),
(('hunting', 'VBG\n'), 'O'),
(('first', 'RB\n'), 'O'),
(('major', 'JJ\n'), 'O'),
(('medal', 'NNS\n'), 'O'),
(('.', '.\n'), 'O'),
(('British', 'JJ\n'), 'O'),
(('hurdler', 'NN\n'), 'O'),
(('Sarah', 'NNP\n'), 'B-PLAYER'),
(('Claxton', 'NNP\n'), 'I-PLAYER')......]
Then I just used the ClassifierBasedTagger(There are other taggers too). I can't find the source but I used this code:
class NamedEntityChunker(ChunkParserI):
def __init__(self, train_sents, **kwargs):
assert isinstance(train_sents, Iterable), 'The training set should be an Iterable'
self.feature_detector = features
self.tagger = ClassifierBasedTagger(
train = train_sents,
feature_detector = features,
**kwargs) | {
"domain": "datascience.stackexchange",
"id": 3713,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "nlp, named-entity-recognition",
"url": null
} |
metric-tensor, tensor-calculus
Up to here we are fine because notice we started with a rank 2 tensor (2 free indices) on the left and we still have the same 2 free indices on the right. The next step,
$$X^{\mu 0} \eta_{00} + \ldots $$
is unwarranted because you lose a free index. This is no longer equal to the line above.
If you were summing over $\nu$ then you would be right to drop all the terms that had any non-diagonal elements of $\eta$ as you noted. For instance consider if we contract $\nu$ with some rank 1 tensor $Y$:
$$Y^{\nu}X^{\mu}_{\nu} =Y^{\nu}X^{\mu 0}\eta_{0 \nu} + Y^{\nu}X^{\mu 1} \eta_{1 \nu} + \ldots $$
$$Y^{\nu}X^{\mu}_{\nu} =Y^{0}X^{\mu 0}\eta_{0 0} + Y^{1}X^{\mu 1} \eta_{1 1} + \ldots $$
which would now be a rank one tensor. Note how I indeed dropped terms that had $\eta_{01}$ like you wanted. In summary, never drop a free index, always have the same free indices on the left and the right. | {
"domain": "physics.stackexchange",
"id": 98813,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "metric-tensor, tensor-calculus",
"url": null
} |
between the two line in space planes are not parallel they... -- between them can be calculated vector help Further vectors help please out the distance between two lines ( )... The parallel lines but all of them seem to work with lines rather than line segments that..., they have no distance -- 0 distance -- 0 distance -- 0 distance -- between them formula two... Lines can be measured + t are denoted by L 1 and L 2 we. Rather than line segments distance found is the shortest distance between parallel lines concept teaches students how to find... Solution for hours, but all of them seem to work with lines rather than line segments be measured found... The blue lines in the 3d plane shortest distance between two parallel lines is perpendicular to both the lines is probably a place! Parallel planes is understood to be the shortest distance between skew lines L and... Need to give the distance between two skew lines lies along the line which perpendicular... Two skew lines lies along the | {
"domain": "hostalitecloud.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9759464492044004,
"lm_q1q2_score": 0.8195353859832181,
"lm_q2_score": 0.8397339696776499,
"openwebmath_perplexity": 298.37283224419957,
"openwebmath_score": 0.7286778688430786,
"tags": null,
"url": "http://www.hostalitecloud.com/trombone-drawing-dojphho/611a7a-shortest-distance-between-two-parallel-lines"
} |
homework, electrons, spectroscopy, spectrophotometry
Title: UV-Visible Spectroscopy in the analysis of sodium chloride in potato chips Here is the question and answer out of an exam paper:
Firstly, I thought UV-Visible can also use radiation in the visible spectrum. Also when analyzing sodium chloride (a molecule), then UV-Visible would be more appropriate than AAS, because AAS would be used for just Na (Sodium). Would I be wrong to have said UV-Visible? NaCl solution as you know is almost transparent in the VIS region, UV-VIS spectroscopy can be used to determinate concentration of soluble salt see J. Phys. Chem. A 2008, 112, 2242-2247 however UV part of the spectra is used instead of VIS part, so this does not fit the restrictions of your question.
Surely AAS has a greater sensibility and so is the best technique to use in this case. | {
"domain": "chemistry.stackexchange",
"id": 1095,
"lm_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, electrons, spectroscopy, spectrophotometry",
"url": null
} |
rviz, camera
Title: How to move rviz 3D view with keyboard ("W,A,S,D", etc.)?
Is it possible in rviz to use keyboard key presses to enable movement of 3D camera view, instead of using mouse clicks and drags?
For example, I hope to press key "W" to move forward, "A" to left, "D" to right, "Z" for up, etc.
Or if this is currently not possible in rviz, how can I develop a plugin to enable that (which class to inherit and functions to override)?
Thanks in advance!
Originally posted by Wanli on ROS Answers with karma: 23 on 2015-01-08
Post score: 2
There's the fps_motion_tool, an rviz plugin that does exactly what you want. Not sure about its current status, but if you run into problems, I'm sure the author (hdeeken) will be happy to help you.
Originally posted by Martin Günther with karma: 11816 on 2015-01-09
This answer was ACCEPTED on the original site
Post score: 3 | {
"domain": "robotics.stackexchange",
"id": 20521,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "rviz, camera",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.