text stringlengths 49 10.4k | source dict |
|---|---|
fermentation
In short, the control of home fermentations lies in (1) statistical likelihood that the right organism is present in the environment; (2) the nature of the nutrient and climate; (3) the experience of the person(s) monitoring the process; and (4) luck. | {
"domain": "biology.stackexchange",
"id": 4848,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fermentation",
"url": null
} |
quantum-mechanics, schroedinger-equation
Title: Derivation of time-dependent Schrödinger equation from De Broglie hypothesis In a quantum mechanics script I'm reading, the Schrödinger equation is "derived" (more precisely, motivated) by the De Broglie hypothesis. It starts at
$$
\lambda = \frac{2\pi h}{p}
$$
$$
\omega = \frac{E}{h}
$$
then takes the partial derivatives of the wave $\Psi(x,t) = \Psi(0,0)e^{\frac{2\pi ix}{\lambda}-it\omega}$
$$
\tag{1}
\frac{\partial}{\partial x}\Psi(x,t) = \frac{ip}{h}\Psi(x,t)
$$
$$
\frac{\partial}{\partial t}\Psi(x,t) = -i\frac{E}{h}\Psi(x,t)
$$
With the non-relativistic free particle $E=\frac{1}{2m}p^2$ one gets
$$
\tag{2} ih\frac{\partial}{\partial t}\Psi(x,t) = E\Psi(x,t) = \frac{p^2}{2m}\Psi(x,t)
$$
From there, they miraculously get the time-dependent Schrödinger equation. I cannot understand this step. If I insert formula (1) for $p^2$ in (2), I get something with $(\frac{\partial}{\partial x}\Psi)^2$, which is not the second partial derivative of $\Psi$ with respect to $x$.
Any hints? You're looking for some form of differential operator that will take your plane wave
$$\Psi(x,t) = \Psi(0,0)\exp\left[\frac{2\pi ix}{\lambda}-i\omega t\right]$$
and will return $p^2\Psi(x,t)$. As you've noticed, you can apply a space derivative to get
$$ | {
"domain": "physics.stackexchange",
"id": 23898,
"lm_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",
"url": null
} |
c#
for (c = (char)0; c < 255; c++)
{
cc[c] = 0;
}
for (int i = 0; i < s.Length; i++)
{
if((s[i]!=(char)32)&(s[i]!=(char)44)){ //if you use a different encoding than ascii please replace the numbers with the appropriate numbers from the character table
cc[s[i]]++;
}
}
int cntMax = 0;
for ( c = (char)0; c < 255; c++)
{
if(cc[c] > cntMax)
{
cntMax = cc[c];
}
}
string L = "";
if(cntMax >0 )
{
for ( c =(char) 0; c < 255; c++)
{
if(cc[c] == cntMax)
{
if(c > 32) //and here
{
L = L + c + " ";
}
}
}
Console.Write(L);
}
You could also consider the use of regular expressions like here:
https://stackoverflow.com/questions/14565934/regular-expression-to-remove-all-non-printable-characters
(I know it's java but the concept should be the same)
And I'm not an expert to ask for "pretty" code as I only focus to make it work :). But you could save some lines where you initialize your int array cc. I think there is a way to write that shorter. | {
"domain": "codereview.stackexchange",
"id": 27066,
"lm_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
} |
# The natural logarithmic function essay
The natural logarithmic function essay, The history of logarithms is the story of a correspondence around 1730, leonhard euler defined the exponential function and the natural logarithm by = →.
Home math, popular an intuitive guide to exponential functions & e the mathematical constant e is the base of the natural logarithm. 32 logarithmic functions and their graphs the definition above implies that the natural logarithmic function and the natural exponential function are inverse. Introduction to exponents and logarithms introduction to exponential and logarithmic functions the natural logarithm [latex]ln(x. 32 the natural logarithm function brian e veitch this means the value of lnx, x the the negative of the area shown above this should make sense from one of. Introduction to logarithms mathematicians use log (instead of ln) to mean the natural logarithm this can lead to confusion: example engineer thinks.
The common and natural logarithms (page since the log function is the inverse of the exponential function, the graph of the log is the flip of the graph of the. A summary of the number e and the natural log in 's inverse, exponential, and logarithmic functions learn exactly what happened in this chapter, scene, or section of. In fact, another approach to introduce the exponential and logarithmic functions in calculus is to present the natural logarithm first, defined exactly as we did l (x. Yes, exponential and logarithmic functions isn’t particularly exciting but it can, at least, be enjoyable we dare you to prove us wrong.
Natural logarithms used with base e logarithmic function: definition & examples related study materials essay prompts. College essay financial the number e and the natural logarithm function of an exponential function natural logarithms are special types of. A-1 natural exponential function in lesson 21, we explored the world of logarithms in base 10 the natural logarithm has a base of “e” “e” is approximately. 51 the natural logarithmic function and differentiation and the definition of the natural logarithmic function: to this point later in this essay. | {
"domain": "allstarorchestra.info",
"id": null,
"lm_label": "1. Yes\n2. Yes\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.986571742099477,
"lm_q1q2_score": 0.8705784035860106,
"lm_q2_score": 0.882427872638409,
"openwebmath_perplexity": 709.9886028109532,
"openwebmath_score": 0.8453141450881958,
"tags": null,
"url": "http://bstermpaperwcen.allstarorchestra.info/the-natural-logarithmic-function-essay.html"
} |
IV) The Boolean algebra induced on the family of Boolean functions
Let $\Phi = (S, \vee, \wedge, \neg, 0, 1)$ be a Boolean algebra. For every non-empty set, $R$, the sextet $(R \rightarrow S, \vee, \wedge, \neg, 0, 1)$ becomes a Boolean algebra if we apply the Boolean operations component-wise and if we regard $0$ and $1$ as constant functions on $R$. We shall refer to the latter Boolean algebra as $\Phi^R$.
We shall denote by $\Psi_0$ the standard two element Boolean algebra on $\mathbb{Z}_2$, and by $\Psi$ the induced Boolean algebra $(\Psi_0)^{\mathfrak{P}X}$.
V) Consistent partitions
Let $S, T$ be non empty sets. For every $i \in \mathbb{N}_0$ consider the set $\mathcal{F}^{S, T}_i$ consisting of all functions $f:S^i\rightarrow T$. Define $\mathcal{F}^{S, T} := \bigcup_{i=0}^\infty \mathcal{F}^{S, T}_i$. For every $f \in \mathcal{F}^{S, T}$ define $f$'s degree, $\deg(f)$, to be the unique number $i\in\mathbb{N}_0$ such that $f \in \mathcal{F}^{S, T}_i$. If $S = T$, we simplify and write $\mathcal{F}^S := \mathcal{F}^{S, T}$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9715639694252315,
"lm_q1q2_score": 0.823854921274176,
"lm_q2_score": 0.8479677583778258,
"openwebmath_perplexity": 289.99836342887994,
"openwebmath_score": 0.9999847412109375,
"tags": null,
"url": "https://math.stackexchange.com/questions/1985539/is-2-frakc-separable"
} |
python, programming-challenge
… then that is a candidate to be replaced by a one-liner.
Always call open() in the context of a with block, for tidier and more reliable code.
Suggested solution
I would define three very short helper functions. Then, the entire challenge can be solved in a few lines of code within main(). The master vocabulary list is a local variable within main(), instead of being a global variable that is initialized somewhere in the middle of the code and mysteriously incorporated into rack_check().
Instead of a dict, I've opted to use a list of (score, word) tuples, which is slightly easier to sort.
LETTER_POINTS = {...}
def calc_score(word):
"""Sum the point values of the letters of the word."""
return sum(LETTER_POINTS[letter] for letter in word)
def read_word_list(filename):
"""Read a list of words, one word per line of the file."""
with open(filename) as f:
return [line.rstrip('\n') for line in f]
def can_form_word(rack_letters, word):
"""
Determine whether a word can be formed only using the letters on the rack.
"""
return all(word.count(c) <= rack_letters.count(c) for c in word)
def main():
"""
For some letter tiles specified by the user, print the words in the
SOWPOD dictionary that can be formed, in descending order of their
Scrabble scores.
"""
vocabulary = read_word_list('sowpods.txt')
rack_letters = raw_input("Letters: ").lower()
words = [word for word in vocabulary if can_form_word(rack_letters, word)]
word_scores = [(calc_score(word), word) for word in words]
for points, word in sorted(word_scores, reverse=True):
print('{0}-{1}'.format(word, points))
if __name__ == '__main__':
main() | {
"domain": "codereview.stackexchange",
"id": 26874,
"lm_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, programming-challenge",
"url": null
} |
classical-mechanics
Title: max velocity of SHM So I think my algebra is wrong somewhere.
Lets say you have an object that goes under SHM with some initial conditions (amplitude is 5m. The piston is at 5m at t = 0 and period is 20 seconds).
Okay so $x(t) = A sin(\omega_0 + \phi)$. $\phi$ for us is 0. The frequency = $0.05 Hz$, angular frequency = $\frac{\pi}{10}$ and period of the piston = $20s$.
The maximum velocity is is when the first derivative $x'(t) = \omega_0 A cos(\omega_0 t)$
The maximum velocity is when the cosine function is 1 at x = 0. So the maximum velocity is $v(t) = A\omega_0$ so that means $cos(\omega_0 t)= 1$ but $\omega_0 = \frac{\pi}{10}$ so the missing value is t. But thats trivial to find, since cosine function is 1. So $t = 20s$
So here is my issue. The maximum velocity can only be at x = 0 (when kinetic energy is max, and potential energy is zero). But the value t = 20s represents the object at x = Amplitude.
So what am I doing wrong?
edit: I just realized that if $x(t) = A sin(\omega_0 + \phi)$ then the initial conditions are not satisfied. When t = 0, sin function goes to 0 and hence everything is 0 but that dosnt satisfy initial conditions. When $t = 0$, displacement should be $5m$ However, if i replace $sin$ with $cos$ then everything works. Is that okay?
But the value t = 20s represents the object at x = Amplitude.
Check this calculation again. Remember your formula is $x(t) = A sin(\omega_0 t)$, and you should get full credit on your homework.
(or at least mostly full credit. There are many values of $t$ that satisfy $cos(\omega_0 t)=1$, right? you've found only one, which isn't the most general answer you could give.) | {
"domain": "physics.stackexchange",
"id": 366,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "classical-mechanics",
"url": null
} |
dft, stft, magnitude
Title: Interpreting magnitude of DFT results I'm working on creating a simple program to render spectrograms like this one. In this plot, the X-axis is time, the Y-axis is frequency, and the color represents the magnitude of the DFT at that frequency and time.
I have most of this working, but I'm not exactly sure how to interpret the magnitude value. I'm computing it as follows:
real * real + imaginary * imaginary
(Note that I'm not square rooting it, since Wikipedia indicates that the spectrogram should be related to the square of the magnitude.)
I've seen certain spectrograms which work with magnitude on the dBFS scale. What's the process to translate these magnitudes to this scale? Or, alternatively, is there some easier way to go about this? One common practice is to take the log of the squared magnitude of the DFT frames, as in log(re*re+im*im), scale that, and use the scaled log as an integer index into an RGB color lookup table ("hotter" colors for larger magnitudes). The scale is determined so that the range in your data fits within the color index table.
A log scale is used, since it's a closer match to human perception of loudness than a linear scale.
A square root is un-needed, as that's the same as adjusting the scale after the log by 0.5. | {
"domain": "dsp.stackexchange",
"id": 2084,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "dft, stft, magnitude",
"url": null
} |
apache-hadoop, aws
Title: Processing data stored in Redshift We're currently using Redshift as our data warehouse, which we're very happy with. However, we now have a requirement to do machine learning against the data in our warehouse. Given the volume of data involved, ideally I'd want to run the computation in the same location as the data rather than shifting the data around, but this doesn't seem possible with Redshift. I've looked at MADlib, but this is not an option as Redshift does not support UDFs (which MADlib requires). I'm currently looking at shifting the data over to EMR and processing it with the Apache Spark machine learning library (or maybe H20, or Mahout, or whatever). So my questions are:
is there a better way?
if not, how should I make the data accessible to Spark? The options I've identified so far include: use Sqoop to load it into HDFS, use DBInputFormat, do a Redshift export to S3 and have Spark grab it from there. What are the pros/cons for these different approaches (and any others) when using Spark?
Note that this is off-line batch learning, but we'd like to be able to do this as quickly as possible so that we can iterate experiments quickly. The new Amazon Machine Learning Service may work for you. It works directly with Redshift and might be a good way to start. http://aws.amazon.com/machine-learning/
If you're looking to process using EMR, then you can use Redshift's UNLOAD command to land data on S3. Spark on EMR can then access it directly without you having to pull it into HDFS.
Spark on EMR: https://aws.amazon.com/articles/Elastic-MapReduce/4926593393724923 | {
"domain": "datascience.stackexchange",
"id": 448,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "apache-hadoop, aws",
"url": null
} |
discrete-signals, signal-analysis, digital-communications, filter-design, kalman-filters
if you aren't selecting the correct constellation point then your filter is converging to the wrong thing. More likely(lets say in a hypothetical AWGN) you will select a point sometimes right, sometimes wrong - hopefully if you select it right more than wrong, the rights will dominate the filter updates.
Your transmitted pulses need to be mostly evenly distributed among the constellation, otherwise I think you could have a DFE converge to something perfect for one pulse train but maybe terrible for the others.
Intuitively you're attempting to invert the frequency response of the channel or reverse the impulse response but this is impossible for finite length equalizers.
I don't know what is currently used but I'm not sure if the standards which use OFDM have DFE or just do channel estimation and lock it down until the next pulse.
Your question about convergence: I don't know, I'm not sure how to analyze DFE, the adaptive filter course I took didn't address it - I have my doubts on how easy a proof is showing it will converge because even proving relatively simple things in adaptive filter theory is really hard(like the convergence pro0f of LMS algorithm was nontrivial even though it's a super simple filter).
I also have seen multiple proofs of algorithms like CMA which either proves it does converge or doesn't converge, or converges for a while and then diverges with a set of assumptions I'm not sure make the proofs relevant to real world applications.
Here's a short MS thesis which talks about some of this:
https://pdfs.semanticscholar.org/106d/7871c03d837a57be6cdf755d4efd44f5e96c.pdf
Basically, bad things can happen. | {
"domain": "dsp.stackexchange",
"id": 8424,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "discrete-signals, signal-analysis, digital-communications, filter-design, kalman-filters",
"url": null
} |
ros, c++, msg-subscriber, ros-kinetic
I removed the const qualifier on the ros::NodeHandle. I have no idea why this didn't work with the const qualifier, there is a const-qualified member function overload of ros::NodeHandle.subscribe() so it should be able to be called on a const reference...
Someone who reads this answer and figures out exactly why, please tell me!
Originally posted by rpg711 with karma: 16 on 2018-04-16
This answer was ACCEPTED on the original site
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 30656,
"lm_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, c++, msg-subscriber, ros-kinetic",
"url": null
} |
python, performance, python-3.x, html, beautifulsoup
And you want to extract a list of the headers grouped with the content:
[('a', 'b'), ('c', 'd')]
The slow part of your code is most certainly the if tag in headers. If header is a list of 10k elements, then for each element in .main you are searching through potentially 10k elements. This is horribly inefficient. If headers was a set, this would be more efficient, but there's no need for it to be (or for you to check if tag in headers).
def get_header_content_pairs(doc):
main = doc.find("div", class_="main")
headers = main.find_all("div", class_="header")
for header in headers:
yield (header, list(get_content(header.nextSibling)))
def get_content(element):
while element.name == 'p':
yield element
element = element.nextSibling
Haven't tested this, but the gist is instead of doing all that work, you take advantage of the fact that each BS element knows about its nextSibling. You find all of the .headers. For each of them, you continue checking nextSibling until you find something that isn't a <p>. You aggregate these and return them with their header. | {
"domain": "codereview.stackexchange",
"id": 31730,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, performance, python-3.x, html, beautifulsoup",
"url": null
} |
C��;�2N��Sr�|NΒS�C�9M>!�c�����]�t�e�a�?s�������8I�|OV�#�M���m���zϧ�+��If���y�i4P i����P3ÂK}VD{�8�����H��5�a��}0+�� l-�q[��5E��ت��O�������'9}!y��k��B�Vضf�1BO��^�cp�s�FL�ѓ����-lΒy��֖�Ewaܳ��8�Y���1��_���A��T+'ɹ�;��mo��鴰����m����2��.M���� ����p� )"�O,ۍ�. CC BY-SA 3.0. The dot product of two complex vectors is defined just like the dot product of real vectors. Each of the vector spaces Rn, Mm×n, Pn, and FI is an inner product space: 9.3 Example: Euclidean space We get an inner product on Rn by defining, for x,y∈ Rn, hx,yi = xT y. 3. . An inner product is a generalized version of the dot product that can be defined in any real or complex vector space, as long as it satisfies a few conditions.. The properties of inner products on complex vector spaces are a little different from thos on real vector spaces. 1. . The existence of an inner product is NOT an essential feature of a vector space. 2. . Definition Let be a vector space over .An inner product on is a function that associates to each ordered pair of vectors a complex number, denoted by , which has the following properties. In math terms, we denote this operation as: If we take |v | v to be a 3-vector with components vx, v x, vy, v y, vz v z as above, then the inner product of this vector with itself is called a braket. ;x��B�����w%����%�g�QH�:7�����1��~$y�y�a�P�=%E|��L|,��O�+��@���)��$Ϡ�0>��/C� EH �-��c�@�����A�?������ ����=,�gA�3�%��\�������o/����౼B��ALZ8X��p�7B�&&���Y�¸�*�@o�Zh� XW���m�hp�Vê@*�zo#T���|A�t��1�s��&3Q拪=}L��$˧ ���&��F��)��p3i4� �Т)|��q���nӊ7��Ob�$5�J��wkY�m�s�sJx6'��;!����� Ly��&���Lǔ�k'F�L�R �� -t��Z�m)���F�+0�+˺���Q#�N\��n-1O� | {
"domain": "ac.th",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9674102524151827,
"lm_q1q2_score": 0.8488800296174422,
"lm_q2_score": 0.8774767762675405,
"openwebmath_perplexity": 668.7707819299859,
"openwebmath_score": 0.8892807364463806,
"tags": null,
"url": "https://maet.eat.kmutnb.ac.th/v0uuvx85/inner-product-of-complex-vectors-8f9b90"
} |
inorganic-chemistry, redox, electronic-configuration, transition-metals, reduction-potential
We can go looking for some standard thermodynamic data to help make our case. The best data are for standard reduction potentials, because these data are for exactly what we want!
Taking the reduction potential data and writing the equations in the direction we care about, we have:
$$\begin{align}
&\ce{Fe^2+ -> Fe^3+} &&&E^\circ=\pu{-0.77 V}\\
&\ce{Cr^2+ -> Cr^3+} &&&E^\circ=\pu{+0.44 V}
\end{align}$$
Spontaneous reactions produce positive potential differences, so we can see right now that $\ce{Cr^2+}$ is a better reducing agent.
Let's go a step farther to free energy.
$$\Delta G^\circ =-nFE^\circ$$
However, to deal with free energy, we need a full reaction. Technically, comparing the two half-reactions in isolation is just as bad. However, the definition of the standard electrode potential and the standard free energy come with a common zero point in terms of half-reaction: $\ce{2H+ + 2e- -> H2}$.
The two full reactions (net ionic equations anyway) are:
$$\begin{align}
&\ce{2Fe^2+ + 2H+ -> 2Fe^3+ + H2} &&E^\circ=\pu{-0.77 V}&&&\Delta G^\circ=\pu{+74kJ/mol}\\
&\ce{2Cr^2+ + 2H+ -> 2Cr^3+ + H2} &&E^\circ=\pu{+0.44 V}&&&\Delta G^\circ = \pu{-42 kJ/mol}
\end{align}$$ | {
"domain": "chemistry.stackexchange",
"id": 10970,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "inorganic-chemistry, redox, electronic-configuration, transition-metals, reduction-potential",
"url": null
} |
As with the above, prove that $$f_i(x_k) = \begin{cases} 1 & i = k \\ 0 & i \ne k\end{cases}$$ for generic indices instead of repeating the same argument many times. And write the combination as $$\sum_k a_kf_k$$ for the same reason. It will be easier, not harder, for someone to read over what you have here. Too many symbols squished together in one little paragraph is difficult to follow, as your brain has to constantly switch back and forth in how it interprets what it sees.
Conclude with something like "Hence the dimension of $C(X)$ is at least $n$. Or, turning it around, the number $n$ of chosen points is at most the dimension of $C(X)$. Since that dimension is finite, there is an upper limit on the number of points that can be chosen from $X$. I.e., $X$ is finite."
• Thanks... This is useful... – user312648 Mar 10 '16 at 11:09
• @cello - in illustration of my first paragraph, I have made some changes to the post, particularly to the conclusion. – Paul Sinclair Mar 10 '16 at 15:59
Let $f:N\to X$ be an injection. For each $n\in N$ the point $f(n)$ does not belong to the closed set $F_n=\{f(j):j<n\}$ so there is a continuous $g_n:X\to [0,1]$ such that $g_n (f(n))=1$ and $\{g(x):x\in F_n\}\subset \{0\}.$
For each $n\in N,$ the function $g_n$ is linearly independent from $G_n=\{g_j:j<n\}$ because if $h$ is any linear combination of members of $G_n$ then $h(f(n))=0\ne 1=g_n(f(n)),$ so $h\ne g_n.$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9891815535796247,
"lm_q1q2_score": 0.8243093219214626,
"lm_q2_score": 0.8333245994514084,
"openwebmath_perplexity": 99.09377998867093,
"openwebmath_score": 0.9336989521980286,
"tags": null,
"url": "https://math.stackexchange.com/questions/1690725/an-application-of-urysohns-lemma/1691286"
} |
quantum-mechanics, homework-and-exercises, perturbation-theory, hyperfine-structure
Title: A question on perturbative terms involved in the hyperfine structure of hydrogen In studying the hyper-fine structure of the hydrogen atom at the 2n level in my notes the following is stated ;
$$\langle W_{mv} \rangle _{2s}=\langle n=2, l=0|- \frac{\hat{P^4}}{8m_e^3c^2}| n=2, l=0\rangle=\frac{-13}{128}m_ec^2\alpha^4$$
and no other explanation as to how this was computed.
for the 2p level there is even less detail.
$$\langle W_{mv}\rangle_{2p}=\frac{-7}{384}m_ec^2\alpha^4$$
and no other explanation as to how this was computed was given either.I'm particularly confused as to why l=0 and l=1,0,-1 give different results ( although i think i understand it theoretically ) as there doen't seem to be a dependance on l in the equation for $W_{mv}$, at least not explicitly.
I can't figure out how these were found could anyone go into some more detail on how to compute them?
I don't really need too much theory , there's 100's of pages of that in the notes. Just a way to compute this expectation value. The expression given is equivalent to $$\int \psi_{2,0,0}^*(r,\theta,\phi) \left( -{ \hat p^4 \over 8 m^3c^2} \right)\psi_{2,0,0}(r,\theta,\phi) \, {\rm d}V$$
$\hat p^4$ is $\hbar^4 (\nabla^2)^2$. You know the formula for $\nabla^2$ in spherical polars, or you can look it up. | {
"domain": "physics.stackexchange",
"id": 48901,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, homework-and-exercises, perturbation-theory, hyperfine-structure",
"url": null
} |
java, performance, iterator
Title: How to make an iteration in a for-loop faster? I have a list with contentlets and want all languages from every contentlet (I get these with the method languageAPI.getAllValuesByKey(key , contentList). I get a HashMap and iterate over it. There are 1000 keys available. In the beginning it only takes 2 ms per key. But after a while it increases. And the last one takes 35ms. How can I decrease these times? How can I make it faster/more efficient?
JSONArray arrAll = new JSONArray();
JSONObject jsonObject = new JSONObject();
JSONArray arr = new JSONArray();
JSONObject values = new JSONObject();
List<Contentlet> contentlets = languageFactory.getAllContentlets(null);
List<Contentlet> keys = languageAPI.getLanguageKeys(null, contentlets);
for(Contentlet key : keys) {
Long startTime = System.currentTimeMillis();
jsonObject = new JSONObject();
HashMap<Long, String> allValues = languageAPI.getAllValuesByKey(key.getStringProperty("key"), contentlets);
Iterator<java.util.Map.Entry<Long, String>> it = allValues.entrySet().iterator();
arr = new JSONArray();
while (it.hasNext()) {
values = new JSONObject();
java.util.Map.Entry<Long, String> pairs = it.next();
values.put("l", pairs.getKey());
values.put("v", pairs.getValue());
arr.add(values);
it.remove(); // avoids a ConcurrentModificationException
} | {
"domain": "codereview.stackexchange",
"id": 6267,
"lm_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, iterator",
"url": null
} |
forces, si-units, units
I guess I'd be able to conceive the problem more accurately if I rephrased like this: what would the threshold maximum structural integrity of an object need to be in order to still be completely crushed between two surfaces, not counting their own material properties?
That would be kinetic energy on the projectile side and the integral of the stress-strain curve on the side of the crushed object side. Imagine you have a rock flying toward a hard place, and in the middle is an object that may or may not get crushed. What matters is the stress strain curve.
The object will be conceptualized as a rod as above. The integral is illustrated here.
So the rod has some area that the projectile hits. The following determines if it is crushed.
$$\frac{1}{2} m v^2 < A \int_0^{\epsilon_y} \sigma(\epsilon) d\epsilon$$
If this is met it won't be crushed. | {
"domain": "physics.stackexchange",
"id": 1459,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "forces, si-units, units",
"url": null
} |
Now we show that the three properties in Diagram 3 are equivalent.
Theorem 5
Let $X$ be a normal space. Then the following implications hold.
$\omega$-shrinking $\Longrightarrow$ Property $\mathcal{B}(\omega)$ $\Longrightarrow$ Property $\mathcal{D}(\omega)$ $\Longrightarrow$ $\omega$-shrinking
Proof of Theorem 5
$\omega$-shrinking $\Longrightarrow$ Property $\mathcal{B}(\omega)$
Suppose that $X$ is $\omega$-shrinking. By Dowker’s theorem, $X \times (\omega+1)$ is a normal space. We can think of $\omega+1$ as a convergent sequence with $\omega$ as the limit point. Let $\left\{U_n:n=0,1,2,\cdots \right\}$ be an increasing open cover of $X$. Define $H$ and $K$ as follows:
$H=\cup \left\{(X-U_n) \times \left\{n \right\}: n=0,1,2,\cdots \right\}$
$K=X \times \left\{\omega \right\}$
It is straightforward to verify that $H$ and $K$ are disjoint closed subsets of $X \times (\omega+1)$. By normality, let $V$ and $W$ be disjoint open subsets of $X \times (\omega+1)$ such that $H \subset W$ and $K \subset V$. For each integer $n=0,1,2,\cdots$, define $V_n$ as follows:
$V_n=\left\{x \in X: \exists \ \text{open } O \subset X \text{ such that } x \in O \text{ and } O \times [n, \omega] \subset V \right\}$ | {
"domain": "wordpress.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9799765557865637,
"lm_q1q2_score": 0.8057260766037354,
"lm_q2_score": 0.822189134878876,
"openwebmath_perplexity": 320.3856639252461,
"openwebmath_score": 0.9999508857727051,
"tags": null,
"url": "https://dantopology.wordpress.com/tag/product-space/"
} |
ros
/usr/include/boost/function/function_template.hpp:1069:16: required from ‘boost::function<R(T0, T1, T2, T3, T4, T5, T6, T7, T8)>::function(Functor, typename boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value, int>::type) [with Functor = boost::_bi::bind_t<boost::_bi::unspecified, boost::_bi::bind_t<void, boost::_mfi::mf2<void, StereoGrabber, const boost::shared_ptr<const sensor_msgs::Image_<std::allocator<void> > >&, const boost::shared_ptr<const sensor_msgs::Image_<std::allocator<void> > >&>, boost::_bi::list3<boost::_bi::value<StereoGrabber (*)()>, boost::arg<1>, boost::arg<2> > >, boost::_bi::list9<boost::arg<1>, boost::arg<2>, boost::arg<3>, boost::arg<4>, boost::arg<5>, boost::arg<6>, boost::arg<7>, boost::arg<8>, boost::arg<9> > >; R = void; T0 = const boost::shared_ptr<const sensor_msgs::Image_<std::allocator<void> > >&; T1 = const boost::shared_ptr<const sensor_msgs::Image_<std::allocator<void> > >&; T2 = const boost::shared_ptr<const message_filters::NullType>&; T3 = const | {
"domain": "robotics.stackexchange",
"id": 28895,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros",
"url": null
} |
c++, c++17
template<typename F, typename M, std::size_t... I>
void writeMembers(F& files, M& member, T const& data, std::index_sequence<I...> const&);
private:
using Traits = ThorsAnvil::Serialize::Traits<T>;
using Members = typename Traits::Members;
using Index = std::make_index_sequence<std::tuple_size<Members>::value>;
void doOpen();
void doClose();
template<std::size_t... I>
void doCloseMembers(std::index_sequence<I...> const&);
template<std::size_t... I>
void doOpenMembers(std::index_sequence<I...> const&);
};
}
}
}
#endif
File.tpp
#ifndef THORSANVIL_FS_COLUMNFORMAT_FILE_TPP
#define THORSANVIL_FS_COLUMNFORMAT_FILE_TPP
#include "file.h"
#include <sys/stat.h>
#include <sys/types.h>
#include <string_view>
#include <iostream>
namespace ThorsAnvil
{
namespace FS
{
namespace ColumnFormat
{
template<typename T>
File<T>::File(std::string&& fileName)
: fileOpened(false)
, baseFileName(std::move(fileName))
{
open();
}
template<typename T>
File<T>::File(std::string const& fileName)
: fileOpened(false)
, baseFileName(std::move(fileName))
{
open();
}
template<typename T>
File<T>::~File()
{}
template<typename T>
void File<T>::open(std::string const& fileName)
{
if (fileOpened) {
return;
}
baseFileName = fileName;
open();
} | {
"domain": "codereview.stackexchange",
"id": 37907,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, c++17",
"url": null
} |
The answer by Wolfgang seemed to hold in my cases (simple advection-diffusion problems) as well, so I can confirm this. However, the "same amount of work" is not exactly true. There are other differences that we need take into account for a true time to error comparison.
• The number of quadrature points might be different. In my case, the tri quadrature had 1 point while the quad one had 4 points. That makes twice less quadrature nodes in the assembly procedure for the tri based FEM. However, this depends on the problem at hand.
• The number of non zero entries in the resulting matrix is different for the two approaches. For a cartesian-like mesh with triangles, a internal degree of freedom typically couples with 6 others, while with quad base, it does so with 8 others. That makes the assembly more expensive and might also affect the linear solver depending on which one is used.
• The linear system for the quad-based FEM was (suprisingly?) easier for the iterative solver than the tri-based (less iterations for a given tolerance). I used an ILUT-preconditioned Krylov-based solver (can't remember which one exactly). I don't know if this is general or specific to the problem, but that is what I saw.
In the end, I still found that quad-based FEM was faster for the time-to-error comparison, but the factor was definitly less than 10, around 3 if I remember correctly (This number of course depends on the specific implementations and problems).
Another point for the quad-based FEM is that it is WAY easier to implement if you want to consider high order or "high" dimensional (>2) FEM.
Hope this is useful! | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9748211590308922,
"lm_q1q2_score": 0.8123424498685958,
"lm_q2_score": 0.8333245973817158,
"openwebmath_perplexity": 532.0237933620897,
"openwebmath_score": 0.7486400008201599,
"tags": null,
"url": "https://scicomp.stackexchange.com/questions/19108/how-do-hexahedral-fem-meshes-improve-approximation-quality-per-degree-of-freedom/19194"
} |
general-relativity, differential-geometry, metric-tensor, differentiation
Title: Is the vanishing of the covariant derivative of the metric necessary? Does the covariant derivative of the metric metric always vanish?
I.e. $$\nabla_a g_{bc}=0$$
Are there situations where this can be assumed to not hold? For instance in case of an asymmetric metric? Asymmetric metrics don't particularily make sense, because a metric exists for distance calculation as $ds^2=g_{\mu\nu}dx^\mu dx^\nu$, which is a symmetric expression, thus if we had instead of $g$ a tensor $h_{\mu\nu}=g_{\mu\nu}+a_{\mu\nu}$ with $g$ being symmetric and $a$ being antisymmetric, then the antisymmetric part would just cancel.
Are there situations where this can be assumed to not hold?
Yes. A linear connection ($\nabla$) is technically a distinct, unrelated object to a metric tensor $g$. If a linear connection satisfies $\nabla_\sigma g_{\mu\nu}=0$, then we say that $\nabla$ is metric compatible.
The fundamental theorem of Riemannian geometry says that a metric compatible symmetric connection is unique, and is given by $$ \Gamma^\sigma_{\mu\nu}=\frac{1}{2}g^{\sigma\lambda}(\partial_\mu g_{\nu\lambda}+\partial_\nu g_{\mu\lambda}-\partial_\lambda g_{\mu\nu}). $$
So that we use this unique connection, it is a choice on our part. Why do we make this choice? | {
"domain": "physics.stackexchange",
"id": 41095,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "general-relativity, differential-geometry, metric-tensor, differentiation",
"url": null
} |
quantum-mechanics, hilbert-space, operators, complex-numbers, observables
Title: Purpose of Hermitian adjoints? During a QM lecture, we went over Hermitian adjoints. While I understand that it is the Hermitian conjugate of an operator, I do not understand what this represents, besides its definition. Also, I do not understand the motivation behind taking the adjoint of an operator.
What exactly does an adjoint of an operator describe and how is the adjoint of an operator useful in quantum mechanics? From the spectral theorem an adjoint operator has only real eingenvalues. Now, after you give a measure of your system, from the postulate of wave function collapse, you measure only the eingevalues of your operator. Since a measure is real number you need the adjoint property to ensure that the eingevalues are reals.
Obsviusly there are operators with reals eingevalues which are non hermitian, instead the requirment that your observables must be hermitian operators is a postulate of quantum mechanics. | {
"domain": "physics.stackexchange",
"id": 91171,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, hilbert-space, operators, complex-numbers, observables",
"url": null
} |
Lower bounds:
I should have thought of this before -- we can actually get some basic coupon-collector-type lower bounds for both questions. I'm not really optimizing for good constants below.
Lemma: Suppose we have two disjoint sets $$A, B \subset \{1, \dots, n\}$$ with $$|A|, |B| \geq k$$. At each time step we choose a uniformly random element of $$\{1, \dots, n\}$$. Then the expected time until either all elements of $$A$$ have been chosen at least once or all elements of $$B$$ have been chosen at least once is at least $$(n/2) \log k$$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9857180643966651,
"lm_q1q2_score": 0.8126870121108964,
"lm_q2_score": 0.8244619242200082,
"openwebmath_perplexity": 154.65557254263976,
"openwebmath_score": 0.9931278228759766,
"tags": null,
"url": "https://math.stackexchange.com/questions/3479464/expected-time-to-convergence/3483509"
} |
physiology
So, now the question is shifted: why do kisspeptin neurons show up only at puberty? We don't know for sure, but it looks like increased levels of E2 could be important for this.
Again, we get into a self-sustaining cycle. Growth of the body generates an increase in E2 production (possibly due to increased volume of the gonads?), which, when over a certain level permits the development of kisspeptin neurons, which will then stimulate the GnRH neurons, resulting in increased LH and E2. We then have more E2 and this makes kisspeptin neuron grow even more etc etc. | {
"domain": "biology.stackexchange",
"id": 949,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "physiology",
"url": null
} |
quantum-mechanics, quantum-information
Title: Could a non-unitary time evolution violate the no-cloning theorem? It is written in some places that the unitarity of time evolution is what prevents quantum cloning. However, consider the typical definition of a cloning operator $A$. For all $\left|\psi\right>$ and a standard state $\left|0\right>$,
$$
A[\left|\psi\right>\otimes \left|0\right>] = \left|\psi\right>\otimes \left|\psi\right>
$$
Without using the unitarity of $A$, I can follow the proof in these notes to demonstrate no-cloning. With a superposition state $\left|\chi\right> = a\left|\psi\right>+b\left|\phi\right>$, $A$ can be appled to find,
$$
A[\left|\chi\right>\otimes \left|0\right>] = a(\left|\psi\right>\otimes \left|\psi\right>)+b(\left|\phi\right>\otimes\left|\phi\right>)
$$
$A$ could also be applied to find,
$$
A[\left|\chi\right>\otimes \left|0\right>] =\left|\chi\right>\otimes\left|\chi\right> = (a\left|\psi\right>+b\left|\phi\right>)\otimes(a\left|\psi\right>+b\left|\phi\right>)
$$
These expressions are not equal, so there is a contradiction. This appears to be a proof that no-cloning is impossible for any linear time evolution, even in an alternate universe where quantum time evolution does not have to be unitary. Is this reasoning correct? In fact, this is one of the two popular kinds of proofs by contradiction of the no-cloning theorem which claims the nonexistence of quantum operation that can duplicate arbitrary unknown quantum state. It may be helpful to clearly give two kinds of proofs here: | {
"domain": "physics.stackexchange",
"id": 56066,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, quantum-information",
"url": null
} |
ros, ros2
Title: Where should questions about index.ros.org be posted?
The Github repository has disabled the Issues tab.
Should ROS Discourse be used instead?
Or here, on ROS Answers?
Originally posted by gvdhoorn on ROS Answers with karma: 86574 on 2020-03-29
Post score: 1
As always questions should be asked here on answers.ros.org
The repository you have linked to contains 100% auto-generated content. If you want to make a bug report (about the structure or generation and not content) or feature request of the site it can be filed on rosindex
Any content specific issues should be filed with the package from which the data is aggregated.
Originally posted by tfoote with karma: 58457 on 2020-03-30
This answer was ACCEPTED on the original site
Post score: 0
Original comments
Comment by gvdhoorn on 2020-03-30:
I only now found this page, which includes a link to github/ros-infrastructure/rosindex. It's a bit hidden, and there is a much more prominent link at the bottom left of each page with a Github icon and a ros-infrastructure label. That's how I arrived at github/ros-infrastructure/index.ros.org. | {
"domain": "robotics.stackexchange",
"id": 34659,
"lm_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",
"url": null
} |
filter-design
This is indeed a 2-pole, second order filter, infinite impulse response (IIR) filter. The specifics of its filtering characteristics will be dependent on the other input paramaters. | {
"domain": "dsp.stackexchange",
"id": 10856,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "filter-design",
"url": null
} |
is the 75 th percentile. Mar 17, 2016: R, Statistics A probability distribution is a way to represent the possible values and the respective probabilities of a random variable. Frequently, it is necessary to calculate the probability (density) function of a function of two random variables, given the joint probability (density) function. We discuss methods for calculating multivariate normal probabilities by simulation and two new Stata programs for this purpose: mdraws for deriving draws from the standard uniform density using either Halton or pseudorandom sequences, and an egen function, mvnp(), for calculating the probabilities them- selves. Probability Density Function Calculator - Uniform Distribution - Define the Uniform variable by setting the limits a and b in the fields below. This is the most important example of a continuous random variable, because of something called the. 041SC Probabilistic Systems Analysis and Applied Probability, Fall 2013 View the complete course: http://ocw. Random is a website devoted to probability, mathematical statistics, and stochastic processes, and is intended for teachers and students of these subjects. Toggle between the probability density function and the cumulative distribution function of the distribution; Modify your graph in order calculate a cumulative probability (e. Sample problem: Calculate a cumulative probability function for a beta distribution in Excel at 0. Because probability is given by area, it is not hard to compute probabilities based on a uniform distribution:. The probability density function of the normal distribution, first derived by De Moivre and 200 years later by both Gauss and Laplace independently , is often called the bell curve because of its characteristic shape (see the example below). 3: Expected Value and Variance If X is a random variable with corresponding probability density function f(x), then we define the expected value of X to be. Define the random variable and the value of 'x'. Battleship Probability Calculator. 2: a function of a continuous random variable whose integral over an interval gives the probability that its value will fall within the interval. o Distinguish between discrete and continuous distributions. August 2010 16:30 An: [email protected] Notice: Undefined index: HTTP_REFERER in /home/forge/theedmon. The inputs are Binompdf(number of trials, probability of success, x) Example: n=14, p=0. Multiple Event Probability | {
"domain": "safoo.de",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9835969708496457,
"lm_q1q2_score": 0.8280171507653216,
"lm_q2_score": 0.8418256412990658,
"openwebmath_perplexity": 326.11147646681223,
"openwebmath_score": 0.8616211414337158,
"tags": null,
"url": "http://zoqi.safoo.de/probability-density-function-calculator.html"
} |
ros
Originally posted by gvdhoorn with karma: 86574 on 2017-03-02
This answer was ACCEPTED on the original site
Post score: 0
Original comments
Comment by user_123 on 2017-03-02:
After removing sensor_msgs::LaserScan::ConstPtr I am getting a new set of error edited in the question. Please check and help me.
Comment by gvdhoorn on 2017-03-02:
You'll need to make sure you're passing the correct variables to the functions that you're calling. This is not ROS-specific, but basic C++. Unfortunately I won't have the time to debug your code with you. | {
"domain": "robotics.stackexchange",
"id": 27181,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros",
"url": null
} |
statistical-mechanics, ideal-gas
$n^*$ is in the range $n^* – 0.02 N ≤ n^* ≤ n^* + 0.02 N$ Some notes I had easily at hand may help. You have already calculated the probability of obtaining the chance with a number $k$ of type of ball (or molecule) out of a total on $n$ is
$$\displaystyle p=\frac{n!}{k!(n-k)!}\frac{1}{2^n} \tag{25c}$$
This distribution is a maximum when $k=n/2$. This can be seen with a straightforward argument. The factorial terms are symmetric, $k!(n-k)!=(n-k)!k!$ and always positive. When $k=0$ or $k=n$ the probability is very small tending to zero; i.e $1/2^n$ is small so there must be a maximum somewhere in the range $0\to n$. The symmetric nature ensures that this will be at $k = n/2$. This can also be determined by differentiation. It is not possible to differentiate a factorial, as $n$ is discrete, but replacing $n!$ with the Sterling approximation $(n!=n^ne^n)$ and setting the derivative in $n$ to zero allows the maximum to be found.
The second feature of this probability distribution is that it becomes extremely narrow as $n$ increases. This is shown in the figure which shows the normalised probability $p/p_{max}$ vs $k/n$ which is a fraction between $0$ to $1$. At large $n$ the distribution becomes so narrow, or peaked at $n/2$, that almost all the probability is described by that at $n/2$, i.e. this value is so great compared to others that $p_{max}$ is in effect greater than all others combined. | {
"domain": "chemistry.stackexchange",
"id": 15458,
"lm_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, ideal-gas",
"url": null
} |
catkin-make, catkin, ros-kinetic
Any thoughts on what may be causing this? I get the same error if I try to run catkin_make after following the emanual robotics instructions as well.
Originally posted by nickapril on ROS Answers with karma: 3 on 2018-01-18
Post score: 0
I have encountered a similar problem with the same error output:
error: ‘const struct turtlebot3_msgs::SensorState_<std::allocator<void>’ has no member named ‘torque’ if (msg->torque == true) ^
Explaination:
There is no current message that has the format turtlebot3_msgs::SensorState which can be found in your catkin_ws workspace.
Steps To Rectify:
1. Follow the steps after where you left off at step 5.2.1 (Here's the link again.Click Here)
2. Under 6.3 Install Independent Packages, ensure that you are in your catkin_ws/src and run the following command according to the emanual.
$ git clone https://github.com/ROBOTIS-GIT/turtlebot3_msgs.git
This is where the turtlebot3_msgs::SensorState message is located.
3. Return back to the root of your catkin_ws by running $ cd ~/catkin_ws
4. run $ source devel/setup.bash
5. run $ catkin_make
It worked for me. Hopes it works for you as well.
Originally posted by cardboardros with karma: 26 on 2018-03-02
This answer was ACCEPTED on the original site
Post score: 1 | {
"domain": "robotics.stackexchange",
"id": 29784,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "catkin-make, catkin, ros-kinetic",
"url": null
} |
classification, rnn, word-embeddings
Title: How to improve the binary classification model for text (News Articles) of Recurrent Neural Net with word emmbeding? I am trying to do binary classification of news articles using Recurrent Neural Net with word embedding. Following are the parameters of the model:
Data:
8000 labelled news articles (Sports:Non-sports::15:85)
Parameters:
embedding size = 128
vocabulary size = 100000
No. of LSTM cell in each layer = 128
No. of hidden layers = 2
batch size = 16
epochs = 10000
Result:
AUC on training set = 0.60
AUC on testing set = 0.55
As the both training and testing error is high model is underfitting and require more data. So I have couple of doubts here: | {
"domain": "datascience.stackexchange",
"id": 2598,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "classification, rnn, word-embeddings",
"url": null
} |
atmospheric-science, climate-science
$$F_{CO2} = \int_0^{\infty} \beta \Phi (1 - e^{-\tau(\lambda)}) d\lambda$$
$$(1 - e^{-\tau(\lambda)}) \approx \begin{cases}
0, & \mbox{if } \tau(\lambda) < 2.3 \\
1, & \mbox{if } \tau(\lambda) \ge 2.3
\end{cases}$$
$$F_{CO2} = \beta \Phi \left( \lambda_2 - \lambda_1 \right) $$
If you just gawked or gagged at that... all I can say is don't shoot the messenger. In fact, we don't even really need that $\beta$ there for the purposes of this question. Anyway, I hope it's clear where we're going, and at this point I will assign $\lambda_1$ and $\lambda_2$ to be pre-industrial values. The physical effect humans have had on the greenhouse effect, by this model, is to broaden the range of wavelengths that CO2 in the atmosphere absorbs. To put this into math, I will say that $\lambda_1'$ and $\lambda_2'$ are the corresponding post-industrial values. Also, I will use $C$ as post-industrial concentration, $C_0$ as pre-industrial, $\tau$ and $\tau'$, and $F$ and $F'$ respectively.
$$\Delta F = F_{CO2}'-F_{CO2} = \beta \Phi \left( (\lambda_2' - \lambda_2) + (\lambda_1 - \lambda_1') \right)= \beta \Phi \left( \Delta \lambda_2 + \Delta \lambda_1 \right)$$ | {
"domain": "physics.stackexchange",
"id": 1716,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "atmospheric-science, climate-science",
"url": null
} |
quantum-mechanics, photons, quantization, telescopes, noise
Title: Number of photons required for communication On one hand, the amount of information I can transmit is proportional to the bandwidth. The higher the frequency, the more information I can transmit. On the other hand, the number of photons is reverse proportional to the frequency. I cannot possibly transmit more information than the number of photons I send. Therefore, it appears, that at low intensity levels, a higher frequency signal may contain less information than a lower frequency signal.
For example, consider a camera sensor in a high amplification mode (known in digital photography as "high ISO"). Provided the light intensity is uniform by color, blue sensor pixels would receive fewer photons than red pixels. The photon noise in modern sensors is one of the main quality limitations. Thus, in low light conditions, blue images would be grainier than red images meaning that the amount of the transmitted information is reverse proportional to the frequency.
Considering these two competing trends, an optimum must exist.
Is there a known formula or estimate for the optimal frequency to transmit the highest amount of information for a given received power? Or, stating this in reverse, is there a formula for the minimum received power required to avoid the photon quantization noise at a given frequency? The optimal distribution of photon frequencies for sending messages, assuming no noise but quantum shot noise, is indistinguishable from thermal (blackbody) radiation at a given temperature. So find the temperature for thermal radiation corresponding to your desired power, find its entropy, convert that to bits, and you have the theoretical maximum amount of information for a given power.
Why is this true? I'll give a brief sketch of a proof. The Holevo formula for the quantum information that can be sent over a quantum channel ${\cal N}$ at a given power is
$$
\max_{\{ p_i, |\psi_i\rangle \langle \psi_i | \}} S\left({\cal N}\left({\sum_i p_i |\psi_i\rangle \langle \psi_i|}\right)\right) - \sum_i p_i S\left(\cal N( | \psi_i \rangle \langle \psi_i | )\right), $$ | {
"domain": "physics.stackexchange",
"id": 43438,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, photons, quantization, telescopes, noise",
"url": null
} |
stereochemistry, carbohydrates
If you want to make models, at your next wine and cheese party get some toothpicks, and two pieces each of four different kinds of cheese. Put four of the cheese chunks on the end of the toothpicks, and then stick the tooth picks in a sausage or something. Then make an exact copy. After that is done, exchange two of the cheese chunks on one model and investigate what you have. There should be no way you can twist or turn or rotate one model to have its kinds of cheeses in the same orientation as the other. Once you have done this, the following picture will make much more sense: | {
"domain": "chemistry.stackexchange",
"id": 6244,
"lm_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, carbohydrates",
"url": null
} |
ros, service, rosjava, android
Title: unresolved address when instantiating a service client on rosjava android
Hi,
I have roscore and turtlesim_node on an ubuntu running in virtualbox under windows10, and a rosjava android app. The android app is starting correctly, finding the master. I can see the ros graph correctly from the linux computer.
Then I have added in the rosjava-android node the creation of a serviceclient to change the request the turtlesim_node to change the position of the turtle by invoking the service /turtle1/teleport_absolute. On the linux computer, the roscore and the turtlesim_node are running up.
In my android node, the code is like this:
...
public void onStart(final ConnectedNode connectedNode) {
try {
Log.d("BLAH", "ServiceCLient... creating serviceclient!");
serviceClient = connectedNode.newServiceClient("/turtle1/teleport_absolute", TeleportAbsolute._TYPE);
Thread.sleep(100);
Log.d("BLAH", "ServiceCLient CREATED!"); // this is never reached
} catch (ServiceNotFoundException e) {
Log.d("BLAH", "ServiceCLient FAILED!"); // the exception thrown is not of this kind...
throw new RosRuntimeException(e);
}
catch (Exception ex){
Log.d("BLAH", "ServiceCLient Definitively FAILED!"); // so this will catch the exception to avoid crashing the app
}
... | {
"domain": "robotics.stackexchange",
"id": 25654,
"lm_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, service, rosjava, android",
"url": null
} |
We see that the last digits form a 4-step cycle: . $7, 9, 3, 1$
We find that: . $7^7 \:=\:823,543 \:=\:4(205,885) + 3$
Therefore, the last digit of $7^{7^7}$ is the same as $7^3$: .3
Thanks for this answer, the only thing is how do I get the deduction that $7^{7^7}$ is the same as $7^3$?
7. ## Re: The last digit of 7^7^7
Really? We've done this twice!
The last digit ("last digit" means mod 10) of powers of 7:
7
9
3
1
7
9
3
1
.
.
.
7^3 has last digit 3
7^7 has last digit 3
7^11
7^15
7^19
.
.
.
7^10000000000000000000000000000000003 will also have last digit equal to three, since the exponent is congruent to 3 (mod4).
8. ## Re: The last digit of 7^7^7
This problem is not hard.
We see $7 \equiv -1 \pmod{4} \Rightarrow 7^7 \equiv -1 \pmod{4}$.
Then let $7^7=4k+3$.
So $7^{7^7}=7^{4k+3}=(7^4)^k.7^3$.
From here it is easy to find next.
,
,
,
,
,
,
,
,
,
,
,
,
,
,
# find last two digits of 7^7^7
Click on a term to search for related topics. | {
"domain": "mathhelpforum.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9863631627142339,
"lm_q1q2_score": 0.8017823784893052,
"lm_q2_score": 0.8128673178375734,
"openwebmath_perplexity": 722.4561449452528,
"openwebmath_score": 0.9669803380966187,
"tags": null,
"url": "http://mathhelpforum.com/number-theory/190721-last-digit-7-7-7-a.html"
} |
# Alternate Solution to The Meeting Place Cannot Be Changed
Hi,
I would like to share an alternate solution to the Codeforces problem The Meeting Place Cannot Be Changed. My solution is in Java, but it can be translated to other languages. I enjoyed solving this problem.
This problem is in fact very similar to the LeetCode problem Peak Index in a Mountain Array.
The official solution does binary search on the minimum time needed for the friends to meet, but my solution does binary search on the optimal place to meet.
How do we do binary search if the positions are non-integers? We simply multiply each coordinate by 10^6, then find the optimal time for integer meeting points, then divide by 10^6. This will ensure that the difference between the meeting place returned and the actual meeting place is \leq 10^{-6}, and the difference between the minimum times is \leq 10^{-6}.
My solution relies on the two following key observations:
1. The minimum times to meet every spot on the line decreases, then increases as you sweep the line.
2. No three points contain the same minimum times.
The minimum time for each meeting place is the maximum times it takes for each friend to travel to that meeting place. We can compute the minimum time for an arbitrary meeting place in O(n) time.
Now, we can do binary search on the optimal meeting place while keeping track of the minimum time. For each meeting place \text{mid} we check, we find the minimum times for it and adjacent meeting places, and compute the total running minimum of all times. We break out of the search if \text{minTime(mid - 1)} > \text{minTime(mid)} < \text{minTime(mid + 1)}; otherwise, we use the information to narrow the bound of possible optimal meeting places.
Once we break out of the loop, we have the minimum meeting time and hence the answer.
My code below:
import java.io.*;
import java.util.*;
public class TheMeetingPlaceCannotBeChanged {
public static void main(String[] args) throws IOException { | {
"domain": "usaco.guide",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.975946451303227,
"lm_q1q2_score": 0.8788688562193429,
"lm_q2_score": 0.9005297934592089,
"openwebmath_perplexity": 3056.166070352444,
"openwebmath_score": 0.3240807056427002,
"tags": null,
"url": "https://forum.usaco.guide/t/alternate-solution-to-the-meeting-place-cannot-be-changed/1020"
} |
vba, winapi
'Makes things go faster
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
'Save the provider file
strProvFileWebAddr = "http://example.webaddress.com/filename.zip"
strProvFileSaveLoc = "\\example\completepath.zip"
strProvFileUnzipped = "\\exmple\completepath.txt"
'You can also set a ref. to Microsoft XML, and Dim oXMLHTTP as MSXML2.XMLHTTP
Set oXMLHTTP = CreateObject("MSXML2.XMLHTTP")
oXMLHTTP.Open "GET", strProvFileWebAddr, False 'Open socket to get the website
oXMLHTTP.Send 'send request
'Wait for request to finish
Do While oXMLHTTP.readyState <> 4
DoEvents
Loop
oResp = oXMLHTTP.responseBody 'Returns the results as a byte array
'Create local file and save results to it
Int1 = FreeFile()
If Dir(strProvFileSaveLoc) <> "" Then Kill strProvFileSaveLoc
Open strProvFileSaveLoc For Binary As #Int1
Put #Int1, , oResp
Close #Int1
'Clear memory
Set oXMLHTTP = Nothing
'Unzip zipped provider file
Set Object1 = CreateObject("Shell.Application")
'Has to be variants, can't be strings
Variant1 = "\\sample\directory\"
Variant2 = strProvFileSaveLoc
Object1.Namespace(Variant1).CopyHere Object1.Namespace(Variant2).items
On Error Resume Next
Set Object2 = CreateObject("scripting.filesystemobject")
Object2.DeleteFolder Environ("Temp") & "\Temporary Directory*", True
On Error GoTo 0 | {
"domain": "codereview.stackexchange",
"id": 19625,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "vba, winapi",
"url": null
} |
meteorology, earth-observation, instrumentation
Title: What are these Gizmos at Mauna Loa Observatory? Artist Rosten Wu's Vimeo channel has a video title Bridging Time and there is discussion about the Keeling Curve and the site where it all began in Hawaii.
In the video there is a shot of a weather observation station (shown below), and I'm assuming this is Mauna Loa Observatory where these accurate and systematic measurements of CO2 began.
In the foreground there are several gizmos and I was wondering if someone can identify them.
I've included a cropped section, sharpened it a bit, and added annotations A, B, C below the three types of instruments that caught my eye. I am going to take a guess here because I have not used these instruments in real life but given the content of this Mauna Loa Observatory I Exploratorium video - fast forward the video to 3:43 and see the yankee name on that instrument.
Then I did a google search on that and got this link - Yankee list of products
So A is a Pyranometer and B is a Ultraviolet Multifilter Rotating Shadowband Radiometer. I am not too sure on C and it probably is a actinometer. You can take a look of that here - Actinometer
The respective data sheets give information on both of those products.
1) Ultraviolet pyranometer
As this AMS glossary definition mentions a pyranometer measures both direct solar radiation(radiation that has not been scattered or absorbed) as well as diffuse sky radiation(radiation that is scattered)
Specifically this ultraviolet pyranometer measures both UV-B and UV-A rays.
This link covers the difference btween UV-B and UV-A rays. Specifically UV-A rays penetrate deeper into the skin than UV-B rays.
2) Ultraviolet Multi-Filter Rotating Shadowband Radiometer
This one measures the diffuse and total global irradiance and computes direct irradiance at four or seven narrow bandwidth wavelengths(hence the term multi filter). One can see real time data for sites across the US at this site - UV-B monitoring | {
"domain": "earthscience.stackexchange",
"id": 1704,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "meteorology, earth-observation, instrumentation",
"url": null
} |
beginner, kotlin
for (i in 0 until text.length) {
var c = text[i].toLowerCase()
if (invalid.contains(c))
continue
for (j in i+1 until text.length) {
if (c == text[j].toLowerCase()) {
invalid.add(c)
break
}
}
}
return invalid.size;
} | {
"domain": "codereview.stackexchange",
"id": 37584,
"lm_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, kotlin",
"url": null
} |
# Convergents as solutions for Pell's equation
We know that convergents of $\sqrt 2$ offer solutions for Pell's equation of the format ${x^2} - 2{y^2} = 1$. I wonder how rational approximations of an irrational number become integer solutions for the above equation?
Also why only some convergents are integer solutions and why some or not? For example, $\boxed{\frac{3}{2}},\dfrac{7}{5}$, $\boxed{\frac{17}{12}},\dfrac{41}{29}$, . . . only some of the above are solutions and some are not. Is there any rule that governs which convergents become solutions? Can any one throw some light?
• Oct 1 '16 at 15:13
• the others give $x^2 - 2 y^2 = -1.$ Oct 1 '16 at 17:11
Here’s a statement of results, completely without proof:
If you calculate the continued fraction for $\sqrt n$, where $m^2<n<(m+1)^2$, you’ll find that it takes the form $m+\frac1{a_1+}\frac1{a_2+}\cdots\frac1{a_2+}\frac1{a_1+}\frac1{2m+}\cdots$, and the whole symmetric sequence repeats infinitely after that.
It happens too that all the $a_i$ are in the range $1\le a_i\le m$, and in fact $a_i=m$ happens (if it does at all) only in the very middle of the sequence of $a_i$’s. At any rate, your solutions of the Pell Equation $X^2-nY^2=\pm1$ come only from the convergents that you get by cutting off your continued fraction just before the appearance of the $2m$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9833429619433693,
"lm_q1q2_score": 0.8172986603102627,
"lm_q2_score": 0.8311430415844384,
"openwebmath_perplexity": 176.4966941889818,
"openwebmath_score": 0.773584246635437,
"tags": null,
"url": "https://math.stackexchange.com/questions/1949263/convergents-as-solutions-for-pells-equation"
} |
c++, file, c++17, serialization, file-structure
friend std::ostream& operator<<(std::ostream& out, const TAPBlock blk) {
out << "{ len = " << std::dec << blk.len << ", flag = " << (unsigned)blk.flag << ", {";
if (1 || blk.flag) {
int remaining{0};
for (auto n : blk.data) {
if (remaining == 0) {
remaining = 16;
out << "\n\t";
}
--remaining;
out << std::setw(2) << std::setfill('0') << std::hex << (unsigned)n << ' ';
}
out << "\n}, ";
} else {
}
return out << "cksum = " << std::dec << (unsigned)blk.cksum
<< ", calcsum = " << std::dec << (unsigned)blk.calcsum() << " }";
}
};
int main(int argc, char *argv[])
{
if (argc != 2) {
std::cout << "Usage: dumptap tapfilename\n";
return 1;
}
TAPBlock blk;
std::ifstream in{argv[1]};
while (blk.read(in)) {
std::cout << blk << '\n';
if (auto hdr = blk.get_header()) {
std::cout << *hdr << '\n';
}
}
}
Although it makes the code a bit longer, I think I'd start by writing a little "buffer" class, on this general order:
class buffer {
std::vector<uint8_t> &data;
std::vector<uint8_t>::iterator pos;
public:
buffer(std::vector<uint8_t> &data)
: data(data)
, pos(data.cbegin())
{} | {
"domain": "codereview.stackexchange",
"id": 40189,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, file, c++17, serialization, file-structure",
"url": null
} |
c++, c++11
if (minLength > MIN_LENGTH)
{
minLen = minLength;
maxLen = minLength * (1 + MAX_LENGTH_OFFSET);
}
if (lower)
{
usage = (Options)(usage | LOWER);
numOptions++;
}
if (upper)
{
usage = (Options)(usage | UPPER);
numOptions++;
}
if (digit)
{
usage = (Options)(usage | DIGIT);
numOptions++;
}
if (punct)
{
usage = (Options)(usage | PUNCTUATION);
numOptions++;
}
}
PasswordGenerator::PasswordGenerator()
{
CalcMaxRange();
usage = (Options)(UPPER | LOWER | DIGIT | PUNCTUATION);
numOptions = 4;
}
PasswordGenerator::~PasswordGenerator()
{
}
string PasswordGenerator::Generate()
{
int subLimit = ceil(maxLen / numOptions);
AddRange(subLimit);
random_device rd;
mt19937_64 mt64{ rd() };
uniform_int_distribution<int> dist(0, maxRange);
auto rnd = bind(dist, mt64);
stringstream ss;
size_t stringsSize = stringsSets.size();
int start = rnd() % stringsSize;
size_t limit = stringsSize + start;
for (int i = start; i < limit; i++)
{
Options tempOption = (Options)(int)pow(2, i % stringsSize);
bool allowed = usage & tempOption;
if (allowed)
{
string* temp = &stringsSets[i % stringsSize];
ss << MakeSubstring(temp, rnd() % subLimit, dist, mt64);
}
}
size_t currSize = ss.str().size();
if (currSize < minLen)
{
size_t limitTemp = (maxLen - currSize) + (rnd() % (int)(maxLen - minLen)); | {
"domain": "codereview.stackexchange",
"id": 28610,
"lm_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",
"url": null
} |
perl
Title: Running Bionano´s HybridScaffolding from the command line [Error: align0.stdout] as the title says I´m trying to run Bionanos HybridScaffolding from the command line rather than using their own software interface. This is commercial software to primarily to identify genomewide cancer analysis but also has options for genome assembly.
I installed Perl and all the necessary packages to run the HybridScaffolding Perl script. According to their documentation I started the script with the correct parameters.
After 2 minutes it stops giving me the following error:
Beginning initial NGS CMAP to BioNano CMAP alignment...
Running command: /home/user/workflow/scripts/bionano/tools/pipeline/1.0/RefAligner/1.0/RefAligner
-ref /home/user/results/bionano/fa2cmap/pac_bio_assembly_CTTAAG_0kb_0labels.cmap
-i /home/user/data/bionano/bCalAnn1_Saphyr_DLE1.cmap.gz
-o align0 -stdout -stderr -maxmem 128 -maxthreads 64
-maxvirtmem 0 -maxmemIncrease 8 -RAmem 3 1 0.9 -M 1 3 -ScaleDelta 0.03 2 -ScaleDeltaBPP
-hashScaleDelta 2 -res 2.6 -resSD 0.7 -FP 0.2 -FN 0.02 -sf 0.10 -sd 0.0 -sr 0.01 -se
0.2 -extend 1 -outlier 0.0001 -endoutlier 0.001 -PVendoutlier -deltaX 12 -deltaY 12
-xmapchim 12 -hashgen 5 11 2.4 1.4 0.05 3.0 1 1 1 -hash -hashdelta 27 -hashoffset 1
-hashrange 0 -hashGrouped 6 11 -hashMultiMatch 50 2 -hashGC 300 -hashT2 1 -hashkeys 1
-HSDrange 1.0 -insertThreads 4 -nosplit 2 -biaswt 0 -T 1e-10 -S -1000 -indel -PVres 2 | {
"domain": "bioinformatics.stackexchange",
"id": 2291,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "perl",
"url": null
} |
performance, beginner, c, programming-challenge, primes
,14843,14851,14867,14869,14879,14887,14891,14897,14923,14929,14939,14947,14951,14957,14969,14983,15013,15017,15031,15053,15061,15073,15077,15083,15091,15101,15107,15121,15131,15137,15139,15149,15161,15173,15187,15193,15199,15217,15227,15233,15241,15259,15263,15269,15271,15277,15287,15289,15299,15307,15313,15319,15329,15331,15349,15359,15361,15373,15377,15383,15391,15401,15413,15427,15439,15443,15451,15461,15467,15473,15493,15497,15511,15527,15541,15551,15559,15569,15581,15583,15601,15607,15619,1 | {
"domain": "codereview.stackexchange",
"id": 9003,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "performance, beginner, c, programming-challenge, primes",
"url": null
} |
frequency-spectrum
Title: Square wave function in FFT spectrum The input function is a 60Hz square wave. From Fourier Transform I know that the frequency on the spectrum is 60,180,300....(2k-1). But there's a series of 120,240,360...(2k) signals appear.
I've googled but all I found is Fourier Transform issues, not Fast Fourier Transform. I'm wondering why there are some 2k terms appearing on the spectrum.
Thanks! Looks like aliasing.
Your 360 Hz is probably not a real component at 360 Hz but it's the 9th harmonic (540 Hz) that aliases back to 360 Hz at a 900Hz sample rate.
That's easy to test: change the sample rate to, 940 Hz and see of the 360Hz moves to 400Hz or stays put. It moves to 400Hz, it's clearly aliasing. | {
"domain": "dsp.stackexchange",
"id": 7916,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "frequency-spectrum",
"url": null
} |
visible-light, temperature, radiation
Title: Can UV light make us invisible? For an object to create different EM waves, it needs to increase the temperature, so what if we or some material could be so hot, that it would emit ultraviolet light, and thanks to that be invisible for the human eye.
I have a lot of questions about this and I would like you to answer me.
At which temperature does an object emit UV light?
If an object emits UV light, we wouldn't see anything or we would see some type of violet light?
Is there any material that can get to that temperature without melting?
Is there any powerful insulator?
Thanks for reading this, and for breaking my dream of making someone invisible, I invite you to day-dream and imagine stupid questions. You're right that as the temperature increases, shorter wavelengths receive a higher proportion of thermally radiated power, and longer wavelengths a smaller proportion, because of the shifting Boltzmann distribution of your molecules' kinetic energy, and therefore the shifting power spectrum of the light they emit.
However, most of the objects you see around you are not visible because they're thermally radiating, they're visible because visible light from the sun or a lightbulb are reflecting off their surface.
For example, right now you are "glowing" mainly in the infrared spectrum. You are emitting almost no visible light due to thermal motion of your molecules, because you are too cold to emit an appreciable amount of visible light by that process. But even though you aren't thermally radiating visible light, you are still reflecting light from external sources, and thus are perfectly visible.
It's also worth pointing out that while as an object gets hotter, it does radiate a higher percentage of its thermal radiation in higher frequencies, and a lower percentage in lower frequencies, as an absolute measure, the amount of power in any given frequency band actually increases with temperature. You can see this visually in the power spectrum curves in this graph. If you pick any wavelength, the amount of power is greater in each successive temperature curve. That means that when you heat an object hot enough to radiate primarily in the UV, it will actually be brighter in the visible spectrum than at cooler temperatures. | {
"domain": "physics.stackexchange",
"id": 22680,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "visible-light, temperature, radiation",
"url": null
} |
Since according to a comment under the question $n$ is odd, we need to deal with the last component separately. All eigenvectors in the linked question except for the one filled with $1$s sum to $0$. Thus we can append a $0$ to them to obtain eigenvectors of the present matrix. That leaves a two-dimensional subspace to be dealt with, spanned by the vector $x$ that has a $1$ in the last component and the vector $y$ that has $1$s everywhere else. Applying $A$ to these vectors yields $Ax=ax+by$ and $Ay=(n-1)bx+((n-3)b+a)y$. Thus the product of the remaining two eigenvalues is
$$\left|\matrix{a&b\\(n-1)b&(n-3)b+a}\right|=((n-3)b+a)a-(n-1)b^2\;.$$
Multiplying this by the $n-2$ eigenvalues from the linked question, with the above substitutions and the factor $b^{n-2}$ that was divided out, yields the determinant of the present matrix:
\begin{align} \det A &= \left(((n-3)b+a)a-(n-1)b^2\right)b^{n-2}\left(\frac ab\right)^{(n-1)/2}\left(\frac ab-2\right)^{(n-3)/2} \\ &= \left(((n-3)b+a)a-(n-1)b^2\right)a^{(n-1)/2}\left(a-2b\right)^{(n-3)/2}\;. \end{align} | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9871787876194205,
"lm_q1q2_score": 0.8788795776412001,
"lm_q2_score": 0.8902942290328344,
"openwebmath_perplexity": 559.2811969776525,
"openwebmath_score": 0.9947680830955505,
"tags": null,
"url": "http://math.stackexchange.com/questions/384303/computing-determinant-of-this-matrix"
} |
c#
return order;
}
private DateTime? DetermineOrderDate(var item) {
DateTime? parsedOrderDate = null;
if (!string.IsNullOrWhiteSpace(item.Created_At)) {
parsedOrderDate = DateTime.ParseExact(
item.Created_At,
"yyyy-MM-dd HH:mm:ss,fff",
System.Globalization.CultureInfo.InvariantCulture
);
}
return parsedOrderDate;
}
2.
Error messages that give zero context of the problem are not very useful. This tells us something broke, but doesn't give any clues as to who experienced it or why it happened. Assuming this is going into a log file somewhere, try adding relevant info to the message.
string message = String.Format("Error fetching Uproduce 'Retailer': BaseRepository:Add");
...or...
string message = String.Format(
"Error fetching Uproduce 'Retailer': BaseRepository:Add for client {0}",
clientConfig.ClientName
);
3.
catch (Exception) This means, whatever breaks, hide the actual stack trace. Anywhere in this method. Say the DateTime.ParseExact breaks. You wouldn't be able to tell. I suggest grabbing the Exception object and passing it along to your ApplicationException.
try {
...
} catch (Exception ex) {
string message = String.Format(
"Error fetching client config: BaseRepository:Add: {0}",
ex.Message // or ex.StackTrace
);
throw new ApplicationException(message);
}
Commented out code gets forgotten easily. I presume you persist changes to the database context elsewhere, so why not remove the line //SaveChanges(); ?
5.
Normally I won't add any code for future work. If I absolutely have to, I'll add a TODO, to it to get picked up by Visual studio tasks.
if (order.Order_ID > 0)
{
//TODO: Do related table magic
} | {
"domain": "codereview.stackexchange",
"id": 23034,
"lm_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
} |
# Thread: [SOLVED] Finding the sum of two unknown variables
1. ## [SOLVED] Finding the sum of two unknown variables
Hello everyone,
Given that $43p + 23q = 4323$, find $p + q$?
The question is to find the sum of the unknown variables. Now, the variables have to be integers, and as you can see from the easy example I made, the sum could be $43(100) + 23(1)=4323$ $\Rightarrow p+q = 101$
Of course, this is not the only solution. Try the following:
$43(54) + 23(87) = 4323$
$\Longrightarrow p + q = 141$
I suspect that there are even more integer solutions to this equation. My method for finding the values is the old simple bruteforce "technique", where I divide 4323 by highest coefficient and that's where I get a headstart. You can of course find out the pattern, but these "cooked" equations are no good for learning.
My question is: is there a logical process of solving for $p + q$? Other than bruteforce, of course. I asked my teacher today, and he just said "that's number theory." I looked up number theory, but I was kind of lost.
These type of questions are pretty common on the SAT I tests, and I love them. My brother and I used to exchange multivariable equations like that and try to find the sum all the time.
2. Hello,
What comes in my mind is that we have to solve for p and q before finding p+q... maybe there is another method...
This comes with the Euclidian algorithm, which will yield to Bézout's theorem (google for them).
43 & 23 are coprime, that is to say they have no common divider.
The theorem states that if 43 and 23 are coprime, then we can write it :
$43u+23v=1$, where u & v are integers (positive or negative). | {
"domain": "mathhelpforum.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9808759638081522,
"lm_q1q2_score": 0.8573613440501088,
"lm_q2_score": 0.8740772286044095,
"openwebmath_perplexity": 510.93878208490395,
"openwebmath_score": 0.7997081279754639,
"tags": null,
"url": "http://mathhelpforum.com/algebra/42773-solved-finding-sum-two-unknown-variables.html"
} |
interpolation, equalization, lte, channel-estimation
Title: LTE PSS Channel Estimation for coarse SSS Equalization In LTE the Primary Synchronisation Signal (PSS) can be detected by taking a correlation with the known 3 zadoff chu sequences (roots: 25,29,34). Once the peak has been detected the receiver knows which sequence has been sent. The sequence is placed at the middle 63 subcarriers (DC with 0 in the middle). Assuming $x_{u}$ is the detected zadoff chu sequence with the root $u \in \{ 25,29,34\}$ (length of 63), the channel response can be calculated by: $$ h_{x_u}(f_i) = \frac{x^*_{u}(f_i) \cdot r_{x_{u}}(f_i)}{|x_{u}(f_i)|^2} = \frac{x^*_{u}(f_i) \cdot x_u(f_i) \cdot h_{x_u}(f_i)}{|x_{u}(f_i)|^2} $$
Where $r_{x_u}(f_i)$ is the received symbol at the $f_i$th subcarrier with the zadoff chu sequence $x_u(f_i)$ including the channel response $h_{x_u}(f_i)$:
$$
r_{x_u}(f_i) = x_u(f_i) \cdot h_{x_u}(f_i)
$$
With this it is possible to calculate a channel response for the middle 63 Subcarriers on every OFDM symbol which carries a PSS. Every 5 ms it is sent an OFDM Symbol which carries a PSS. So by using the block based channel estimation it might be possible to interpolate these PSS channel responses over time to get a $ h_{x_u}(f,t) $.
The Secondary Synchronisation Signal (SSS) is placed at the previous OFDM symbol of the PSS.
So the SSS could be equalized using the PSS channel estimation. | {
"domain": "dsp.stackexchange",
"id": 12338,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "interpolation, equalization, lte, channel-estimation",
"url": null
} |
java, beginner, sudoku
/* Updates the state of the grid. If the given value already exists
* as a part of the grid state, then it is removed otherwise it is
* added to the current state.
*/
private void updateGridStateWithValue(int value, Spot currentSpot) {
HashSet<Integer> valsInCurrentRow = valInRows.get(currentSpot.getRow());
HashSet<Integer> valsInCurrentCol = valInCols.get(currentSpot.getCol());
HashSet<Integer> valsInCurrentPart = valInParts.get(currentSpot.getPartForSpot());
if (valsInCurrentRow.contains(value))
valsInCurrentRow.remove(value);
else
valsInCurrentRow.add(value);
if (valsInCurrentCol.contains(value))
valsInCurrentCol.remove(value);
else
valsInCurrentCol.add(value);
if (valsInCurrentPart.contains(value))
valsInCurrentPart.remove(value);
else
valsInCurrentPart.add(value);
}
/* Helper method to compute the possible values for each empty spot and
* return the spots as an ArrayList sorted by the number of possible values
* from low to high.
*/
private ArrayList<Spot> getEmptySpotsList() {
ArrayList<Spot> result = new ArrayList<>();
for (int i = 0; i < SIZE; i++) {
for (int j = 0; j < SIZE; j++) {
Spot thisSpot = puzzleGrid[i][j];
if (thisSpot.isEmpty()) {
thisSpot.getPossibleValues();
result.add(thisSpot);
}
}
}
Collections.sort(result);
return result;
} | {
"domain": "codereview.stackexchange",
"id": 10966,
"lm_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, sudoku",
"url": null
} |
fourier-transform, dtft
Title: Difference between CTFT and DTFT? I have tried to read different articles but still confused in difference between continuous time Fourier transform and discrete time Fourier transform? The difference is pretty quickly explained: the CTFT is for continuous-time signals, i.e., for functions $x(t)$ with a continuous variable $t\in\mathbb{R}$, whereas the DTFT is for discrete-time signals, i.e., for sequences $x[n]$ with $n\in\mathbb{Z}$.
That's why the CTFT is defined by an integral and the DTFT is defined by a sum:
$$X(j\Omega)=\int_{-\infty}^{\infty}x(t)e^{-j\Omega t}dt\tag{1}$$
$$X(e^{j\omega})=\sum_{n=-\infty}^{\infty}x[n]e^{-j\omega n}\tag{2}$$
Note that in both cases, the frequency variables $\Omega$ and $\omega$ are continuous variables.
There is also the discrete Fourier transform (DFT), which can be applied to finite length (or periodic) sequences:
$$X[k]=\sum_{n=0}^{N-1}x[n]e^{-j2\pi kn/N}\tag{3}$$
It is easily shown that DTFT and DFT are related as:
$$ X\left(e^{j\omega}\right)\Bigg|_{\omega = 2 \pi\frac{k}{N}} = X[k] $$
when $x[n]=0$ for all $n<0$ or $n\ge N$.
Note that the DFT of the length $N$ sequence $x[n]$ is also a length $N$ sequence $X[k]$. The DFT is important because there exist efficient algorithms to compute $(3)$. This class of algorithms is called Fast Fourier Transform (FFT). | {
"domain": "dsp.stackexchange",
"id": 7499,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fourier-transform, dtft",
"url": null
} |
I have to design a laboratory activity to answer the question, "What is the relationship between the diameter of a circle and the area of the circle?" My teacher said to use a previous activity as a templete to help me. For the
6. ### Math
Two perpendicular diamters(cutting each other at right angles) of a circle cut the circumference at four(4) points. A square is formed by joining the 4 points. If the circumference of the circle is 132cm, find the area of the
7. ### Algebra
The Circumference and area of a circle of radius r are givin by 2 [pie] r and [pie] r[2], respectively use 3.14 for the constant [pie] A. What is the circumference of a circle with a radius of 2 m? B.What is the area of a circle
8. ### Geometry
A circle with a radius of 1/2 ft is dilated by a scale factor of 8. Which statements about the new circle are true? Check all that apply. A.The length of the new radius will be 4 feet. B.The length of the new radius will be 32
9. ### Math
23.What is the approximate circumference of a circle with a radius of 6 centimeters? A.12 B.18 C.24 D.36 D 24.What is the length of the diameter if the radius is 15? A.5 B.15 C.30 D.45 C 27.What is the circumference of the circle
10. ### math
suppose you copy the circle using a size factor of 150%.what will bet he radius,diameter,circumference,and the area of the image? radius will be 1.5 times as big diameter will be 1.5 times as big but the formula for area will be
11. ### area of circle
My circle has a radius of 8ft. What is the distance of the circle? What "distance" are you talking about? Diameter? Circumference? What is the area of a circle with the radius of 32 cm????
More Similar Questions | {
"domain": "jiskha.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9825575121992374,
"lm_q1q2_score": 0.8010128088070813,
"lm_q2_score": 0.8152324915965392,
"openwebmath_perplexity": 927.6277268513514,
"openwebmath_score": 0.8328758478164673,
"tags": null,
"url": "https://www.jiskha.com/questions/1182061/The-circumference-of-a-circle-is-20-pi-cm-Find-diameter-radius-and-area-of-the"
} |
stoichiometry, atoms, mole
Title: How to find the number of hydrogen atoms in 0.5 mol of hydrogen gas? How do I calculate the number of hydrogen atoms in $\pu{0.5 mol}$ of hydrogen gas?
I presume the answer would probably somehow use the equation
$$n = \frac{m}{M},$$
where $n$ is the amount of substance, $m$ is the mass, and $M$ is the molar mass. However, I'm not sure how to calculate it. There is no need to use
$$n = \frac{m}{M},$$
since you already have been given the amount of substance. You would need to use the equation, if you were given the mass $m$, e.g. as $\pu{0.5 mg}$.
If you want to calculate the number of hydrogen atoms in $\pu{0.5 mol}$ hydrogen gas, then you should consider that they are diatomic molecules, $\ce{H2}$.
The unit mole is represented by the Avogadro constant and is
$$N_\mathrm{A} = \pu{6.02214076×10^23 mol−1}
\approx \pu{6.022×10^23 mol−1}$$
Each hydrogen molecule has two hydrogen atoms, therefore
\begin{align}
n(\ce{H}) &= 2 \cdot n(\ce{H2}),\\
N(\ce{H}) &= n(\ce{H}) \cdot N_\mathrm{A},\\
N(\ce{H}) &= 2 \cdot n(\ce{H2}) \cdot N_\mathrm{A},\\
N(\ce{H}) &= 2 \times \pu{0.5 mol} \times \pu{6.022×10^23 mol−1},\\
N(\ce{H}) &= \pu{6.022×10^23}.
\end{align} | {
"domain": "chemistry.stackexchange",
"id": 4159,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "stoichiometry, atoms, mole",
"url": null
} |
homework-and-exercises, electrostatics, electric-fields, gauss-law, conductors
Title: Electric field of a finite, conducting plate Let us assume a finite, conducting plate of dimension: $10\mathrm{m} \times 10\mathrm{m} \times 1\mathrm{m}$. I want to determine the electric field at the middle of one of the plates $10\mathrm{m} \times 10\mathrm{m}$ surfaces. Using Gauss's law one finds the electric field to be:
$$E= \frac{\rho}{\epsilon_0}$$
and we see that the electric field is not depend on the distance from the surface. I know that's the solution for a infinite plate. For a finite plate that doesn't seem very realistic. I assume the electric field to be not orthogonal onto the surface but to diverge - am I right with that assumption? Somehow the field has to decrease with distance. How do I modify my approach with Gauss's law so that I find the right solution for a FINITE plate? You can't do this problem with Gauss's law, because you don't have the symmetry needed to assume the direction of the electric field. You have to break the square down into differential bits with area $dxdy$, and then integrate coulomb's law. | {
"domain": "physics.stackexchange",
"id": 16769,
"lm_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, electrostatics, electric-fields, gauss-law, conductors",
"url": null
} |
gravity, moon, earth, magnetic-fields
Title: If the Moon had gravity as strong as the Earth's, and a magnetic field, could it have supported life? If the Moon had gravity as strong as Earth's, and a magnetic field, could it have supported life? Because if the Moon had as much gravity as Earth, it could have retained more water than is present today on the surface.
If the Earth is in the habitable zone, does the Moon also lie in the habitable zone? If the Moon were exactly the same as the Earth, then sure, there is no major reason to suspect it would be any different. It is in the same orbit around the Sun as us, so it gets heated by the same amount. This would place it in the habitable zone.
However, habitability is not the same as being in the habitable zone, and the detailed answer depends on how you make the surface gravity match that of Earth. The surface gravity of a sphere of radius $R$ and average density $\rho$ is
$$ g = \frac{4\pi}{3} G \rho R. $$
Most rocky bodies in the Solar system have about the same density - that of a rock - so making the Moon's gravity match the Earth's is just a matter of making it bigger. Essentially it would become Earth's twin in every way.
On the other hand, maybe you intended to keep the size the same. In that case you would have to increase the density. It is not clear what you would make the interior out of, but it is pretty certain you will not get the same geology as on Earth. For one, smaller bodies cool off too fast to be geologically active at this age (roughly 5 billion years). You see, when the planets condensed out of the gas and dust swirling around the Sun billions of years ago, they were hot - gravitational potential energy went down, and so thermal energy went up. Their heat capacity is proportional to their volume, but their heat losses are proportional to their surface areas. Thus objects with high surface area-to-volume ratios (i.e. small things) cool quickly. The thing is, Earth's geologic activity probably had a large role in building up and maintaining the atmosphere and oceans we know and love. | {
"domain": "physics.stackexchange",
"id": 5998,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gravity, moon, earth, magnetic-fields",
"url": null
} |
fluid-dynamics
The folks at Cornell have some nice animations and pictures of vehicle wakes.
As fall approaches, try putting some dead leaves (small pieces if possible) out onto the road. They should get caught up in the wake and give you a chance to see this in action.
Your first theory is on the right track. There will be a low pressure region behind the truck (not quite a vacuum). This region will also generally be a swirling mess of turbulence. The this will impart a lot velocity to the air. The front and sides contribute too, but the back end of a vehicle is usually the most significant source of drag. Check this wiki, for a nice picture and a bit on flow separation.
Bow shock is less right. You won't see a shock unless you've got things moving around the speed of sound. You will get some acceleration of the flow at the front and sides and that wouldn't look entirely unlike a bow shock, but the wake is the major player. Unlike a shock, this won't be a sharp interface and it won't be a clean straight line. | {
"domain": "physics.stackexchange",
"id": 16147,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fluid-dynamics",
"url": null
} |
python, performance, numpy
# mu, pi and sigma_squared need to be numpy arrays because we want to add vectors together the numpy way
mu_initial = initial_parameters[0, :]
sigma_squared_initial = initial_parameters[1, :]
pi_initial = initial_parameters[2, :]
mu_updated = np.zeros(no_distributions)
pi_updated = np.zeros(no_distributions)
sigma_squared_updated = np.zeros(no_distributions)
indicator_normalized = []
# Expectation step
for i in range(range_of_i):
indicator = [pi_initial[l] * norm.pdf(alphas[i], mu_initial[l], np.sqrt(sigma_squared_initial[l])) for l
in range(no_distributions)]
indicator_normalized.append([l / sum(indicator) for l in indicator])
indicator_normalized = np.array(indicator_normalized)
indicator_normalized = indicator_normalized.transpose(0, 2, 1)
# Maximization step
for i in range(range_of_i):
for j in range(np.array(alphas).shape[1]):
mu_updated += np.array(
[indicator_normalized[i][j][l] * alphas[i][j] / sum(sum(indicator_normalized))[l] for l in
range(no_distributions)])
pi_updated += np.array(
[indicator_normalized[i][j][l] / (range_of_i * range_of_m)
for l in range(no_distributions)])
# same for loop again needed because we want to use the complete mu_vector to calculate sigma_squared
for i in range(range_of_i):
for j in range(np.array(alphas).shape[1]):
sigma_squared_updated += np.array([indicator_normalized[i][j][l] * (
alphas[i][j] - mu_updated[l]) ** 2 / sum(sum(indicator_normalized))[l] for l in
range(no_distributions)]) | {
"domain": "codereview.stackexchange",
"id": 35189,
"lm_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, numpy",
"url": null
} |
fourier-transform, fourier-series
Title: Filtering using fourier series Suppose I have a measured signal $M$ that has frequency components from 0 to 50 Hz. I plot the specturm of this signal using FFT and I observe its frequency content (power vs frequency). Then, I decompose signal $M$ to its fourier series components and weights, I call this series $M_{hat}$. I compare the spectrum of $M_{hat}$ and $M$ and they look identical.
Now, I decide to extract the the frequency content between 0 to 10 Hz from $M_{hat}$. I consider the sins and cosines from 0 to 10Hz linearly combined with their weights. I call this signal $M_{hat10}$. When I plot the spectrum of $M_{hat10}$ and $M_{hat}$ on top of each other, I don't see them exactly matching in the range 0 to 10Hz. However, $M_{hat10}$ is indeed cut after 10Hz.
I don't understand why don't $M_{hat}$ and $M_{hat10}$ match in the range 0 to 10Hz. As per OPs real signal shared in txt file, it looks like extraction was done only one 1 side corresponding to FFT $M_{hat}$. For a real signal, we need to do extraction from other side also. So effectively we need to combine weights of double the number of components. The spectrum of the new signal $M_{hat10}$ will match that of $M_{hat}$ in the frequency range 0 to 10Hz as shown below
clc
clear all
close all
T=readtable('data.txt');
A=table2array(T);
n=A(:,1); %time
x=A(:,2); %signal
M=fft(x);
L=length(M);
Z=round(10/50*L); % computing FFT points corresponding to 10Hz
%Extracting only Z points from either side of FFT and setting rest to zero
Mhat10 = [M(1:Z); zeros(L-2*Z,1); M(L-Z+1:L)]; | {
"domain": "dsp.stackexchange",
"id": 8616,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fourier-transform, fourier-series",
"url": null
} |
which cannot be identically zero.
• If we replace $\sin^2x$ with $\frac {1-\cos 2x}{2}$ and then try to apply this method directly, the extra factor $4$ in $-4p(x) \cos 2x$ (and the absence of this factor in $-q(x)\sin x$) will not allow us to go further. – TZakrevskiy Oct 19 '17 at 9:10
• @TZakrevskiy: doesn't $g(t):=f''(t)+f(t)$ then $h(t):=g''(t)+4g(t)$ deal with that ? – Yves Daoust Oct 19 '17 at 9:22
• We can try something easier: $g=f'+f$, this will give us a combination of $\sin 2x$, $\cos 2x$, $\sin x$, and $\cos x$ with polynomial coefficients. After that, by a sufficient number of maps $h\to h''+4h$ we can reduce this expression to a combination of just $\cos x$ and $\sin x$, and then apply your method. There will be some points where we would need to prove that along all those differentiations we don't loose some information, but that seems easy. – TZakrevskiy Oct 19 '17 at 9:45
• Sorry guys... I have just noticed that I can vote your nice answers! – dmtri Nov 22 '17 at 12:39
• @dmtri: you are also deemed to accept (√ sign) the answer that suits you (if any). – Yves Daoust Nov 22 '17 at 14:37 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9763105259435195,
"lm_q1q2_score": 0.8027119024449304,
"lm_q2_score": 0.8221891305219504,
"openwebmath_perplexity": 212.00951250277654,
"openwebmath_score": 0.8732498288154602,
"tags": null,
"url": "https://math.stackexchange.com/questions/2479157/the-transcendence-of-sine-function"
} |
symmetry, symmetry-breaking
Title: Symmetry breaking What is a good place to learn the details of symmetry breaking? What I am looking for is a more serious exposition than the wiki-article, which explains the details, especially the mathematical part, but at the same time less detail than the typical quantum field theory book. Preferably I would like to see a clean made up example with all the details, but not necessarily a real example, what one can see in most books, which naturally has a lot of details that are there because that's what the world is, and not to illustrate the idea.
I hope it is clear what I am looking for.
EDIT: Just to clarify. I am looking for a reference, but if somebody is willing to write an example here, I would be more than happy. Since symmetry breaking has much wider applications, than just in QFT. It is investigated also by mathematcal physicists. I recommend the recent book called "Symmetry breaking" by Strocchi for mathematical treatment of the subject. | {
"domain": "physics.stackexchange",
"id": 293,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "symmetry, symmetry-breaking",
"url": null
} |
haskell, ascii-art
Title: Printing an arrow of asterisks in Haskell This code will print an arrow of asterisks, like:
*
**
***
****
***
**
*
raisingAsterisks, decreasingAsterisks, arrow :: Int -> [String]
raisingAsterisks n = take n $ iterate ('*' :) "*"
decreasingAsterisks = reverse . raisingAsterisks
arrow n = raisingAsterisks n ++ (tail (decreasingAsterisks n))
main :: IO()
main = mapM_ putStrLn $ arrow 4 The way you're actually generating the list of Strings seems fine, but the formatting, at least in my opinion, can be improved: since raisingAsterisks and decreasingAsterisks are both relatively small "helper" functions for arrow, I would suggest putting them inside a where clause to make things a little easier to read.
arrow :: Int -> [String]
arrow n = increasing ++ tail decreasing
where increasing = take n $ iterate ('*' :) "*"
decreasing = reverse increasing
In this context, the variable names could be shortened, due to the fact that it's easy to understand what's happening. Note that the n variable no longer needs to be passed, so increasing and decreasing actually are no longer even functions!
I hope you agree that changing your code just a little greatly improves readability. | {
"domain": "codereview.stackexchange",
"id": 15686,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "haskell, ascii-art",
"url": null
} |
rviz, collada, ros-diamondback
Title: segfault after failed call do `GetParentLink`: collada_joint_publisher with diamondback
Hi everyone!
My name is Ivan, and I have a problem with Ros discussed below:
rviz running with "roslaunch orrosplanning collada_rviz_display.launch model: = barrettwam.dae" to start simulation of the WAM
all display screen but nothing else and throw rviz the following errors:
rviz: /opt/ros/diamondback/stacks/robot_model/urdf/src/collada_model_reader.cpp:683: bool urdf::ColladaModelReader::_ExtractKinematicsModel(domKinematics_modelRef, domNodeRef, domPhysics_modelRef, const std::list<urdf::ColladaModelReader::JointAxisBinding, std::allocator<urdf::ColladaModelReader::JointAxisBinding> >&): La declaración `_checkMathML(papplyelt,"apply")' no se cumple.
[rviz-3] process has died [pid 27214, exit code -6].
log files: /home/ivaxxus/.ros/log/03c9da48-61d6-11e0-a0aa-70f1a192dd31/rviz-3*.log
Traceback (most recent call last):
File "/opt/ros/diamondback/stacks/orrosplanning/collada_joint_publisher.py", line 78, in <module>
jsp.loop()
File "/opt/ros/diamondback/stacks/orrosplanning/collada_joint_publisher.py", line 53, in loop
if link.GetParentLink() is None:
AttributeError: 'Link' object has no attribute 'GetParentLink'
[collada_joint_publisher-2] process has died [pid 27213, exit code -11]. | {
"domain": "robotics.stackexchange",
"id": 5309,
"lm_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, collada, ros-diamondback",
"url": null
} |
gas-giants
Title: Where do we define the "surface" of a gas planet? Since gas giant consist of most gas components, where do we establish their "surface"?
My take is basically to take the limit in which all light is opaque. For example, in this photo:
The surface, then, will be the limit of the black blackground with the planet.
Any other way to formally define the "surface" of a gas giant? There are two common definitions in use for the surface of gas planets:
The 1-bar surface: As pressure increases, the deeper in we go into the gas planet, we will hit a pressure of 1 bar at some altitude. Gas at this altitudes will usually sit deep enough in the gravitational well and be of a near-uniform density and temperature, as to not be influenced by exterior parameters, for example the solar wind. Therefore, the altitude of the 1-bar level will remain essentially constant, for short astronomical times.
The $\tau=2/3$-surface: This is the altitude, from which photons can escape freely into space. This happens at an average optical depth $\tau$ of 2/3. It is essentially what you see in your image as the limit of the black background. For the sun one end of the photosphere is the average $\tau=2/3$-surface, and for transiting exoplanets this is identical to the measured transit radius at that wavelength.
There is no hard relation between those two surfaces, but in general their altitude will not be different by more than a scale height, as at around 0.1-1 bar the gaseous atomic and molecular bands become enormously pressure broadened, which makes the atmosphere quickly opaque at most wavelengths, for the usual gas giant components. | {
"domain": "astronomy.stackexchange",
"id": 4611,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gas-giants",
"url": null
} |
general-relativity, black-holes, time, reference-frames, time-dilation
Title: Understanding gravitational time dilation / Schwarzschild metric I've had a look at the answers to these sorts of questions already, but feel like I'm still missing something. Starting with this question, and this one and even this one here.
I'm looking at this answer mainly, the others are there to show this is a consistent approach being used to explain the effect.
Unless I'm mistaken it shows that if you construct a metric in polar form, and assume uniform circular motion, that the time dilation is equivalent to just taking the magnitude of the velocity (which remains constant) and deriving a gamma term. However I can't help but notice that you get the same result with uniform linear motion as well, ignoring the acceleration term. In short, it (mathematically) suggests that uniform circular motion in flat space is equivalent to constant relative motion in flat space when asking about time dilation.
This is entirely unsurprising to me so maybe I've missed something? But to me it says that the arc-length and the line-length are equally contracted due to velocity along those paths regardless of the direction of velocity, which means it willfully ignores what, if any, contribution a change of direction (acceleration despite constant speed) has to the metric? My guess is that this is in flat space so general relativity hasn't been considered, ergo no explanation how it affects space-time.
Assuming I've done something wrong, I then looked at this answer... It shows that the SR polar-form arises from the Schwarzschild metric when mass is negligible in magnitude or too far to be of much effect locally. At least that's what I've gathered reading that answer... And now I have more questions than before... | {
"domain": "physics.stackexchange",
"id": 22079,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "general-relativity, black-holes, time, reference-frames, time-dilation",
"url": null
} |
the maximum or the minimum value of a quadratic function. A coordinate grid has been superimposed over the quadratic path of a basketball in the picture below. Did you have an idea for improving this content following quadratic functions undergoes variable always! Function with its graph will allow us to use transformations to the graph 2. Out / Change ), you are commenting using your Twitter account be determined by finding the first of... Use graph paper and a ruler! ] \left ( h, and represents what a contains..., a, gives us two pieces of information to remember when plotting the h value new with... Below is the graph of y = x 2 to create a new graph with a corresponding new can... State transformations, the variable is always squared the graph of a quadratic function icon to Log in you. New graph with a corresponding new equation can be written in the vertex of the quadratic equation a. This graphic organizer as a way to review the concepts before assessments equivalent methods of describing the function. Right ( positive ) x-axis table of this basic function rules, write the equation given above, vertex...: you are commenting using your Google account a base or “ mother ” parabola each parabola the to! Twitter account while practicing transformations of functions, and more with flashcards games... The second differences of the form Now check your answers using a calculator graphing quadratic fu:! The coefficients of [ latex ] \left ( h, translates the base parabola is shifted the! 8 2 quadratic path transformations of quadratic functions in vertex form the vertex equation, in vertex form ) is y = 2. From x in the form of a quadratic function … the U-shaped graph of the vertex form,... About direction of opening of graph of y = 3 ( x + 4 ) 2 + bx +.... Graphing from vertex form of Parabolas Date_____ Period____ use the information provided to the! The U-shaped graph of a parabola contains the vital information about the of! Is subtracted from x in the equation, in vertex form shows linear! With a partner to match each quadratic function second differences of the parabola shifted!, expansions, contractions, and k in the equation for a parabola! These transformed functions look similar to the SAME function see the review,. X h | {
"domain": "mediakommunikation.se",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9748211582993982,
"lm_q1q2_score": 0.8343018100026284,
"lm_q2_score": 0.8558511506439708,
"openwebmath_perplexity": 731.1402702819819,
"openwebmath_score": 0.5322927832603455,
"tags": null,
"url": "https://mediakommunikation.se/equidae-family-epchc/01359c-transformations-of-quadratic-functions-in-vertex-form"
} |
visible-light, reflection, laser
Title: Will I see the light? There is a perfectly smooth wall. We have a slit parallel to it. Through that a laser beam passes. As the slit is parallel to wall the laser beam will hit it normally. So now if I see obliquely I shouldn't be able to view the laser dot. But that doesn't seem to be right by intuition. So will I see the dot or not and why? If the wall is made of a perfectly reflective material (such as a mirror) no, you won't see the dot.
However, most walls are covered with paint or made of a diffusive material : when the laser beam hits the wall, its light gets diffused in all directions. Thus you are able to see the laser spot on the wall.
To summarize : reflection depends on the smoothness of the surface, and, most importantly, on whick kind of material the surface is made of. | {
"domain": "physics.stackexchange",
"id": 28139,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "visible-light, reflection, laser",
"url": null
} |
java
Title: Parameterizing a common template I need to execute the same set of statements but with a different name of the field each time. I was wondering if there is a better way to write this?
int returnCode = collectValue("empName", record);
if(returnCode <0)
{
return false;
}
returnCode = collectValue("empNum", record);
if(returnCode < 0)
{
return false;
}
returnCode = collectValue("empSalary", record);
if(returnCode < 0)
{
return false;
} There are two primary ways I can think of to change this:
Iterate over an array
String[] fieldNames = new String[]{ "empName", "empNum", "empSalary" };
for (String field : fieldNames) {
if (collectValue(field, record) < 0) {
return false;
}
}
Boolean short-circuiting
boolean returnFalse = collectValue("empName", record) < 0 || collectValue("empNum", record) < 0 || collectValue("empSalary", record) < 0;
if (returnFalse) {
return false;
}
I would personally recommend the first version, as the second version creates a long statement and is a bit more difficult to both read and debug. | {
"domain": "codereview.stackexchange",
"id": 10371,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java",
"url": null
} |
electromagnetism, magnetic-fields
Initially I started with the copper wire wrapped around the shorter bobbin. When I passed a direct current through the solenoid, the PM was pulled toward the centre of the solenoid (position 1).
I then wound a longer solenoid with the same wire expecting the same effect and expecting to get longer 'travel' on the PM when it was pulled into the solenoid. Instead I found that the PM stopped at position 2 instead of the centre of the solenoid. When I removed the PM and inserted it on the other end of the solenoid it stopped at position 3. I can push the PM further within the solenoid by applying some force and it then jumps to the other position on the other side (from 2 to 3 and vice versa).
Why does the PM behave like this and what part of the interaction between its magnetic field and that of the solenoid am I failing to understand?
*Additional useful info added post answer from Mark H.
All of Mark's assumptions and deductions are correct. There is a small join in the centre of the long solenoid's bobbin (which I made by joining two shorter bobbins). The first two layers of copper wire had to "jump" this join which is why the solenoid's magnetic field is non-uniform and is exactly as Mark has described it. What you are discovering is the behavior of dipoles in non-uniform fields. Your permanent magnet is a magnetic dipole (having two poles, north and south) and the solenoid creates the strong field inside the space within the coil.
In order to think about what should happen, let's pretend that magnetic monopoles exist, that is, isolated north and south poles [note]. Magnetic monopoles in magnetic fields act just like electric charges (or, electric monopoles) in electric fields. Positive magnetic monopoles (north poles) feel a force in the direction of magnetic fields, and negative magnetic monopoles (south poles) feel a force in the opposite direction of magnetic fields. Now, a dipole is like a north and south monopole of equal strength attached to each other with a small separation between them. Let's look at a dipole in a uniform field and see what happens. A uniform field is one that has the same magnetic field strength and direction at every point. | {
"domain": "physics.stackexchange",
"id": 77646,
"lm_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, magnetic-fields",
"url": null
} |
elisp
From file type to shell commands
Rather than build in an exception for Haskell, the usual style would be to define an alist from extensions to commands.
(defvar tagariffic-command-alist
'(("hs" . "… hasktags …")
(t . "… etags …")))
However, there's a better approach than separate commands for each type; see below.
The shell commands
Your hasktags command will choke on file or directory names that contain shell special characters: \[?* and whitespace. This isn't very common in source trees, but it could happen. Generally speaking, never use command substitution to generate a list of file names. Instead, let find call the command.
find . -type f -name '*.hs' -exec hasktags --ignore-close-implementation --etags {} +
A second problem is that if there are too many files, the command you wrote will die of a command line too long error; the one I just showed will run hasktags several times with command lines of a permitted size, causing the tag file to be overwritten. As a workaround, start by creating an empty tags file and tell hasktags to append to the tags file.
: >TAGS
find . -type f -name '*.hs' -exec hasktags --ignore-close-implementation -e -a {} +
An improvement to the find commands would be to ignore certain directories belonging to version control systems. Especially with svn, this could speed things up.
find . -type d \( -name .bzr -o -name .git -o -name .hg -o -name .svn -o -name CVS -o -name _darcs \) -prune -o \
-type f … | {
"domain": "codereview.stackexchange",
"id": 509,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "elisp",
"url": null
} |
quantum-mechanics, measurements, spectroscopy, hydrogen
Title: Spectrum measurement How can the spectrum of hydrogen be measured (Lyman series, Balmer series, Paschen series and so on)? I mean schema of measurement circuit and the measuring technique (including all the steps needed). Is there any difference between the spectrum of atomic and molecular hydrogen? googling "introduction to experimental atomic spectroscopy" gives some pretty nice results.
And yes, the spectrum of atomic and molecular hydrogen is radically different. This question at physicsforums correctly points the user to the NIST spectra database.
One should keep in mind that not all of the possible emission/absorption lines will show up in any given experiment and a lot depends on the exact conditions the gas is in. A nice introduction to this is in Condon and Shortley. | {
"domain": "physics.stackexchange",
"id": 2873,
"lm_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, measurements, spectroscopy, hydrogen",
"url": null
} |
ros-kinetic
andy@andy-zhaoyang-k42-80:~/catkin_ws$ catkin_make
Base path: /home/andy/catkin_ws
Source space: /home/andy/catkin_ws/src
Build space: /home/andy/catkin_ws/build
Devel space: /home/andy/catkin_ws/devel
Install space: /home/andy/catkin_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/andy/catkin_ws/build"
####
####
#### Running command: "make -j4 -l4" in "/home/andy/catkin_ws/build"
####
[ 0%] Built target trajectory_msgs_generate_messages_nodejs
[ 0%] Built target _industrial_msgs_generate_messages_check_deps_DeviceInfo
[ 0%] Built target _industrial_msgs_generate_messages_check_deps_StartMotion
[ 0%] Built target _industrial_msgs_generate_messages_check_deps_SetRemoteLoggerLevel
[ 0%] Built target std_msgs_generate_messages_nodejs
[ 0%] Built target _industrial_msgs_generate_messages_check_deps_RobotMode
[ 0%] Built target _industrial_msgs_generate_messages_check_deps_DebugLevel
[ 0%] Built target _industrial_msgs_generate_messages_check_deps_CmdJointTrajectory
[ 0%] Built target _industrial_msgs_generate_messages_check_deps_GetRobotInfo
[ 0%] Built target _industrial_msgs_generate_messages_check_deps_StopMotion
[ 0%] Built target _industrial_msgs_generate_messages_check_deps_TriState
[ 0%] Built target _industrial_msgs_generate_messages_check_deps_RobotStatus
[ 0%] Built target trajectory_msgs_generate_messages_py | {
"domain": "robotics.stackexchange",
"id": 30724,
"lm_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",
"url": null
} |
javascript, html, css, ecmascript-6, user-interface
Title: JavaScript discrete slider web component The standard HTML range input element suffers from a number of limitations that caused me to implement the web component presented here.
First, it is unnecessarily complicated to style the standard HTML range input element to make it look the same in all web browsers (see here and here).
Second, the standard HTML range input element is designed to be used in a horizontal manner from left to right. Turning it into a vertical slider can be done but is again web browser-specific (see here). In order to invert its minimum and maximum the element needs to be transformed accordingly (see here).
Lastly, the standard HTML range input element does not support visual indications of the values that it can be set to. Such indications are an important aspect of this web component and it is where it derives its name from.
The result of that effort is a dependency-free web component stored in a single file. Its content is shown below:
export const OrientationEnum = Object.freeze({
LeftToRight: "left-to-right",
RightToLeft: "right-to-left",
TopToBottom: "top-to-bottom",
BottomToTop: "bottom-to-top"
}); | {
"domain": "codereview.stackexchange",
"id": 41481,
"lm_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, html, css, ecmascript-6, user-interface",
"url": null
} |
c++, event-handling
Event<void(int, int, int)> & On_Int_Int_Int_Event() {
return on_int_int_int_event;
}
void Fire_Events()
{
on_void_event();
on_int_event(1000);
on_int_int_event(1000, 2000);
on_int_int_int_event(1000, 2000, 3000);
}
private:
Event<void()> on_void_event;
Event<void(int)> on_int_event;
Event<void(int, int)> on_int_int_event;
Event<void(int, int, int)> on_int_int_int_event;
};
class Consumer : public std::enable_shared_from_this<Consumer>
{
public:
Consumer(int id) : id(id) {}
void Initialise(Producer * producer)
{
assert(producer != nullptr);
producer->On_Void_Event().Attach(&Consumer::Handle_Void_Event, shared_from_this());
producer->On_Int_Event().Attach(&Consumer::Handle_Int_Event, shared_from_this());
producer->On_Int_Int_Event().Attach(&Consumer::Handle_Int_Int_Event, shared_from_this());
producer->On_Int_Int_Int_Event().Attach(&Consumer::Handle_Int_Int_Int_Event, shared_from_this());
}
void Handle_Void_Event()
{
std::cout << id << " Handling a void event" << std::endl;
}
void Handle_Int_Event(int value1)
{
std::cout << id << " Handling an int event (" << value1 << ")" << std::endl;
} | {
"domain": "codereview.stackexchange",
"id": 29667,
"lm_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++, event-handling",
"url": null
} |
This R tutorial describes how to create a qq plot (or quantile-quantile plot) using R software and ggplot2 package. Introduction The quantile-quantile or q-q plot is an exploratory graphical device used to check the validity of a distributional assumption for a data set. By symbolizing a layer with a different attribute than either of the QQ plot variables, a third variable can be shown on the QQ plot visualization. 5**(1/n), for i. In this example I'll show you the basic application of QQplots (or Quantile-Quantile plots) in R. Sorry about the basic nature of the question, but can anyone tell me the unit of measurement of the Y axis in a Detrended Normal Q-Q Plot?. The Q-Q plot, or quantile-quantile plot, is a graphical tool to help us assess if a set of data plausibly came from some theoretical distribution such as a Normal or exponential. Value between 0 <= q <= 1, the quantile (s) to compute. Directed by Luis Llosa. diagnostic plots— Distributional diagnostic plots 3 Menu symplot Statistics >Summaries, tables, and tests >Distributional plots and tests >Symmetry plot quantile Statistics >Summaries, tables, and tests >Distributional plots and tests >Quantiles plot qqplot Statistics >Summaries, tables, and tests >Distributional plots and tests >Quantile-quantile plot qnorm. The basic syntax for creating scatterplot in R is − plot (x, y, main, xlab, ylab, xlim, ylim, axes) Following is the description of the parameters used − x is the data set whose values are the horizontal coordinates. Let us see how to Create a Scatter Plot, Format its size, shape, color, adding the linear progression, changing the theme of a Scatter Plot using ggplot2 in R Programming language with an example. Quantile-quantile (QQ) plots. Quantile-Quantile; Example 1: Quantile-Quantile Example 1: Data of one attribute : 20, 40, 60, 185. I don't know if you still need to know this, but I know the answer. The data value for each point is plotted along the vertical or | {
"domain": "agenziafunebretassoni.it",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9728307668889047,
"lm_q1q2_score": 0.816919037802322,
"lm_q2_score": 0.8397339656668286,
"openwebmath_perplexity": 1034.3576954213952,
"openwebmath_score": 0.5142551064491272,
"tags": null,
"url": "http://thrr.agenziafunebretassoni.it/qq-plot-example.html"
} |
python, pattern-recognition, sequence-modeling, data-mining
Now you can call find_patterns on subtrees, but you need to take into account, that you may not split the input sequence normally. You need to define some overlapping sequence part, so that patterns, that begin at the end of one sequence-fragment can be completed but that this overlapping sequences need to be counted differently (otherwise you get double-counts, which lead to wrong inputs). So you have to make sure, that only patterns, which began in the sequence fragment are continued with the overlap part, but that no new patterns are started in the overlap part, because you count them elsewere:
def find_patterns(S, N, m, M, overlap=[]):
root= TreeNode(None, 0, count=0, parent=None)
active_nodes= []
def process_element(active_nodes, element, M):
return [
node.get_subnode_increasing_count(element)
for node in active_nodes
if node.depth < M
]
for el in S:
root.count+=1
# append the root node
active_nodes.append(root)
# now replace all nodes in active nodes by the node
# that is reached one level deeper following el
active_nodes= process_element(active_nodes, el, M)
# complete the already started sequences with the
# overlapping sequence (the sequence that may be
# processed in another process)
for el in overlap:
active_nodes= process_element(active_nodes, el, M)
# now harvest the tree after applying the restrictions
return root, root.harvest(N, m, M) | {
"domain": "ai.stackexchange",
"id": 2459,
"lm_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, pattern-recognition, sequence-modeling, data-mining",
"url": null
} |
python, python-3.x, strings, formatting, web-scraping
raise SwimmerNotFoundError(swimmer_name)
What's important to note here is that, so far, we've been dealing at the right levels of abstraction and we've clearly handled our error cases. "Modules" (functions up to this point) do one task and do it well (see Single Responsibility Principle).
Also note that I've been dreaming up this API as I go. At the point of writing this sentence, I haven't yet considered any of the details of the lower levels (ex. parsing of the page). Instead, I am deciding the best API for accessing the data the higher levels need and using that to inform my decisions of how to design lower levels.
Now that we'll start talking about scraping, let's first formulate the data classes we'll need. These are preferable to global variables like event_start, event_end, and own_time because they keep related data together and give a uniform API for querying it.
Note that I'm using dataclasses here (which are Python 3.7), but you could use namedtuples on 3.6 (it's just the syntax for giving them methods is a little messy).
from typing import List
@dataclass(frozen=True)
class RacePage:
events: List[Event]
@dataclass(frozen=True)
class Event:
num: int
name: str
heats: List[Heat]
@property
def swimmers():
for heat in self.heats:
yield from heat.swimmers
@dataclass(frozen=True)
class Heat:
num: int
swimmers: List[Swimmer]
@dataclass(frozen=True)
class Swimmer:
lane: int
name: str
time: RaceTime | {
"domain": "codereview.stackexchange",
"id": 31262,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, python-3.x, strings, formatting, web-scraping",
"url": null
} |
homework-and-exercises, general-relativity, gravity, lagrangian-formalism, variational-calculus
Title: Spin connection equations of motion from Einstein-Palatini action I am working through "Supergravity" from Freedman and Van Proeyen. In exercise 8.11 one is tasked to vary the Einstein-Palatini action
$$ S = \frac{1}{2\kappa^2}\int d^Dx\ e e^\mu{}_a e^\nu{}_b R_{\mu\nu}{}^{ab}(\omega) $$
wrt. to the spin connection $\omega_{\mu ab}$ (here greek indices represent "curved" indices, while latin represent "flat" ones).
Ultimately we are to show that this variation is proportional to $D_{[\mu}e^a{}_{\nu]}$, where $D$ denotes the covariant derivative wrt. the spin connection $\omega$, letting us conclude that the solution of the equations of motion is exactly the torsion free connection.
As a hint, we are reminded that we showed earlier
$$\delta R_{\mu\nu ab} = 2 D_{[\mu}\delta\omega_{\nu]ab}.$$
It is also clear, since $D_\mu e = \partial_\mu e = \partial_\mu \sqrt{-g} = \frac{1}{2}\sqrt{-g}g^{\alpha \beta} \partial_\mu g_{\alpha\beta} = \frac{1}{4}\sqrt{-g}\partial_\mu(g^{\alpha \beta} g_{\alpha\beta})= 0$, that we can integrate by parts without worrying about $e$.
Edit 1: As was pointed out in the comments, this is actually wrong. However, below I corrected the calculation so that it does not use this argument.
However I only managed the following (setting $\kappa=1$) | {
"domain": "physics.stackexchange",
"id": 75153,
"lm_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, lagrangian-formalism, variational-calculus",
"url": null
} |
catkin-make, make
Title: Error when calling catkin_make --> Invoking "make" failed'
Hi,
I'm new to ROS. I was following exactly the steps listed here:
http://pharos.ece.utexas.edu/wiki/index.php/ROS_packages_and_contents_required_to_teleoperate_the_iRobot_Create
However, when I run catkin_make, i got the following error:
user@ubuntu:~/catkin_ws$ catkin_make
Base path: /home/user/catkin_ws
Source space: /home/user/catkin_ws/src
Build space: /home/user/catkin_ws/build
Devel space: /home/user/catkin_ws/devel
Install space: /home/user/catkin_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/user/catkin_ws/build"
####
####
#### Running command: "make -j2 -l2" in "/home/user/catkin_ws/build"
####
[ 3%] [ 3%] Built target geometry_msgs_generate_messages_cpp
Generating dynamic reconfigure files from cfg/TurtleBot.cfg: /home/user/catkin_ws/devel/include/irobotcreate_node/TurtleBotConfig.h /home/user/catkin_ws/devel/lib/python2.7/dist-packages/irobotcreate_node/cfg/TurtleBotConfig.py
../catkin_generated/env_cached.sh: 16: exec: /home/user/catkin_ws/src/irobotcreate_node/cfg/TurtleBot.cfg: Permission denied
make[2]: *** [/home/user/catkin_ws/devel/include/irobotcreate_node/TurtleBotConfig.h] Error 126 | {
"domain": "robotics.stackexchange",
"id": 21378,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "catkin-make, make",
"url": null
} |
So, my answer is that the plus sign distinguishes so-called real and imaginary parts from each other. I think ordered pairs do this better, but one should then add in the x + yi to take advantage of the familiarity. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.970239909496136,
"lm_q1q2_score": 0.8227321648718715,
"lm_q2_score": 0.8479677622198946,
"openwebmath_perplexity": 214.85089410852518,
"openwebmath_score": 0.8767485618591309,
"tags": null,
"url": "https://math.stackexchange.com/questions/2365475/why-do-we-represent-complex-numbers-as-the-sum-of-real-and-imaginary-parts"
} |
# Trouble with differential equation
I tried to solve this differential equation:
$$\epsilon y''(x)+xy'(x)=-\epsilon \pi^2 \cos(\pi x)-\pi x\sin(\pi x)$$
with boundary conditions: $y(-1)=-2, \space y(1)=0$. If we take $\epsilon=0.1$, Mathematica can solve it without any trouble
Block[{e = 0.1, min = -1, max = 1},
Plot[Evaluate[
y[x] /. NDSolve[{e y''[x] +
y'[x] x == -e Pi^2 Cos[Pi x] - Pi x Sin[Pi x],
y[min] == -2, y[max] == 0}, y, {x, min, max}]], {x, min, max}]
]
But if we want a smaller $\epsilon$, let say 0.01, Mathematica seems unable to handle it. Is there any options to invoke or methods to employ to get the desired result? Anyway, this is the solution for $\epsilon=0.0001$.
Thank you.
• Piece of advice: don't use Block to inject values into parameters. Use With instead. – m_goldberg Jun 25 '15 at 14:24
• The fundamental problem would appear to be that, in the limit of small e, the order of the equation drops from second to first, with the result that there is one too many boundary conditions. – bbgodfrey Jun 25 '15 at 14:30
DSolve can handle this.
Clear[y];
y[x_, e_] = y[x] /. DSolve[{
e y''[x] + y'[x] x == -e Pi^2 Cos[Pi x] - Pi x Sin[Pi x],
y[-1] == -2, y[1] == 0}, y[x], x][[1]] // Simplify | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9481545304202038,
"lm_q1q2_score": 0.8335669815116453,
"lm_q2_score": 0.8791467580102418,
"openwebmath_perplexity": 4110.777804354845,
"openwebmath_score": 0.23241481184959412,
"tags": null,
"url": "https://mathematica.stackexchange.com/questions/86837/trouble-with-differential-equation"
} |
quantum-field-theory, black-holes, antimatter, qft-in-curved-spacetime, time-reversal-symmetry
If electrons were just positrons moving backwards in time, then shouldn't we see them coming out of black holes? When we say “a positron is an electron moving backwards in time,” we’re really talking about symmetries. There are three transformations that we can apply to a field in quantum electrodynamics:
charge conjugation, $C$, reverses the signs of all quantum numbers: electric charge, strangeness, charm, lepton number, etc.
parity $P$, or more descriptively “space inversion,” changes from a right-handed coordinate system to a left-handed coordinate system.
time reversal, $T$, reverses the flow of time. | {
"domain": "physics.stackexchange",
"id": 82718,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-field-theory, black-holes, antimatter, qft-in-curved-spacetime, time-reversal-symmetry",
"url": null
} |
general-relativity, reference-frames, observers, free-fall, time-travel
Title: I was researching on time travel and got an idea. Is free fall a case of time travel? A person standing in a huge lift which is free falling.
Observation: for that person gravity will be relatively zero.
As we know the weaker the gravity is the faster time flows and stronger the gravity is slower the time flows( eg case of black hole)
So is it case of time travel? As for the person gravity is relatively zero so he would be experiencing time very fast.. No, it isn't. Your gravitational time dilation depends on the gravitational potential at your location, it doesn't matter if you're in freefall or if you're at rest, resisting the gravitational field.
BTW, the gravitational time dilation on Earth's surface is quite small. According to that Wikipedia article, a clock on Earth's surface loses about 2.19 seconds per century due to the Earth's gravity. | {
"domain": "physics.stackexchange",
"id": 68681,
"lm_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, reference-frames, observers, free-fall, time-travel",
"url": null
} |
c#, multithreading, .net, locking
public Pool2(int initialCapacity, int capacityLimit, Func<T> objectFactory)
{
capacityLimit = Math.Max(capacityLimit, initialCapacity);
_Objects = new BlockingCollection<T>(capacityLimit);
_Capacity = initialCapacity;
_Limit = capacityLimit;
_ObjectFactory = objectFactory;
_CapacityLock = new object();
GenerateObjects(initialCapacity);
}
private void GenerateObjects(int numberOfObjects)
{
for (int i = 0; i < numberOfObjects; ++i)
{
_Objects.Add(_ObjectFactory.Invoke());
}
}
public T Fetch()
{
T item;
if (!_Objects.TryTake(out item))
{
int capacityDifference;
lock (_CapacityLock)
{
int oldCapacity = _Capacity;
_Capacity = Math.Min(_Capacity * 2, _Limit);
capacityDifference = _Capacity - oldCapacity;
}
if (capacityDifference > 0)
{
GenerateObjects(capacityDifference);
}
return _Objects.Take();
}
return item;
}
public void Store(T item)
{
if (!_Objects.TryAdd(item))
{
throw new InvalidOperationException("More items were returned to the pool than were generated");
}
}
}
Benchmark code:
class Program
{
const int MaxUsers = 100;
const int MaxObjects = 10000;
const int NumIterations = 100;
static Random _Rand = new Random();
static Task[] _Users = new Task[MaxUsers];
static void Main(string[] args)
{
var pool = new Pool<object>(1000, MaxObjects, () => new object());
var pool2 = new Pool2<object>(1000, MaxObjects, () => new object());
Benchmark(pool, "Original Pool");
Benchmark(pool2, " New Pool");
} | {
"domain": "codereview.stackexchange",
"id": 12469,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, multithreading, .net, locking",
"url": null
} |
fourier-transform, fourier, fourier-series
&= \frac{2}{T_0}\frac{A}{2\pi f_0}\sin(2\pi f_0 t)\Big]_{-T_0/4}^{T_0/4} = \frac{2A}{2\pi f_0T_0}\Big(\sin\Big(\pi f_0\frac{T_0}{2}\Big) -\sin\Big(-\pi f_0\frac{T_0}{2}\Big)\Big)
\end{align}$$
We know that $T_0 = 1/f_0 \Longrightarrow f_0T_0=1$ and that $\sin(-x)=-\sin(x)$. Simplifying:
$$\begin{align}
X_0 &= \frac{A}{\pi}\Big(\sin\Big(\frac{\pi}{2}\Big) + \sin\Big(\frac{\pi}{2}\Big)\Big) = \frac{2A}{\pi}
\end{align}$$
Now for the $X_k$s, I've already mentioned that you have to use
$$X_k = \frac{1}{T_0^{\prime}}\int_{T_0^{\prime}}x(t)e^{-j2\pi kf_0^{\prime}t}dt$$
You can use the same interval for your integration, keep in mind that $f_0T_0=1$ to simplify your expressions, and treat $k$ as a constant until the end. Judging from your question, you should get something that includes $\frac{2A}{(2k+1)\pi}$. | {
"domain": "dsp.stackexchange",
"id": 8213,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fourier-transform, fourier, fourier-series",
"url": null
} |
ngs, cutadapt, loop
Title: Error after trimming illumina adapters I am removing illumina adapters of the NGS data with a loop. My NGS data is storage in /data/HTS_seq/.
I used this function:
for infile in /data/HTS_seq/*_read1.fastq; do outfile=$infile\_trim.fastq cutadapt -a AGATCGGAAGAGCACACGTCTGAACTCCAGTCAC -e 0.1 -O 3 -m 30 --max-n 2 -o $outfile $infile; done
for infile in /data/HTS_seq/*_read2.fastq; do outfile=$infile\_trim.fastq cutadapt -a AGATCGGAAGAGCGTCGTGTAGGGAAAGAGTGTA -e 0.1 -O 3 -m 30 --max-n 2 -o $outfile $infile; done | {
"domain": "bioinformatics.stackexchange",
"id": 1471,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ngs, cutadapt, loop",
"url": null
} |
gas, evaporation
Title: Vapor pressure in a closed box If there is a closed box at room temperature with water inside after a certain point there will be an equilibrium condition where some water is liquid and some is vapor. So there will be a certain vapor pressure.
My question is: if there is the same box with the same water except this time there is also some other gas inside the box, will the vapor pressure be the same of the previous case? It will be the same if the gasses are close to being ideal, and so Dalton's law of partial pressure holds. While Dalton's law is only approximate, is is a very good approximation under most practical circumstances. | {
"domain": "physics.stackexchange",
"id": 76254,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gas, evaporation",
"url": null
} |
-
The other two?${}{}{}$ – André Nicolas Dec 15 '12 at 16:44
You are using a convention that is not the same as the one I am used to. – André Nicolas Dec 15 '12 at 16:59
+1 for pointing out the definition of the principal cubic root. – s1lence Dec 15 '12 at 17:01
@AndréNicolas Sorry, you are right, I searched on the internet and it seems that my convention is not the popular one. – Sunny88 Dec 15 '12 at 19:02
For any $n\in\mathbb{Z}$, $$\left(-64i\right)^{\frac{1}{3}}=\left(64\exp\left[\left(\frac{3\pi}{2}+2\pi n\right)i\right]\right)^{\frac{1}{3}}=4\exp\left[\left(\frac{\pi}{2}+\frac{2\pi n}{3}\right)i\right]=4\exp\left[\frac{3\pi+4\pi n}{6}i\right]=4\exp \left[\frac{\left(3+4n\right)\pi}{6}i\right]$$
The cube roots in polar form are: $$4\exp\left[\frac{\pi}{2}i\right] \quad\text{or}\quad 4\exp\left[\frac{7\pi}{6}i\right] \quad\text{or}\quad 4\exp\left[\frac{11\pi}{6}i\right]$$
and in Cartesian form: $$4i \quad\text{or}\quad -2\sqrt{3}-2i \quad\text{or}\quad 2\sqrt{3}-2i$$
- | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9805806512500486,
"lm_q1q2_score": 0.8192589848963754,
"lm_q2_score": 0.8354835309589073,
"openwebmath_perplexity": 444.45964279162945,
"openwebmath_score": 0.9526073336601257,
"tags": null,
"url": "http://math.stackexchange.com/questions/259347/how-to-find-64-mathrmi-1-3/259364"
} |
cc.complexity-theory, sat, treewidth, space-complexity
Title: Is bounded-width SAT decidable in logspace? Elberfeld, Jakoby, and Tantau 2010 (ECCC TR10-062) proved a space-efficient version of Bodlaender's theorem.
They showed that for graphs with treewidth at most $k$, a tree decomposition of width $k$ can be found using logarithmic space.
The constant factor in the space bound depends on $k$.
(Bodlaender's theorem shows a linear time bound, with an exponential dependence on $k$ in the constant factor.)
SAT becomes easy when the set of clauses has low width.
Specifically, Fischer, Makowsky, and Ravve 2008 showed that satisfiability of CNF formulas with treewidth of the incidence graph bounded by $k$ can be decided with at most $2^{O(k)} n$ arithmetic operations when the tree decomposition is given.
By Bodlaender's theorem, computing the tree decomposition of the incidence graph for fixed $k$ can be done in linear time, and therefore SAT can be decided for bounded treewidth formulas in time that is a low-degree polynomial in the number of variables $n$.
One might then expect that SAT should actually be decidable using logarithmic space, for formulas with bounded treewidth of the incidence graph.
It is not clear how to modify the Fischer et al. approach for deciding SAT into something space-efficient.
The algorithm works by computing an expression for the number of solutions, via inclusion-exclusion, and recursively evaluating the number of solutions of smaller formulas.
Although the bounded treewidth does help, the subformulas seem to be too large to compute in logarithmic space.
This leads me to ask:
Is SAT for bounded treewidth formulas known to be in $\mathsf{L}$ or $\mathsf{NL}$? Indeed, using the resultss in Elberfeld-Jakoby-Tantau-2010 one can
show that SAT can be decided in logspace on formulas whose incidence graph has bounded treewidth. Here is a sketch of how the main steps of the proof of this claim go. | {
"domain": "cstheory.stackexchange",
"id": 3932,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "cc.complexity-theory, sat, treewidth, space-complexity",
"url": null
} |
Hence: 5x/100*(t-1/2) + x = 1100 = 4x/100*(t) + x
Solving, xt will get cancelled and you will get:
11000 = 11x
x is 1000
sum of both investments is 2x = 2000 which is Option D
Retired Moderator
Status: Long way to go!
Joined: 10 Oct 2016
Posts: 1326
Location: Viet Nam
Andrew borrows equal sums of money under simple interest at 5% and 4% [#permalink]
### Show Tags
02 Jul 2017, 07:29
1
1
Bunuel wrote:
Andrew borrows equal sums of money under simple interest at 5% and 4% rate of interest. He finds that if he repays the former sum on a certain date six months before the latter, he will have to pay the same amount of $1100 in each case. What is the total sum that he had borrowed? (A)$750
(B) $1000 (C)$1500
(D) $2000 (E)$4000
Assume that Andrew borrows $$X$$ dollars with simple interest of 5% anually in $$n$$ months and $$X$$ dollars with simple interest of 4% annually in $$n+6$$ months. | {
"domain": "gmatclub.com",
"id": null,
"lm_label": "1. Yes\n2. Yes",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 1,
"lm_q1q2_score": 0.8267117962054048,
"lm_q2_score": 0.8267117962054048,
"openwebmath_perplexity": 5368.266047339562,
"openwebmath_score": 0.7972299456596375,
"tags": null,
"url": "https://gmatclub.com/forum/andrew-borrows-equal-sums-of-money-under-simple-interest-at-5-and-243812.html?kudos=1"
} |
javascript, jquery, html, css, jquery-ui
////////////////////////////
// Progress Tracker Widget
(function($){
$.widget("dan.progresstracker", {
options: {
step: 1, // current step
steps:['','',''], // default is 3 no-name steps
jumpDirection: "back", // values: none,back,forward,both
jumpables: ".step-number, .step-label",
// callbacks
jumpforward: null,
jumpback: null,
complete: null
},
// Constructor
_create: function() {
this.options.step = this._constrain(this.options.step);
this.element.addClass("hasProgressTracker")
.append(this._build());
this._bind();
this.update();
},
// Unbinds and then binds a click event for each jumpable
_bind: function(){
this._off(this.element,"click");
var onMap = {};
onMap["click "+this.options.jumpables] =
function(e){
this._stepClick(e);
};
this._on(this.element, onMap);
},
// Limit step to an integer >= 0 and <= the number of steps+1
_constrain: function(step){
step = parseInt(step) || 0;
if(step>this.options.steps.length) {return this.options.steps.length+1;} else
if(step<0) {return 0;} else
{return step;}
},
// Builds and returns a jQuery element that is the progress tracker in a neutral state.
_build: function() {
var $node = $("<ol class='progresstrack container'></ol>");
var html = "";
for(var step in this.options.steps){
html +=
"<li class='step'>" + | {
"domain": "codereview.stackexchange",
"id": 9611,
"lm_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, jquery-ui",
"url": null
} |
c, array, queue
void fifo_algorithm(void)
{
for (int j = 0; j < 10; j++)
{
for (int i = 0; i < 5; i++)
{
big_array_copy[j][i] = big_array[j][i];
}
}
for (int k = 0; k < 5; k++)
{
big_array_copy[10 - 1][k] = 0;
}
for (int j = 9; j > 0; j--)
{
for (int i = 0; i < 5; i++)
{
big_array_copy[j][i] = big_array[j - 1][i];
}
}
for (int i = 0; i < 5; i++)
{
big_array_copy[0][i] = user_num[i];
}
print_new_array();
for (int j = 0; j < 10; j++)
{
for (int i = 0; i < 5; i++)
{
big_array[j][i] = big_array_copy[j][i];
}
}
}
//simply prints the new, updated values in big_array_copy
void print_new_array(void)
{
printf("These array values have been swapped:\n ");
for (int j = 0; j < 10; j++)
{
for (int i = 0; i < 5; i++)
{
array_print[0] = big_array_copy[j][i];
printf("%d,", array_print[0]);
}
printf("\n");
}
} | {
"domain": "codereview.stackexchange",
"id": 40708,
"lm_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, array, queue",
"url": null
} |
vba, excel
Insofar as aggregating the sheets of the files is concerned, is this a reasonable way of doing it?
Is there a simple of ensuring there are no blank worksheets left over? Unless the input files have blank sheets that is.
Kindly, I think the way you are doing this is reasonable. Regarding pre-existing blank sheets..The rewritten code below removes blank worksheet(s) in the importing workbook, after the selected workbooks' worksheets have been inserted.
Sub openDialogBoxAndSelectFiles()
Dim wb1 As Workbook
Set wb1 = ActiveWorkbook
'Cache worksheet references
Dim originalWorksheets As Collection
Set originalWorksheets = New Collection
For i = 1 To wb1.Sheets.Count
originalWorksheets.Add wb1.Sheets(i)
Next i
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = True
.InitialFileName = ThisWorkbook.Path & "\"
.Title = "Paddington Bear Selection Window"
.ButtonName = "Omlette"
.Filters.Clear
'only interested in Exel workbooks
.Filters.Add "All Files", "*.xls*"
If .Show = True Then
For Each file In .SelectedItems
ImportWorksheets wb1, file
Next file
End If
End With
'Delete non-imported blank worksheets
If wb1.Sheets.Count > originalWorksheets.Count Then
DeleteBlankSheets originalWorksheets
End If
End Sub
Private Sub ImportWorksheets(ByRef wb1 As Workbook, ByVal filename As Variant)
On Error GoTo ErrorExit
Dim wb2 As Workbook
Set wb2 = Workbooks.Open(filename:=filename, ReadOnly:=True)
On Error GoTo WorkbookOpenError
Dim i As Long
For i = 1 To wb2.Sheets.Count
wb2.Sheets(i).Copy before:=wb1.Sheets(1)
Next i
WorkbookOpenError:
wb2.Close
ErrorExit:
End Sub
Private Sub DeleteBlankSheets(ByRef originalWorksheets As Collection)
On Error GoTo ErrorExit | {
"domain": "codereview.stackexchange",
"id": 37449,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "vba, excel",
"url": null
} |
physical-chemistry, thermodynamics, solubility, solutions, ideal-gas
Title: Confusion in solubility expressions in Henry's Law While reading about Henry's law and solubility I frequently come across two relations:
$C = k_{h}P$ (c = concentration of a dissolved gas)
$P = k_{h}x$ (x = solubility/mole_fraction)
What is the difference in these two expressions, do they seem to contradict each other? I am not able to decide whether a gas with higher $k_{h}$ would be more soluble or less soluble.
Please help me out with the same I am new to this topic Sander (Ref. 1) has compiled a useful review of Henry's law constants in water that includes an introduction showing notation and conversions.
There are two types of Henry's law constants:
Solubility constants convert from pressure to concentration in solution (solubility):
$$c=Hp$$
Volatility constants convert from concentration in solution (solubility) to pressure:
$$p=Kc$$
Usually it is possible to determine which constant is reported by inspecting the units.
References
R. Sander. Compilation of Henry’s law constants (version 4.0) for water as solvent. Atmos. Chem. Phys., 15, 4399–4981, 2015.
www.atmos-chem-phys.net/15/4399/2015/doi:10.5194/acp-15-4399-2015 | {
"domain": "chemistry.stackexchange",
"id": 15312,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "physical-chemistry, thermodynamics, solubility, solutions, ideal-gas",
"url": null
} |
java, beginner, linked-list, queue
Title: Implementation of Queue using Linkedlist in Java Can someone please review my code? Is it the correct implementation of a queue? If not, please give suggestions on how to implement it using a linked list.
class Queue
{
Node front,rear;
class Node
{
int data;
Node next;
public Node(int d)
{
data=d;
next=null;
}
}
void enqueue(int new_data)
{
Node new_node=new Node(new_data);
if(front==null)
{
new_node.next=front;
front=new_node;
rear=front;
}
else if(rear.next==null)
{
rear.next=new_node;
rear=rear.next;
}
System.out.println(rear.data+"\t Enqueued");
}
Node dequeue()
{
if(front==null && rear==null)
{
System.out.println("\t Queue is Empty");
return null;
}
else {
Node temp=front;
front=temp.next;
temp.next=null;
System.out.println(temp.data+"\t Dequeued");
if(front==null)
{ rear=front; }
System.out.println(front +" "+ rear);
return temp;
}
}
public static void main(String[] args)
{
Queue q=new Queue();
q.enqueue(1);
q.enqueue(2);
q.enqueue(3);
q.enqueue(4);
q.dequeue();
q.dequeue(); | {
"domain": "codereview.stackexchange",
"id": 21142,
"lm_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, linked-list, queue",
"url": null
} |
javascript, css, xml, library, tex
if (stepConditionTeX) {
stepText = " step " + stepConditionTeX;
}
if (commentId) {
idText = "id='" + commentId + "' ";
}
if (comment) {
comment = " <span class='algotype-step-comment' " + idText + ">" +
Algotype.ALGORITHM_STEP_COMMENT_TAG + " " +
comment.trim() + "</span>";
}
if (label) {
label = label.trim();
if (label[label.length - 1] !== ":") {
label += ":";
}
htmlText += Algotype.getLabelHtml(state, label);
}
var forDowntoId = (forDowntoElement.getAttribute("id") || "").trim();
var forDowntoTextBegin = "";
var forDowntoTextEnd = "";
if (forDowntoId) {
forDowntoTextBegin = "<span id='" + forDowntoId + "'>";
forDowntoTextEnd = "</span>";
} | {
"domain": "codereview.stackexchange",
"id": 26692,
"lm_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, css, xml, library, tex",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.