text stringlengths 49 10.4k | source dict |
|---|---|
ros, navigation, ros-melodic, dwa-local-planner
acc_lim_x: 2.47
acc_lim_y: 0
acc_lim_theta: 4.18
sim_time: 2.0
vx_samples: 3
vy_samples: 0
vth_samples: 20
holonomic_robot: false
move_base_params.yaml:
controller_frequency: 5.0
controller_patience: 3.0
planner_frequency: 1.0
planner_patience: 5.0
oscillation_timeout: 10.0
oscillation_distance: 0.2
base_global_planner: "global_planner/GlobalPlanner"
base_local_planner: "dwa_local_planner/DWAPlannerROS"
recovery_behavior_enabled: false
costmap_common_params.yaml:
footprint: [[0.20, 0.24125], [0.20, 0.175], [0.65, 0.175], [0.65, -0.175], [0.20, -0.175], [0.20, -0.24125], [-0.20, -0.24125], [-0.20, -0.175], [-0.65, -0.175], [-0.65, 0.175], [-0.20, 0.175], [-0.20, 0.24125]]
inflation_radius: 0.1
transform_tolerance: 0.05
global_costmap_params.yaml:
global_costmap:
plugins:
- {name: static_layer, type: "costmap_2d::StaticLayer"}
- {name: inflation_layer, type: "costmap_2d::InflationLayer"}
track_unknown_space: true
global_frame: map
robot_base_frame: base_link
update_frequency: 10.0 # data comes in
publish_frequency: 10.0 # costmap publishes info
rolling_window: true
recovery_behavior: false
width: 100
height: 100
static_layer:
trinary_costmap: false
map_topic: "path_segmentation_occgrid" | {
"domain": "robotics.stackexchange",
"id": 35676,
"lm_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, navigation, ros-melodic, dwa-local-planner",
"url": null
} |
Now, onto the second question. I hope you understand that the phrase $$f(x) = e^x$$ is a short way of saying "$$f : \mathbb{R} \to \mathbb{R}$$ the function, which takes a number $$x$$ as input and gives the number $$e^x$$ as output." We can express this as $$f(\xi) = e^{\xi}$$ or as $$f(@) = e^@$$, so once again, there is no significance attached to the symbol appearing inside the brackets, because it can be anything you like. You're being asked to write $$f'(e)$$ as a limit. So, we just apply the ("second") definition: \begin{align} f'(e) &= \lim_{h \to 0}\dfrac{f(e+h) - f(e)}{h} \\ &= \lim_{h \to 0}\dfrac{e^{e+h} - e^e}{h} \end{align}
The phrase "the derivative of the function $$g$$ at the point where $$x=t$$ ..." is just sloppy and misleading, it is more accurate to say something like "the derivative of the function $$g$$ at the point $$t$$ ...", which is what I said in the definitions above.
I hope I've provided enough "weird" examples of notation with the use of $$\xi$$, $$\eta$$, @ that you understand the difference between a "dummy variable", and the actual point of interest. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9744347823646075,
"lm_q1q2_score": 0.8011696949537822,
"lm_q2_score": 0.8221891392358015,
"openwebmath_perplexity": 192.410220853315,
"openwebmath_score": 0.985133707523346,
"tags": null,
"url": "https://math.stackexchange.com/questions/3251668/confusing-notation-khan-academy"
} |
c++, strings, reinventing-the-wheel
void my_string::pop_back()
{
if (m_size == 0) return;
m_contents[m_size - 1] = '\0';
alloc.destroy(&m_contents + m_size);
//destroy old terminating zero
alloc.destroy(&m_contents + m_size + 1);
--m_size;
}
void my_string::push_back(char c)
{
if (m_space == 0) reserve(8);
else if (tot_size() == m_space) reserve(2 * m_space);
alloc.construct(&m_contents[size()], c);
alloc.construct(&m_contents[size() + 1], '\0');
++m_size;
}
my_string & my_string::operator+=(const my_string & rhs)
{
return insert(m_size, rhs.c_str());
}
my_string::~my_string()
{
cleanup();
}
std::ostream & operator<<(std::ostream & os, const my_string & rhs)
{
return os << rhs.c_str();
}
void my_string::cleanup()
{
for (int i = 0; i < tot_size(); ++i) alloc.destroy(&m_contents[i]);
alloc.deallocate(m_contents, m_space);
} | {
"domain": "codereview.stackexchange",
"id": 30184,
"lm_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++, strings, reinventing-the-wheel",
"url": null
} |
performance, parsing, objective-c, converting, tds
// clean up
cleanUp(pcol, columns, numCols);
return;
}
}
// done binding column info
// loop through each row
while ((row_code = dbnextrow(_connection)) != NO_MORE_ROWS) {
// check row type
switch (row_code) {
// regular row
case REG_ROW: {
// create a dictionary to contain the column names and values
NSMutableDictionary *row = [NSMutableDictionary dictionaryWithCapacity:numCols];
// loop through each column, creating an entry in row where dictionary[columnName] = columnValue
for (pcol = columns; pcol - columns < numCols; ++pcol) {
NSString *columnName = [NSString stringWithUTF8String:pcol->columnName];
id columnValue;
// check if column has NULL value
if (pcol->columnStatus == -1) {
columnValue = [NSNull null];
} else {
// TODO: type checking
columnValue = [NSString stringWithUTF8String:pcol->dataBuffer];
}
// insert the value into the dictionary
row[columnName] = columnValue;
}
// add an immutable copy of the row to the table
[table addObject:[row copy]];
break;
}
// buffer full
case BUF_FULL: {
NSError *error = [NSError errorWithDomain:kSQL_BufferFull
code:SQL_BufferFull
userInfo:nil];
[self executionFailure:error];
// clean up
cleanUp(pcol, columns, numCols);
return;
}
// error
case FAIL: {
NSError *error = [NSError errorWithDomain:kSQL_RowReadError
code:SQL_RowReadError
userInfo:nil];
[self executionFailure:error];
// clean up
cleanUp(pcol, columns, numCols);
return;
}
// unknown row type
default: {
[self message:SQLConnectRowIgnoreMessage];
break;
}
}
} | {
"domain": "codereview.stackexchange",
"id": 9087,
"lm_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, parsing, objective-c, converting, tds",
"url": null
} |
# Homework Help: Derive a formula for motion with constant acceleration and constant deceleration
1. Jul 11, 2012
### LoA
1. The problem statement, all variables and given/known data
A subway train travels over a distance $s$ in $t$ seconds. it starts from rest and ends at rest. In the first part of its journey it moves with constant acceleration $f$ and in the second part with constant deceleration $r \,$.
Show that $s \, = \, \frac {[\frac {fr} {f \, + \, r}] \, t^2} {2}$
2. Relevant equations
I know that $s \,= \, (\frac {1}{2})(-r )t^2\, +\, v_it$, where $v_i \,=\, ft$ but I'm not sure where to go from there. In particular, I can't figure out how to connect the seemingly separate equations for distance generated by the different accelerations into one function of time for the entire interval.
3. The attempt at a solution
By assuming that total acceleration is a sum of the given accelerations, I've gotten something that looks awfully close to the desired result, but am still not quite there:
$s \,=\,\frac{1}{2} \,(f\,+\,r)\,t^2 \, + \,v_i\,t$
I feel like I'm missing something.
Last edited: Jul 11, 2012
2. Jul 11, 2012
### !)("/#
You have to integrate the aceleration two times to get the movement ecuation.
You know that:
$x (t) = x_0 + v_0 (t-t_0) + \frac{1}{2} a (t-t_0)^2$
$v (t) = v_0+ a (t-t_0)$
Part one we start from time, position and initial velocity cero and also positive aceleration f:
$x (t) =\frac{1}{2} f t^2$
$v (t) = a t$ | {
"domain": "physicsforums.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9732407160384083,
"lm_q1q2_score": 0.847300710520644,
"lm_q2_score": 0.870597270087091,
"openwebmath_perplexity": 556.5662485798806,
"openwebmath_score": 0.7211887836456299,
"tags": null,
"url": "https://www.physicsforums.com/threads/derive-a-formula-for-motion-with-constant-acceleration-and-constant-deceleration.620233/"
} |
machine-learning, image-classification, machine-learning-model, computer-vision, image-recognition
Title: Machine learning algorithms for interpreting Companies brand/s logo/s https://www.google.com/search?q=Company+brand+logos&client=ms-android-lava&prmd=isnv&sxsrf=ALeKk0218I-1fMd-hNXX_fAF8_fu6EOotA:1600348128111&source=lnms&tbm=isch&sa=X&ved=2ahUKEwinlcWtofDrAhVAyjgGHZcYAhgQ_AUoAXoECA4QAQ&biw=360&bih=592&dpr=2
https://www.google.com/search?q=Company+brand+logos&source=lmns&bih=592&biw=360&client=ms-android-lava&prmd=isnv&hl=en&sa=X&ved=2ahUKEwjNyJS8o_DrAhXFoUsFHUsWCeoQ_AUoAHoECAAQAw
Can Machine learning algorithms with companies brand/s logo/s as input images dataset interpret & give information about the company, products & services ?
Input :
Logo images format : gif, jpg,tiff.
Example : Intel logo image.
Output :
Website : intel.com
Products & Services :
Integrated Chips manufacturers. Very likely no!
Machine learning algorithms aren't magic, they cannot see or find stuff that is not there.
We know for a fact that some trends and hints exist that link a companies exterior communication to it's industry e.g. social media companies like blue logos (think Twitter, Facebook, linkedin, etc.).
However for the most part logos, brand names, etc. do not have a structured way that ties them to such a specific information such as website-url, products and services.
Practically you will also have a huge problem gathering training material. This is a supervised image recognition problem which means that you would need hundreds/thousands of examples were images are correctly tagged with the information to train your model.
Given that a lot of industries do not even have that many brand names this will be near impossible.
Alternatives? | {
"domain": "datascience.stackexchange",
"id": 8299,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "machine-learning, image-classification, machine-learning-model, computer-vision, image-recognition",
"url": null
} |
A generalized boy or girl problem
Consider a sample $N$ numbers, independently drawn from a discrete uniform distribution over $\{1,2,...,k\}$, with replacement. Suppose I know that at least one of the $N$ numbers is 7 (like the sex of one child is known in the boy or girl paradox). What is the probability distribution of the number of 7s, given that there is at least one?
Here's my progress so far:
The total possible number of samples are $k^N$, all of which are equally likely under the uniform distribution. The total number of combinations of names without any 7s is $(k-1)^N$. Therefore, the total number of combinations with at least one 7 is $k^N-(k-1)^N$.
Only one of the combinations has all 7s, so that probability that all are 7, $$Pr(\#7=N|\#7 \geq 1)= \frac{1}{k^N-(k-1)^N}$$ I'm quite confident in this answer, but don't know about $Pr(\#7=x|\#7 \geq 1)$ for $x<N$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9861513875459069,
"lm_q1q2_score": 0.8085389530207316,
"lm_q2_score": 0.8198933381139646,
"openwebmath_perplexity": 355.32491773510765,
"openwebmath_score": 0.99822598695755,
"tags": null,
"url": "https://stats.stackexchange.com/questions/341862/a-generalized-boy-or-girl-problem"
} |
organic-chemistry, reaction-mechanism, stability, organic-oxidation, ozone
References:
Dipak K. Mandal, “Chapter 4: Cycloadditions 1: Perturbation Theory of Reactivity, Regioselectivity and Periselectivity,” In Pericyclic Chemistry: Orbital Mechanisms and Stereochemistry; First Edition, Elsevier Inc.: Amsterdam, Netherlands, 2018, pp. 107-190 (ISBN: 978-0-12-814958-4).
Christian Geletneky, Stefan Berger, “The Mechanism of Ozonolysis Revisited by $\ce{^{17}O}$-NMR Spectroscopy,” Eur. J. Chem. 1998, (8), 1625–1627 (DOI: https://doi.org/10.1002/(SICI)1099-0690(199808)1998:8<1625::AID-EJOC1625>3.0.CO;2-L)). | {
"domain": "chemistry.stackexchange",
"id": 15282,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "organic-chemistry, reaction-mechanism, stability, organic-oxidation, ozone",
"url": null
} |
# Zero-divisors and units in $\mathbb Z_4$
Consider the ring $\mathbb Z_4[x]$. Clearly the elements of the form $2f(x)$ are zero divisors.
1. Is it true that they are all the zero divisors? I mean is it true that if $p(x)$ is a zero divisor then it is of the form
$$2f(x)$$
for some $f(x) \in \mathbb Z_4[x]$? In other words, is the set of zero-divisors exactly the ideal $(2)$?
I believe it is true, but I do not know how to prove it.
Secondly, the elements $1+g(x)$, with $g(x)$ zero divisors, are clearly units: $(1+g(x))^2=1$.
2. Is it true that they are all the units? I mean is it true that if $p(x)\in \mathbb Z_4[x]$ is a unit then it is of the form
$$1+g(x)$$
for some zero divisor $g(x)$?
#### Solutions Collecting From Web of "Zero-divisors and units in $\mathbb Z_4$"
You’re right on both accounts.
1. First notice that if $p(x)$ has zero constant coefficient, say $p(x)=x^mq(x)$, then $p(x)$ is a zero divisor if and only if $q(x)$ is.
So suppose $p(x) = \sum_0^n a_ix^i \in \mathbb{Z}_4[x]$ has an odd coefficient and a nonzero constant coefficient, and let $k \le n$ be least such that $a_k$ is odd. Then all the $a_j$ for $j < k$ are even. If $k=0$ then clearly $p$ is not a zero divisor (why?) so we must have $a_0=2$. | {
"domain": "bootmath.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9770226294209299,
"lm_q1q2_score": 0.8224826996373972,
"lm_q2_score": 0.8418256393148982,
"openwebmath_perplexity": 64.70033596759603,
"openwebmath_score": 0.959225594997406,
"tags": null,
"url": "http://bootmath.com/zero-divisors-and-units-in-mathbb-z_4.html"
} |
python, python-3.x, parsing, pandas
def flatten(parsed_lines: list) -> list:
return list(itertools.chain.from_iterable(parsed_lines))
def cut_into_pieces(flattened_lines: list, piece_size: int = 4) -> list:
return [
flattened_lines[i:i + piece_size] for i
in range(0, len(flattened_lines), piece_size)
]
with open("your_text_data.txt") as data:
df = pd.DataFrame(
cut_into_pieces(flatten(read_lines(data))),
columns=["T1", "H1", "T2", "H2"],
)
print(df)
df.to_excel("your_table.xlsx", index=False)
This works and I get what I want but I feel like points 3, 4, and 5 are a bit of redundant work, especially creating a list of list just to flatten it and then chop it up again.
Question:
How could I simplify the whole parsing process? Or maybe most of the heavy-lifting can be done with pandas alone?
Also, any other feedback is more than welcomed. Disclaimer: I know this is a very liberal interpretation of a code review since it suggests an entirely different approach. I still thought it might provide a useful perspective when thinking about such problems in the future and reducing coding effort.
I would suggest the following approach using regex to extract all the numbers that match the format "12.34".
import re
import pandas as pd
with open("your_text_data.txt") as data_file:
data_list = re.findall(r"\d\d\.\d\d", data_file.read())
result = [data_list[i:i + 4] for i in range(0, len(data_list), 4)]
df = pd.DataFrame(result, columns=["T1", "H1", "T2", "H2"])
print(df)
df.to_excel("your_table.xlsx", index=False) | {
"domain": "codereview.stackexchange",
"id": 40932,
"lm_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, parsing, pandas",
"url": null
} |
human-biology
Title: Do biological facts determine when a human fetus is considered alive and human? I often hear or read this statement:
"It's not a human, it's a fetus."
In other words, some think a fetus is non-human until a certain point.
And another similar statement:
"The fetus isn't alive until 26 weeks of gestation."
So some think the fetus is not actually "alive" until a certain point.
What does biology have to say about these two statements?
I encounter these statements often in discussions about abortion, but that issue, and other similar philosophical issues, are outside this question. I'm wondering strictly from a scientific/biological standpoint: are these statements true?
Is the fetus in a human mother non-human until a certain point?
Does the fetus not classify as "alive" until a certain point?
The people I encountered truly believed these statements (3 of the 4 in mind also claimed science was on their side), so it's not as if the question has no merit. I assumed that in the realm of science and biology, there must be a convincing and sure answer. Life is generally distinguished from non-life by metabolism and growth. As such, a fetus is alive. The reference to "not...until 26 weeks gestation" that you've heard likely refers to viability.* With the most aggressive medical care, this is the approximate age when a fetus may be able to survive outside the womb.
The term human from a biologic perspective is a species label.** Given that a fetus is genetically indistinguishable (in broad strokes) from a post-natal human, I think it would be hard to argue that it is anything other than human.
Summary: Yes, a human fetus is both alive and human.
*Note that this use of the word viable is standard but deviates somewhat from the etymology of the word.
**I'm ignoring here other ancient species (homo-) which may be considered human but are irrelevant to the question. | {
"domain": "biology.stackexchange",
"id": 2799,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "human-biology",
"url": null
} |
Perhaps the most important property of a unitary matrix is that it preserves length.
###### Homework2.2.4.6.
Let $U \in \Cmxm$ be a unitary matrix and $x \in \Cm \text{.}$ Prove that $\| U x \|_2 = \| x \|_2 \text{.}$
Solution
\begin{equation*} \begin{array}{l} \| U x \|_2^2 \\ ~~~=~~~~ \lt \mbox{ alternative definition } \gt \\ ( U x )^H U x \\ ~~~=~~~~\lt ( A z )^H = z^H A^H \gt \\ x^H U^H U x \\ ~~~=~~~~ \lt U \mbox{ is unitary } \gt \\ x^H x \\ ~~~=~~~~ \lt \mbox{ alternative definition } \gt \\ \| x \|_2^2 . \end{array} \end{equation*}
The converse is true as well:
We first prove that $( A x )^H ( A y ) = x^H y$ for all $x, y$ by considering $\| x - y \|_2^2 = \| A( x - y ) \|_2^2 \text{.}$ We then use that to evaluate $e_i^H A^H A e_j \text{.}$
Let $x, y \in \Cm \text{.}$ Then | {
"domain": "utexas.edu",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9928785697791989,
"lm_q1q2_score": 0.809426876979569,
"lm_q2_score": 0.8152324983301567,
"openwebmath_perplexity": 1910.868390154623,
"openwebmath_score": 1.0000100135803223,
"tags": null,
"url": "http://www.cs.utexas.edu/users/flame/laff/alaff-beta/chapter02-unitary-matrices.html"
} |
c#, performance, task-parallel-library
The loop works. Now the performance is way better (Although not best). It now takes only 700ms to execute the loop.
But I am not sure if it is the correct way to write Parallel.ForEach loop as I am new to it. Kindly suggest if the code is right? Before going parallel I'd first try to understand which part of that code is slow. Maybe there is something you can do which will boost performance even more. That said I have few notes:
userandGroup does not follow naming conventions, types should be PascalCase.
There is no benefit to abbreviate names to usrgp and obj. is usrgrp a...group? Call it group (or userGroup if owner isn't clear from context). obj says what it is (an object), not what it does (the object which is used as synchronisation context). You may rename it (at least) to syncRoot (name used also in the framework itself for this purpose).
If lst is local then you do not need obj and you can directly lock on it.
You do not need to cast ProviderUserKey to Guid to call ToString(): usr.ProviderUserKey.ToString() or (if ProviderUserKey is object and it might be null) maybe Convert.ToString(usr.ProviderUserKey).
Object initialisation may be simplified:
Using Object Initialization syntax:
var group = new userandGroup
{
id = usr.ProviderUserKey.ToString(),
Name = usr.UserName
};
Follow naming convention also here, id should be Id. Also move Profile creation before group and you can initialise everything in this way.
DisplayName initialisation may use string interpolation:
As before:
DisplayName = $"{profile.GetPropertyValue("FirstName")} {profile.GetPropertyValue("LastName")}"
If FirstName or LastName may be empty then you're adding a spurious space. Handle the case (or at least add a call to Trim().)
true boolean parameters are a pain, I see the call and I need to go to check the prototype to know what it means. More than that: if I need another option then I need to add more and more parameters. | {
"domain": "codereview.stackexchange",
"id": 30918,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, performance, task-parallel-library",
"url": null
} |
astrophysics, stars, stellar-physics, stellar-evolution
Title: Why are some stars very large (i.e., $r \geq 1000 \ R_{\odot}$) but not super massive? Background
While I was in graduate school, I put together some cartoon-like comparisons of multiple stars to show the order of magnitude differences in radii.
At the time, VY Canis Majoris was the largest known star by radius (it appears from my graphic that it was then thought to be ~1950 $R_{\odot}$, where it is now thought to have a radius of $1420 \pm 120 \ R_{\odot}$). I see now that UY Scuti has taken that title with a radius of $1708 \pm 192 \ R_{\odot}$. I recall that at the time the mass of VY Canis Majoris was not well known (as suggested by my cartoon image) but now I see that it is reported to be $17 \pm 8$ $M_{\odot}$. Even more interesting is that UY Scuti has an even smaller mass of ~7-10 $M_{\odot}$.
As a comparison, one of the more massive stars in our catalogues is Eta Carinae, which is a binary system where the primary, $\eta$ Car A, has $r \sim 60-800 \ R_{\odot}$ and $M \sim 100-200 \ M_{\odot}$.
A quick survey of Wikipedia shows me that there are over a dozen stars with $r \geq 1000 \ R_{\odot}$ and over a dozen different stars with $M \geq 100 \ M_{\odot}$.
Questions
What causes a star like UY Scuti to have such a large "radius" but so little mass while the much more massive $\eta$ Car A is less than half the size? | {
"domain": "physics.stackexchange",
"id": 33528,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "astrophysics, stars, stellar-physics, stellar-evolution",
"url": null
} |
gazebo, gps, ros-control, ros-kinetic
I have tried adding a gdb prefix to the controller spawner, but that's a Python script and in any case does not contain the executing controller.
If this is using gazebo_ros_control, then the process that is hosting the controller plugins would be gzserver, and it would be that process that you'd have to run in gdb.
empty_world.launch does accept a debug arg (here) and if that is set to true, it will eventually start gzserver in gdb (here, via this and then this).
So to do that, you would have to change:
<include file="$(find gazebo_ros)/launch/empty_world.launch" />
to:
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="debug" value="true" />
</include>
Make sure to compile all relevant code with the Debug build type, or backtraces will be useless, but I guess you already know that.
Originally posted by gvdhoorn with karma: 86574 on 2018-06-28
This answer was ACCEPTED on the original site
Post score: 1
Original comments
Comment by gvdhoorn on 2018-06-28:
Note that the page you link for gps setup seems a bit dated. Manually changing the ROS_PACKAGE_PATH is not something we typically do these days.
Comment by walkingbeard on 2018-07-04:
Thank you for your replies - very helpful! Honestly, there are many outdated things about this project I'm doing, but I have limited time, so I can either do the project or update the underlying code. It's frustrating, but such is life. | {
"domain": "robotics.stackexchange",
"id": 31116,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gazebo, gps, ros-control, ros-kinetic",
"url": null
} |
ros, navigation, turtlebot, frontier-exploration, move-base
[DEBUG] [1465798161.835697081]: Accepted connection on socket [6], new socket [26]
[DEBUG] [1465798161.835935673]: Adding tcp socket [26] to pollset
[DEBUG] [1465798161.835984273]: TCPROS received a connection from [127.0.0.1:53259]
[DEBUG] [1465798161.836044021]: Connection: Creating ServiceClientLink for service [/move_base/set_logger_level] connected to [callerid=[/rqt_gui_py_node_21141] address=[TCPROS connection on port 49974 to [127.0.0.1:53259 on socket 26]]]
[DEBUG] [1465798161.836071826]: Service client [/rqt_gui_py_node_21141] wants service [/move_base/set_logger_level] with md5sum [51da076440d78ca1684d36c868df61ea]
[DEBUG] [1465798161.836111971]: Socket [25] received 0/4 bytes, closing
[DEBUG] [1465798161.836170231]: TCP socket [25] closed | {
"domain": "robotics.stackexchange",
"id": 24901,
"lm_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, navigation, turtlebot, frontier-exploration, move-base",
"url": null
} |
In addition, the command FullSimplify[Probability[]] does not help.
Edit (2014-11-17):
By paper-and-pencil, I have obtained a closed form $\frac{\mu + 2 \lambda}{\mu + \lambda} (\frac{1}{2} \frac{\mu}{\mu + \lambda})^{m}$. Notice that the sum $\sum_{m=1}^{\infty} \frac{\mu + 2 \lambda}{\mu + \lambda} (\frac{1}{2} \frac{\mu}{\mu + \lambda})^{m} = \frac{\mu}{\mu + \lambda}.$ The remaining $\frac{\lambda}{\mu + \lambda}$ for special case $m = 0$ has been omitted here.
Therefore, the question is
How to get a more compact form of the above probability? Specifically, is it consistent with my manual calculation (which may be wrong)?
• I think your program is wrong. In your program, a3 and a4, s4 and s5 are independent, but actually they're not, a3 is part of a4, s4 is part of s5! – xzczd Nov 17 '14 at 12:23
• @xzczd Thanks. Even "error" is helpful to me. How should I program the non-independent? Is it right to first define each $A_i$ and $S_i$ separately and then sum them to get the Erlang distributions? – hengxin Nov 17 '14 at 12:37
• Network is a bit slow today. See my answer. – xzczd Nov 17 '14 at 13:39
The approach that kguler suggest in your precedent question is completely suitable for the current one: | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9719924777713886,
"lm_q1q2_score": 0.8013707864546101,
"lm_q2_score": 0.8244619220634457,
"openwebmath_perplexity": 2645.0065205586056,
"openwebmath_score": 0.649609386920929,
"tags": null,
"url": "https://mathematica.stackexchange.com/questions/65862/how-to-get-a-more-compact-form-of-this-probability-calculation"
} |
deep-learning, keras, tensorflow, convolutional-neural-network, kaggle
Title: "concat" mode can only merge layers with matching output shapes except for the concat axis I have a function I am trying to debug which is yielding the following error message:
ValueError: "concat" mode can only merge layers with matching output
shapes except for the concat axis. Layer shapes: [(None, 128, 80,
256), (None, 64, 80, 80)]
I'm running a kernel from a Kaggle competition called Dstl Satellite Imagery Feature Detection (kernel available here)
This is the function where I am having issues merging a list of tensors into a single tensor:
def get_unet():
inputs = Input((8, ISZ, ISZ))
conv1 = Convolution2D(32, 3, 3, activation='relu', border_mode='same', dim_ordering="th")(inputs)
conv1 = Convolution2D(32, 3, 3, activation='relu', border_mode='same', dim_ordering="th")(conv1)
pool1 = MaxPooling2D(pool_size=(2, 2), dim_ordering="th")(conv1)
conv2 = Convolution2D(64, 3, 3, activation='relu', border_mode='same', dim_ordering="th")(pool1)
conv2 = Convolution2D(64, 3, 3, activation='relu', border_mode='same', dim_ordering="th")(conv2)
pool2 = MaxPooling2D(pool_size=(2, 2), dim_ordering="th")(conv2) | {
"domain": "datascience.stackexchange",
"id": 2502,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "deep-learning, keras, tensorflow, convolutional-neural-network, kaggle",
"url": null
} |
java, object-oriented, state-machine
@Override
public Critter update(Ocean currentTimeStepSea){
int neighborSharkCount=0;
neighborSharkCount = Utility.countSharkAsNeighbor(this, currentTimeStepSea);
//Updating fish cell for current & next time step
if(neighborSharkCount ==1){
/*
* 4) If a cell contains a fish, and one of its neighbors is a shark, then the
* fish is eaten by a shark, and therefore disappears.
*
*/
return new Empty(this.getLocation().getX(),this.getLocation().getY());
}
else if(neighborSharkCount > 1){
/*
* 5) If a cell contains a fish, and two or more of its neighbors are sharks, then
* a new shark is born in that cell. Sharks are well-fed at birth; _after_ they
* are born, they can survive an additional starveTime time steps without eating.
*
*/
return new Shark(this.getLocation().getX(),this.getLocation().getY(),0);
}
else {
/*
* condition is (neighborSharkCount < 1)
* 3) If a cell contains a fish, and all of its neighbors are either empty or are
* other fish, then the fish stays where it is.
*/
return this;
}
}
}
/* Ocean.java */
package Project1;
/**
* The Ocean class defines an object that models an ocean full of sharks and
* fish.
* @author mohet01
*
*/
class Ocean {
/**
* Define any variables associated with an Ocean object here. These
* variables MUST be private.
*
*/
//width of an Ocean
private int width;
//height of an Ocean
private int height; | {
"domain": "codereview.stackexchange",
"id": 10373,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, object-oriented, state-machine",
"url": null
} |
Available with Beat the GMAT members only code
• Magoosh
Study with Magoosh GMAT prep
Available with Beat the GMAT members only code
### Top First Responders*
1 GMATGuruNY 56 first replies
2 Brent@GMATPrepNow 43 first replies
3 Jay@ManhattanReview 43 first replies
4 Ian Stewart 31 first replies
5 ceilidh.erickson 15 first replies
* Only counts replies to topics started in last 30 days
See More Top Beat The GMAT Members
### Most Active Experts
1 Scott@TargetTestPrep
Target Test Prep
217 posts
2 fskilnik@GMATH
GMATH Teacher
124 posts
3 Max@Math Revolution
Math Revolution
89 posts
4 GMATGuruNY
The Princeton Review Teacher
82 posts
5 Brent@GMATPrepNow
GMAT Prep Now Teacher
66 posts
See More Top Beat The GMAT Experts | {
"domain": "beatthegmat.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9848109534209825,
"lm_q1q2_score": 0.816348024393305,
"lm_q2_score": 0.8289388146603365,
"openwebmath_perplexity": 11097.777974294566,
"openwebmath_score": 0.2117883861064911,
"tags": null,
"url": "https://www.beatthegmat.com/the-price-of-a-phone-call-consists-of-a-standard-connection-t304471.html"
} |
ros, rviz, vlp16, velodyne
@kmhallen is right: don't run the cloud node, because VLP16-points.launch already starts the cloud nodelet. Since they are both publishing the same information to the /velodyne_points topic, the result will be confusing and waste cycles and bandwidth.
The recommended method is to attach the Velodyne to its own ethernet port with a statically assigned IP in the 192.168.1.x range. We normally do it via the Ubuntu network manager like this:
IP address: 192.168.1.77
netmask: 255.255.255.0
gateway: 192.168.1.0
Setting up a VLP-16 is very similar to this 32E tutorial. We'd like to make a VLP-16 version of that tutorial some time soon.
Originally posted by joq with karma: 25443 on 2016-06-03
This answer was ACCEPTED on the original site
Post score: 0
Original comments
Comment by ArthurAlear on 2016-06-20:
Thanks for your answer ! | {
"domain": "robotics.stackexchange",
"id": 24803,
"lm_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, rviz, vlp16, velodyne",
"url": null
} |
meteor
Title: Trying to identify something I saw in the sky I'm trying to identify something I saw in the sky. This occurred in central Virginia (Louisa county), US on Sunday at around 2:15 AM EST. It started as a ring of what looked like smoke, high in the sky. The ring got gradually larger. Then a small light moved out of it. The light looked like a star but it was moving about the 'relative' speed of an airplane viewed from the ground. I say relative because I think this was higher up than an airplane and so it was probably moving faster. The light had a puff behind it which was much larger than the light (so it was much bigger than the entrails of a jet plane). When I say 'big' or 'small' I mean it relative to the view of someone standing on the ground. I kept observing this light moving across the sky until I lost it in the trees.
I have not seen anything like this before. If I had to guess, I'd say it was possibly a military plane at high altitude moving at high speed. I guess it could also be a meteor that caused the ring when it hit the atmosphere and moved off at a strange angle. However, I have never seen a meteor move that slow. They usually zip fast across the sky. Maybe it's a meteor that hit the atmosphere at an angle that slowed it down? Anyone know what it could have been?
Edit: I saw this photo submitted to the american meteorologic society. It's about the same time and looks exactly like what I saw. It was from someone in PA at 2:30am. | {
"domain": "astronomy.stackexchange",
"id": 6366,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "meteor",
"url": null
} |
gravity, quantum-gravity, gravitational-waves, cosmic-microwave-background
$$\rho^{1/4}=2.2\times 10^{18}\;\text{GeV}\left(\frac{r}{0.2}\right)^{1/4} $$
Thus, if a detection like BICEP2 determines that $r$ is on the scale of $0.1$, this tells us that we can hope to gain insights into physics that occurred at energy scales that we could have never dreamed of achieving here on Earth (for comparison, the LHC runs at $\sim 10^{4}\;\text{GeV}$). In fact, this energy density is reasonably close to the Planck scale, which is where it is generally expected that quantum gravitational effects should start kicking in. Reminding ourselves that these gravitational waves are theorized to have originated from quantum mechanical fluctuations, we seem to be tantalizingly close to realizing the dream of experimentally accessing regimes where quantum gravity can be probed!
...this, of course, all under the assumption that BICEP2-like results have been demonstrated which, at the moment, seems dubitable at best. | {
"domain": "physics.stackexchange",
"id": 20635,
"lm_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, quantum-gravity, gravitational-waves, cosmic-microwave-background",
"url": null
} |
homework-and-exercises, newtonian-mechanics, rotational-dynamics, integration, moment-of-inertia
where$\ r_1 = r_2$ (negligible thickness), and where the object would be rotating around its central diameter, which is perpendicular to the z-axis. Basically, either$\ I_x$ or$\ I_y$.
I could easily use the perpendicular axis theorem to find that$\ I_z = I_x + I_y = 2I_x = 2I_y$ and solve for my desired moment (x- or y-axis), which would give me $\frac{1}{2}MR^2$. Easy.
However, I have perused multiple sources and even attempted on my own to arrive at such an expression, and all of them (including mine) have included a second term including the width of the hoop, or in the case of my illustration, the height of the cylinder:$$I_x=I_y=\frac{1}{2}MR^2 + \frac{1}{12}MW^2$$
To make matters more confusing, my attempts at deriving left me with an identical expression to the one above, except$\ W$ is to the third power. I tried splitting the hoop into many rings and using the parallel axis theorem to account for the fact that every ring except the central one is a distance$\ z$ from the axis of rotation. It's likely that my issues are due to either poor math or a misconception of how I should even set this up based on$\ I=\int r^2dm$, but I would like to hear how others would go about solving this. The inertia $I$ is actually a tensor whose components are
$$
I_{ij} = \int{\rm d}^3{\bf x}~\rho({\bf x}) [{\bf x}\cdot{\bf x}\delta_{ij} - x_ix_j] \tag{1}
$$
So, for example the component $I_{11}$ can be calculated as
$$ | {
"domain": "physics.stackexchange",
"id": 96698,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises, newtonian-mechanics, rotational-dynamics, integration, moment-of-inertia",
"url": null
} |
haskell, functional-programming
main = do
hSetBuffering stdout NoBuffering -- <= Auto-flushes all "putStr"s
t <- inputTransitionTable
prettyPrintTransitionTable t
The following is how I would actually write it in my own code, so you can compare the size of the code a fluent Haskell programmer writes and compare to your favorite language:
inputTransitionTable = execWriterT $ runMaybeT $ forM_ [0..] $ \i -> do
let liftIO = lift . lift
liftIO $ putStrLn $ "Adding transitions to state " ++ show i ++ ": "
t <- execWriterT $ runMaybeT $ forever $ do
let liftIO = lift . lift . lift . lift
liftIO $ putStr "\tEnter transitions symbol: "
symbol <- liftIO getLine
case symbol of
"--" -> mzero
"---" -> lift . lift $ mzero
_ -> return ()
liftIO $ putStr "\t\tEnter the transition state number: "
state' <- liftIO getLine
lift $ tell [(symbol, read state')]
lift $ tell [(i, t)]
Test output from the program:
./transitions
Adding transitions to state 0:
Enter transitions symbol: a
Enter the transition state number: 1
Enter transitions symbol: b
Enter the transition state number: 2
Enter transitions symbol: --
Adding transitions to state 1:
Enter transitions symbol: a
Enter the transition state number: 2
Enter transitions symbol: b
Enter the transition state number: 3
Enter transitions symbol: --
Adding transitions to state 2:
Enter transitions symbol: a
Enter the transition state number: 3
Enter transitions symbol: --
Adding transitions to state 3:
Enter transitions symbol: --
Adding transitions to state 4:
Enter transitions symbol: ---
0 {a→1} {b→2}
1 {a→2} {b→3}
2 {a→3}
3 | {
"domain": "codereview.stackexchange",
"id": 2307,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "haskell, functional-programming",
"url": null
} |
c#, object-oriented, console
public void Initialization()
{
_accountList = new List<UserBankAccount>
{
new UserBankAccount() { Id=1, FullName = "Peter Parker", AccountNumber=333111, CardNumber = 123123, CardPin = 111111, AccountBalance = 2000.00m, IsLocked = false },
new UserBankAccount() { Id=2, FullName = "Bruce Bane", AccountNumber=111222, CardNumber = 456456, CardPin = 222222, AccountBalance = 1500.30m, IsLocked = true },
new UserBankAccount() { Id=3, FullName = "Clark Kent", AccountNumber=888555, CardNumber = 789789, CardPin = 333333, AccountBalance = 2900.12m, IsLocked = false }
};
}
public void Execute()
{
AtmScreen.WelcomeATM();
CheckCardNoPassword();
AtmScreen.WelcomeCustomer();
Utility.PrintConsoleWriteLine(selectedAccount.FullName, false);
_listOfTransactions = new List<Transaction>();
while (true)
{
AtmScreen.DisplaySecureMenu();
ProcessMenuOption();
}
}
public void CheckCardNoPassword()
{
bool isLoginPassed = false;
while (isLoginPassed == false)
{
var inputAccount = new UserBankAccount();
// Actual ATM system will accept and validate physical ATM card.
// Card validation includes read card number and check bank account status
// and other security checking.
inputAccount.CardNumber = Validator.GetValidIntInputAmt("ATM Card Number");
Utility.PrintUserInputLabel("Enter 6 Digit PIN: ");
inputAccount.CardPin = Convert.ToInt32(Utility.GetHiddenConsoleInput());
// for brevity, length 6 is not validated and data type.
AtmScreen.LoginProgress(); | {
"domain": "codereview.stackexchange",
"id": 35137,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, object-oriented, console",
"url": null
} |
filters, fourier-transform, image-processing, multi-scale-analysis
Title: Which Approach Is Better for Decomposing an Image into High Frequency and Low Frequency Components? Which approach is better or there is mathematical justification for using Bilater filter and Fourier Transform to decompose a image into High Frequency and Low Frequency Component.
Both Bilateral Filter and Fourier Transform can be used for getting High and Low Frequency component of an image.
Is one approach is better than the other or are both same in getting high and low frequency component of a image, or are they used in some particular context of image.
I know that Bilateral Filter uses range weights and Spatial weights into consideration for getting high and low frequency components. The bilateral filter is just that: a filter. It does not decompose the image into anything. It just attenuates "medium" frequency content in a clever manner. In other words, it smooths things that are mostly smooth further, and leaves sharp edges sharp. What you are left with has more low and high frequency content (on a relative basis) than what you started with.
The Fourier transform, on the other hand, actually does reveal the entire spectrum for an image. Unlike a filter, it does not change the information content of an image. It just rearranges it into the frequency, rather than spatial, domain. The bilateral filter does not reveal the spectral content of an image, so really only the Fourier transform (or one of its related transforms, like cosine and wavelet) can be used to get the high and low frequency components of an image. | {
"domain": "dsp.stackexchange",
"id": 741,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "filters, fourier-transform, image-processing, multi-scale-analysis",
"url": null
} |
ros, catkin, ros-groovy, rosbuild
Title: Question about new organization of ROS with catkin instead of rosbuild
Hi everyone!!
My name is Ivan. I have worked some years with ROS. But now, I don´t Understand the new organization of package.
For example in Fuerte version, we had this arquitecture:
example-ros-pkg
- RobotA(Stack)
- Package1
- Package2
- Package3
RobotB(Stack)
Package1
Package2
Package3
RobotD(Stack)
.
.
.
RobotE(Stack)
.
.
.
In a Groovy version, the stack concept has been removed, How can reorganize our repository to respect the new standard?
Thanks for your comments!
Originally posted by Ivan Rojas Jofre on ROS Answers with karma: 70 on 2013-05-08
Post score: 2
The closest equivalent to the old stack concept is the new metapackage, as described here. A metapackage is a package that only contains references to other packages (no code), plus a special <metapackage/> tag. This allows users to install a group of packages using a metapackage, just like they did previously with stacks. Metapackages are also more flexible in that they allow you to group packages that may not be located in the same repository / filesystem.
A suggested layout is shown here for how to organize the metapackage / package hierarchy in groovy:
my_stack/ --> my_metapackage/
my_package_1/ --> my_package_1/
manifest.xml --> package.xml
...
my_package_n/ --> my_package_n/
manifest.xml --> package.xml
stack.xml --> my_metapackage
package.xml (Internally, a tag indicates it's a metapackage)
Originally posted by Jeremy Zoss with karma: 4976 on 2013-05-08
This answer was ACCEPTED on the original site
Post score: 7
Original comments
Comment by Ivan Rojas Jofre on 2013-05-09:
Thanks a lot for you response Jeremy, Now see clearly the new organization, as I read the documentation and I not understood very well the concept | {
"domain": "robotics.stackexchange",
"id": 14111,
"lm_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, catkin, ros-groovy, rosbuild",
"url": null
} |
newtonian-mechanics, forces, free-body-diagram, string
Each segment of the rope acts on any of the adjacent segments with the same force as the adjacent segment acts on it. Here we are looking at forces acting on different objects interacting with each other. This is Newton's 3rd law.
The weight and the rope (and thus each segment of the rope) are in a force equilibrium, so the total force on each segment exercised by both adjacent segments totals to zero. Here we are looking at the forces on one object exercised by all other objects it interacts with.
While the first point is always true, the second one doesn't have to be true, say, if the rope and the weight are in a free fall accelerating towards the earth, rather than in an equilibrium situation. Obviously, there will be no tension force in case that the second point is not given. | {
"domain": "physics.stackexchange",
"id": 46029,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "newtonian-mechanics, forces, free-body-diagram, string",
"url": null
} |
unit-testing, bash, file-system
red='\e[0;31m'
green='\e[0;32m'
nocolor='\e[0m'
echo
[[ $failure = 0 ]] && printf $green || printf $red
echo "Tests run: $total ($success success, $failure failed)"
printf $nocolor
echo
My questions:
Is this easy to read? If not, how to improve it?
Is this a good way to test stuff in Bash? Is there a better way? I'd rather not add external dependencies to the project though, I'm looking for something ultra-light, or a technique
Are there any corner cases I missed?
Any other improvement ideas? Just 2 cents:
I'd quote the right hand side of the [[ ... = ... ]] to avoid pattern interpretation. Cf.
x=123
y=*2*
[[ $x = $y ]] && echo Equal without quotes
[[ $x = "$y" ]] || echo Not equal with quotes
I like naming the tests. I'd probably add a third parameter to assertEquals and include it in the report. It also improves readability. Inspired by Test::More for Perl. | {
"domain": "codereview.stackexchange",
"id": 9962,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "unit-testing, bash, file-system",
"url": null
} |
# Proof by induction and height of a binary tree
I need some help with a simple proof. I want to know if this proof is correct:
Let's define the height of a binary tree node as:
• 0, if the node is a leaf
• 1 + the maximum height of the children
The height of the tree is the height of the root. I have to prove by induction (for the height k) that in a perfect binary tree with n nodes, the number of nodes of height k is:
$$\left\lceil \frac{n}{2^{k+1}} \right\rceil$$
Solution:
(1) The number of nodes of level c is half the number of nodes of level c+1 (the tree is a perfect binary tree).
(2) Theorem: The number of leaves in a perfect binary tree is $\frac{n+1}{2}$
Basis: For $k=0$ we have: $$\left\lceil \frac{n}{2} \right\rceil$$ Because the tree is perfect binary tree, n is odd, so:
$$\left\lceil \frac{n}{2} \right\rceil = \frac{n+1}{2}$$
That is true because of the theorem (2).
Hypothesis:
Let's suppose that the statement is true for $k = m$, let's prove it for $m+1$
We have:
$$\left\lceil \frac{n}{2^{m+2}} \right\rceil = \left\lceil \frac{\frac{n}{2^{m+1}}}{2} \right\rceil$$
The number of nodes of height $m+2$ is half the number of nodes of height $m+1$ that is true because of (1)
Is it ok? Can I use the statement (2) to prove it or is not formally correct?
-
The plural of "child" is "children"! – Olivier Bégassat Jan 15 '13 at 15:11
@OlivierBégassat sorry :P – Antonio Jan 15 '13 at 15:15 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9843363480718236,
"lm_q1q2_score": 0.8265806611683588,
"lm_q2_score": 0.8397339616560072,
"openwebmath_perplexity": 263.41340852096045,
"openwebmath_score": 0.9066044688224792,
"tags": null,
"url": "http://math.stackexchange.com/questions/279307/proof-by-induction-and-height-of-a-binary-tree"
} |
brain
Title: Does "mind" has any physical reality in biology? Or is it just an assumptive concept? Biologically, Brain controls our thinking, ideas, decisions everything along with controlling each body parts. My question is, is there anything real as "mind "? If it's controlled by brain then how does brain controls the mind? The mind is an abstraction which arises from physical and chemical processes within the brain. For a crude analogy, think of the brain as an incredibly complex, self-modifying, multithreaded program. The mind would then be the abstraction arising from the behavior of the program as it runs. Consciousness would be the abstraction arising from the behavior of one particular thread in the program: a thread which has access to a limited buffer of its own (that thread's) behavior, and control over limited input and output from the body. All of the other (unconscious) threads may affect the conscious thread, but the conscious thread has very limited access to information about the behavior of the other threads.
Since the conscious part of the mind has access to information about its own behavior, there is actually some recursive looping going on when it comes to thinking and feeling. The feeling that this goes in circles somehow (which you seem to be expressing) is a common intuition, and it's almost certainly a correct one. But the manner in which this occurs is not well-understood, and it's definitely not well-understood within biology at the macro level because the brain is unbelievably complex and plastic. We really don't have a clue how to begin modeling the brain's processes. This is one reason artificial intelligence is still extremely crude today (despite what Elon Musk and Bill Gates may try to say).
If you want to read a scientifically-inspired theory of from whence consciousness comes, and of how it arises from the brain, I would recommend the book Godel, Escher, Bach by Douglas Hofstadter. Douglas does a good job of combining computational theory with biology, music, and art to illustrate a theory of consciousness the reader can grasp even if you don't have a strong background in any of those subjects. | {
"domain": "biology.stackexchange",
"id": 3968,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "brain",
"url": null
} |
homework-and-exercises, newtonian-mechanics, rigid-body-dynamics
Title: Translational motion of a rigid body A car has a mass of 2Mg and a center of mass at G . Determine the acceleration of the car , if the rear "driving" wheels are always slipping , whereas the front wheels are free to rotate . Neglect the mass of the wheels . The coefficient of kinetic friction between the wheels and the road is 0.25 .
I want "only" to check if I understood the question.
(the rear "driving" wheels are always slipping , whereas the front wheels are free to rotate) Does it mean that the rear wheels are connected to the engine ,while the front wheels are not ?
How will neglecting the mass of the wheels simplify the problem ?
My expectation :
(Maybe neglecting the mass of the wheels means "mass moment of inertia*angular acceleration =0 , so rotation is neglected i.e treat the wheels as if they are translating , no rolling.) If the wheels were massive, they would have a non-negligible moment of inertia. In order to solve the problem, you would need to calculate the torques on each of the wheels from friction in order to get the wheels spinning. Neglecting the wheels means that all the force from friction does work towards the car's translational motion.
The front wheels being free to rotate implies that they are not being driven by the engine. This means they can roll with the road instead of slipping extremely fast like the back wheels. What this does for you is that it greatly reduces the amount of friction produced by the front wheel. When rolling, the only friction present is whatever static friction is enough to keep it from slipping, not the full $\mu_s|\overrightarrow N|$. And since you're ignoring the wheels' masses, this friction force can be assumed to be 0. | {
"domain": "physics.stackexchange",
"id": 41901,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises, newtonian-mechanics, rigid-body-dynamics",
"url": null
} |
Sum expressions involving Beta:
Generating function:
Obtain as special cases of hypergeometric functions:
Beta can be represented as a DifferenceRoot:
Possible Issues(4)
Large arguments can give results too small to be computed explicitly:
Machinenumber inputs can give highprecision results:
Algorithmically generated results often use gamma and hypergeometric rather than beta functions:
The differential equation is satisfied by a sum of incomplete beta functions:
Beta functions are typically not generated by FullSimplify:
Neat Examples(2)
Nest Beta over the complex plane:
The determinant of the × matrix of reciprocals of beta functions is :
Wolfram Research (1988), Beta, Wolfram Language function, https://reference.wolfram.com/language/ref/Beta.html (updated 2022).
Text
Wolfram Research (1988), Beta, Wolfram Language function, https://reference.wolfram.com/language/ref/Beta.html (updated 2022).
CMS
Wolfram Language. 1988. "Beta." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2022. https://reference.wolfram.com/language/ref/Beta.html.
APA
Wolfram Language. (1988). Beta. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Beta.html
BibTeX
@misc{reference.wolfram_2022_beta, author="Wolfram Research", title="{Beta}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/Beta.html}", note=[Accessed: 20-March-2023 ]}
BibLaTeX
@online{reference.wolfram_2022_beta, organization={Wolfram Research}, title={Beta}, year={2022}, url={https://reference.wolfram.com/language/ref/Beta.html}, note=[Accessed: 20-March-2023 ]} | {
"domain": "wolfram.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9883127413158322,
"lm_q1q2_score": 0.8033671227377308,
"lm_q2_score": 0.8128673133042217,
"openwebmath_perplexity": 5193.913014732933,
"openwebmath_score": 0.9502493143081665,
"tags": null,
"url": "https://reference.wolfram.com/language/ref/Beta.html"
} |
$z_k = (y_k^0,\alpha_k^0,\dots,y_k^n,\alpha_k^n) \in S^{n+1}\times \Lambda$
Since $$S^{n+1}\times \Lambda$$ is compact, $$z_k$$ has a convergent subsequence $$\{z_{k_m}\}$$. Since the map
$f\colon S^{n+1}\times \Lambda\to \operatorname{conv}(S),\qquad (y^0,\alpha^0,\dots,y^n,\alpha^n)\mapsto \sum_{i=0}^n\alpha^iy^i$
is continuous, we have that $$f(z_{k_m})=x_{k_m}$$ defines a convergent subsequence of $$\{x_k\}$$. We conclude that $$\operatorname{conv}(S)$$ is indeed compact.
## Exercise 4¶
Exercise
For $$n\in\mathbb{N}$$, $$A\in\mathbb{R}^{n \times n}$$, $$b\in\mathbb{R}^n$$ and $$c\in\mathbb{R}$$, let us consider the function $$f:\mathbb{R}^n \rightarrow \mathbb{R}$$ given by
$f(x) = \frac12 \, x^{\top} \!\! A \, x - b^{\top} \! x + c \quad\text{for all}\quad x\in\mathbb{R}^n$
and the unconstrained-optimization problem
$\tag{*} \min_{x\in\mathbb{R}^n} f(x) \, .$
### Exercise 4a)¶
Exercise
Assume that $$A$$ is indefinite. Show that the problem has no solution. | {
"domain": "readthedocs.io",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.991554374556315,
"lm_q1q2_score": 0.8174988276154662,
"lm_q2_score": 0.8244619242200082,
"openwebmath_perplexity": 163.59072629660284,
"openwebmath_score": 0.964895486831665,
"tags": null,
"url": "https://optimization-ii-2021.readthedocs.io/en/latest/nblinks/week2.html"
} |
python, python-3.x, web-scraping, selenium, instagram
@property
def name(self):
"""To avoid any errors, with regex find the url and taking the name <search_name>"""
find_name = "".join(re.findall(r"(?P<url>https?://[^\s]+)", self._search_name))
if find_name.startswith("https"):
self._search_name = urllib.parse.urlparse(find_name).path.split("/")[1]
return self._search_name
else:
return self._search_name
def __enter__(self):
return self
def check_availability(self):
search = self.http_base.get(self.url.format(name=self.name), params={"__a": 1})
search.raise_for_status()
load_and_check = search.json()
privacy = load_and_check.get("graphql").get("user").get("is_private")
followed_by_viewer = load_and_check.get("graphql").get("user").get("followed_by_viewer")
if privacy and not followed_by_viewer:
raise PrivateException("[!] Account is private")
def control(self):
"""
Create the folder name and raises an error if already exists
"""
if not os.path.exists(self.folder):
os.mkdir(self.folder)
else:
raise FileExistsError("[*] Already Exists This Folder") | {
"domain": "codereview.stackexchange",
"id": 37692,
"lm_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, web-scraping, selenium, instagram",
"url": null
} |
algorithms, complexity-theory, time-complexity
Title: Can all permutations of a set or string be generated in O(n log n) time? I was looking over this question requesting an algorithm to generate all permutations of a given string. A comment in the answer caught my eye:
It might seem that it can take O(n) time per permutation, but if you think about it more carefully, you can prove that it takes only O(n log n) time for all permutations in total, so only O(1) -- constant time -- per permutation.
This seemed strange to me because the best method I was aware of to generate all permutations of a string is in O(2^n) time. Looking through the other results, I came across a response to a similar question which states: While it technically produces the desired output, you're solving something that could be O(n lg n) in O(n^n)
I am aware of an algorithm to unrank permutations in O(n log n) time, but these responses seem to imply that all permutations in total can be generated in time O(n log n). Am I misunderstanding these responses? You have misinterpreted the SO question itself (or we have misinterpreted yours, which seems more likely). That SO quesiton is talking about generating a 'next' permutation from a previous given one, so that all permutations can be generated by calling 'next' multiple times.
The answer to that is talking about the (amortized) time complexity of the C++ implementation std::next_permutation which I believe uses Narayana Pandita's algorithm, and generates them in lexicographic order.
(Also, as an aside: permutations are different from combinations. There are $n!$ permutations, but $2^n$ combinations (subsets). You seem to be under the impression that permutation is same as a combination (based on your claim of $O(2^n)$)).
To get back to the original question, another way to look at the question: would using next_permutation to generate all the $n!$ permutations in lexicographic order be $\Theta(n!)$ or $\Theta(n\times n!)$? | {
"domain": "cs.stackexchange",
"id": 1339,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "algorithms, complexity-theory, time-complexity",
"url": null
} |
classical-mechanics, rotational-dynamics, torque
Title: Is the angular acceleration the same when calculated from the center of gravity and from a non-rotating point? I got this problem in Greiner's Classical Mechanics. The problem's statement is here.
A bar of length $2l$ and mass $M$ is fixed at point A, so that it can rotate only in the vertical plane. The external force $\vec F$ acts on the center of gravity. Calculate the reaction force $\vec F_r$ at point A!
A sketch of the given solution is the following :
First calculate the torque around A:$$\tau_A=F.l\\ \therefore \dot{\omega}=\frac {\tau_A} {I_A}=\frac{3F}{4Ml}$$
Now calculate the torque again but this time around $S$, the center of gravity:$$\tau_S=F_r.l \\ \therefore \dot{\omega}=\frac{\tau_S}{I_S}=\frac{3F_r}{Ml}$$
From these two equations of angular acceleration they conclude that :$$F_r=\frac 1 4 F$$
Now my questions are :
Why there is such a reaction force?
Why did they take the two expressions of the angular acceleration to be the same? (In the book they said that no matter what point we choose to calculate torque, these two expressions must be equal. I don't get it.)
Why did they neglect gravity?
Thank you.
If the clamp was not there, the rod would fall straight down without rotating. So, to prevent that, the clamp must be exerting a force on the rod, which they have termed $F_r$
It is the property of rigid bodies that angular velocity and acceleration of every point in the rigid body about every other point is the same. If a point in the body rotates around the COM in $t$ time, then from the frame of reference of that point, the COM will also rotate around it in $t$ time.
Gravity is not mentioned, however, $F$ seems to be analogous to gravity in this case. | {
"domain": "physics.stackexchange",
"id": 72145,
"lm_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, rotational-dynamics, torque",
"url": null
} |
ros-control
rospy.service.ServiceException: transport error completing service call: unable to receive data from sender, check sender's logs for details
[nymblebot/nymblebot_hardware_interface-8] process has died [pid 8763, exit code -11, cmd /home/rohin/catkin_ws/devel/lib/hardware/nymble_hw_control_loop __name:=nymblebot_hardware_interface __log:=/home/rohin/.ros/log/4856bd5a-41c5-11e6-b1dc-20689d39eac5/nymblebot-nymblebot_hardware_interface-8.log].
log file: /home/rohin/.ros/log/4856bd5a-41c5-11e6-b1dc-20689d39eac5/nymblebot-nymblebot_hardware_interface-8*.log
[nymblebot/ros_control_controller_manager-7] process has died [pid 8755, exit code 1, cmd /opt/ros/indigo/lib/controller_manager/controller_manager spawn joint_state_controller position_trajectory_controller __name:=ros_control_controller_manager __log:=/home/rohin/.ros/log/4856bd5a-41c5-11e6-b1dc-20689d39eac5/nymblebot-ros_control_controller_manager-7.log].
log file: /home/rohin/.ros/log/4856bd5a-41c5-11e6-b1dc-20689d39eac5/nymblebot-ros_control_controller_manager-7*.log | {
"domain": "robotics.stackexchange",
"id": 25131,
"lm_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-control",
"url": null
} |
B Prove that any Algebraic Closed Field is Infinite, Positive definite Real Symmetric Matrix and its Eigenvalues. But this matrix is not necessarily invertible, it is possible (though very unlikely) that the matrix is singular. The Cholesky Inverse block computes the inverse of the Hermitian positive definite input matrix S by performing Cholesky factorization. Conversely, some inner product yields a positive definite matrix. | {
"domain": "blog-immo.net",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9546474246069458,
"lm_q1q2_score": 0.8056222806701274,
"lm_q2_score": 0.8438950966654772,
"openwebmath_perplexity": 421.42968971301434,
"openwebmath_score": 0.777326226234436,
"tags": null,
"url": "http://www.blog-immo.net/j6hz0/ic623.php?c60b73=positive-definite-matrix-inverse"
} |
If you also want to calculate the sum of this series there's no need for anything but the series of the complex logarithm $$S(z)=-\log(1-z)=z+\frac{z^2}2+\frac{z^3}3+\cdots=\sum_{n=1}^\infty\frac{z^n}n$$ evaluated at selected roots of unity $$\neq1$$. This is fine because the series $$S(z)$$ converges when $$|z|\le1, z\neq1$$.
Assume that the sequence $$(a_n)_{n\ge1}$$ is periodic with period $$L$$. Also assume that $$a_1+a_2+\cdots+a_L=0$$. We can then write $$\sum_{n=1}^\infty\frac{a_n}n$$ as a linear combination of the series $$S(\zeta_L^k)$$, $$k=1,2,\ldots,L_1$$, with $$\zeta_L=e^{2\pi i/L}$$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9825575147530351,
"lm_q1q2_score": 0.8100812677459029,
"lm_q2_score": 0.824461932846258,
"openwebmath_perplexity": 297.88954692609025,
"openwebmath_score": 0.9926081895828247,
"tags": null,
"url": "https://math.stackexchange.com/questions/3037247/series-convergence-without-sigma-notation"
} |
cell-biology, literature, cell-signaling
Title: Specific examples of signalling pathway using logical 'OR' and 'AND'? I have read here that
"signals from two different pathways may be needed to activate a response, which is like a logical "AND." Alternatively, either of two pathways may trigger the same response, which is like a logical "OR."
But no example is mentioned. I want to know some specific examples in which cell signalling uses logical OR and Logical AND. Any references will be appreciated. There are thousands of examples, here I list just a few.
1) Macrophage activation. This is a complex case with many proteins acting as AND/OR. The following paper depicts a nice scheme that helps to understand the circuit.
https://bmcsystbiol.biomedcentral.com/articles/10.1186/1752-0509-2-36
2) The Lac operon that follows the logic:
if low_glucose AND lactose:
express(lac_genes)
if (high_glucose OR low_glucose) AND no_lacotse:
inhibit(lac_genes)
if high_glucose AND lacotse:
express_at_low_level(lac_genes)
https://en.wikipedia.org/wiki/Lac_operon
https://en.wikipedia.org/wiki/Synthetic_biological_circuit
3) Phosphorylation and ubiquitination pathways. For example,
... proteins primed through phosphorylation by one protein
kinase are often phosphorylated processively on the N-terminal side of
the priming phosphate by GSK3 at a series of Ser/Thr spaced by three
residues, with the cluster of phosphates regulating protein activity
(e.g., glycogen synthase, β-catenin). If the two sites are
phosphorylated by different protein kinases, then this can in
principle provide a logical AND gate in a downstream response. | {
"domain": "biology.stackexchange",
"id": 7567,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "cell-biology, literature, cell-signaling",
"url": null
} |
# Nature of Roots of quadratic $af(x) = (x^2+2)(a-1)$
I need help with the following.
The problem is stated like so: "The value of the constant $a$ is such that the quadratic function $f(x) \equiv x^2 +4x + a +3$ is never negative. Determine the nature of the roots of the equation $af(x) = (x^2+2)(a-1)$. Deduce the value of $a$ for which this equation has equal roots".
First statement implies that $b^2-4ac<0$, i.e. $a>1$
Now this part is strange. This is what you get (I hope) when you rewrite that second function (not sure why they call it $f(x)$ as well) :$f(x) = (a-1)x^2 + (2a-2)$. $b^2-4ac = -4(a-1)(2a-2)$, now since $a>1$ (not sure I can say this, because the functions are different; but since they denote this constant value as $a$ in both of these, I did consider it to be the same), the roots are complex because that result is negative.
It is actually not necessary to rewrite it like so, it is clear that roots are $x^2 = -2$, i.e. they are complex. However the answer is that the roots are real... I don't understand how this is possible.
I found that roots are equal when $a=1$, which is correct, according to the book.
Hint:
It seems to me that your interpretation of the second equation is wrong.
You have:
$$a f(x)=(x^2+2)(a-1) \iff a(x^2+4x+a+3)=(x^2+2)(a-1) \mbox{ with } a\ge 1$$ so you have to study the solutions of the equation $$x^2+4ax+a^2+a+2=0 \mbox{ with } a \ge 1$$
can you do this? | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.971563966131786,
"lm_q1q2_score": 0.8010175012103119,
"lm_q2_score": 0.8244619285331332,
"openwebmath_perplexity": 164.48793354404728,
"openwebmath_score": 0.9636966586112976,
"tags": null,
"url": "https://math.stackexchange.com/questions/1373692/nature-of-roots-of-quadratic-afx-x22a-1"
} |
thermodynamics
Title: Molar heat capacity of constant volume for an ideal gas under constant pressure? I'm a bit confused by this. For an ideal gas under pressure of n moles. If some amount of energy is added Q and the temperature increases dT how do you find Cv ?
Molar heat capacity for pressure i can find with Cp = Q/dT but i am trying to understand how to also find Cv so i can then determine if the gas is monatomic or diatomic with given values. Via the ratios Cp/Cv = 1 + 2/f
Hope some one can help explain this a bit as i've struggled to understand this topic at the moment. If you already have Cp, then you can easily calculate Cv using the equation Cp-Cv=R, where R is the gas constant of the particular gas you are investigating. | {
"domain": "physics.stackexchange",
"id": 56679,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "thermodynamics",
"url": null
} |
newtonian-gravity, mass, gauss-law
Somehow I think this question is connected with this question that was asked two days ago. The question asks if it's allowed to consider continuous charge distributions in Maxwell's equations. Can we consider continuous mass distributions in classical Newtonian gravity? If we consider discrete mass distributions we can imagine a surface around every mass, or collection of masses. The contribution of the outside masses to the total gravitational flux through the surface is zero. Only the masses inside the surface contribute to the total flux. The integral form of Gauss's law refers to flux (surface integral), while the differential form refers to local (point) values. On a planet in a universe with an unbounded amount of discrete masses, I will still be able to stand, i.e., there is a force of gravity. The flux through the surface surrounding the planet, due to all other masses, will be zero though. Or not?
But what if we make the distribution continuous? I won't be able to stand on the planet anymore (apart from the fact that I can't walk through a continuous mass distribution). There is zero gravity. The contribution to $\vec{g}$, on a point of the enclosing surface (of the planet, which has now become a sphere of continuous mass surrounded by an unbounded amount of continuous mass), will be the sum of two unbounded contributions: that from the unbounded mass residing in the space on one side of the tangent plane to the point, and one on the other side. They will cancel $\vec{g}$, for each point on the surface) caused by the mass inside the surface. Although the two contributions are infinite, the difference will be finite. I vaguely see a connection with an affine space (and with renormalization in quantum field theory: here infinite masses are rendered finite, but one can also keep the masses infinite and just look at mass difference; ohooooh, what I've written?). | {
"domain": "physics.stackexchange",
"id": 77157,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "newtonian-gravity, mass, gauss-law",
"url": null
} |
complexity-theory, turing-machines, np, nondeterminism
For the forward implication (there exists a verifier $V$ and we want to show this implies the existence of an NTM $N$), we can, according to Sipser, "Nondeterministically select string $c$ of length at most $n^k$. Then we run $V$ on input $(w,c)$ and accept if $V$ accepts, otherwise reject." I'm wondering if $V$ would be run as part of the algorithm on each branch of $N$. In other words, for any node in the computation tree of $N$, the verifier will be run on the that current string, and the branch will produce a YES answer only if the verifier accepts that string. Am I understanding this correctly? So it would run concurrently, and since the verifier runs in $O(n^k)$ and the NTM runs in $O(n^q)$, then this still runs in polynomial time if the verifier is run at every step in the computation.
For the backward implication, we assume $A$ is decided by a polynomial time NTM and construct a polynomial time verifier $V$. When we say that $A$ "is decided by" $N$, does this mean that $N$ is correctly able to determine if any given branch of computation results in accept or reject? This feels a bit cyclic to me, since we are trying to construct the verifier $V$ given $N$. I don't see how $N$ could decide $A$ without $N$ having a verifier constructed already. In other words, without a verifier, how would the NTM know if it should accept/reject on any of its given branches? | {
"domain": "cs.stackexchange",
"id": 11200,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "complexity-theory, turing-machines, np, nondeterminism",
"url": null
} |
ros, mavlink, px4
> * /mavros/time/timesync_avg_alpha: 0.6
> * /mavros/time/timesync_mode: MAVLINK
> * /mavros/vibration/frame_id: base_link
> * /mavros/vision_pose/tf/child_frame_id: vision_estimate
> * /mavros/vision_pose/tf/frame_id: map
> * /mavros/vision_pose/tf/listen: False
> * /mavros/vision_pose/tf/rate_limit: 10.0
> * /mavros/vision_speed/listen_twist: False
> * /rosdistro: kinetic
> * /rosversion: 1.12.12
>
> NODES
> /
> mavros (mavros/mavros_node)
>
> ROS_MASTER_URI=http://localhost:11311
>
> process[mavros-1]: started with pid [12536]
> [FATAL] [1515375213.809935923]: UAS: GeographicLib exception: File not readable /usr/share/GeographicLib/geoids/egm96-5.pgm | Run install_geographiclib_dataset.sh script in order to install Geoid Model dataset!
>
> ================================================================================
>
> REQUIRED process [mavros-1] has died!
> process has finished cleanly
> log file: /home/yograj/.ros/log/77663396-f411-11e7-b93c-3c77e68de09b/mavros-1*.log
> Initiating shutdown!
> | {
"domain": "robotics.stackexchange",
"id": 1606,
"lm_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, mavlink, px4",
"url": null
} |
Find the Jacobian of the coordinate change from spherical coordinates to Cartesian coordinates.
jacobian(R,[r,phi,theta])
ans(t) =
$\left(\begin{array}{ccc}\mathrm{cos}\left(\theta \left(t\right)\right) \mathrm{sin}\left(\varphi \left(t\right)\right)& \mathrm{cos}\left(\varphi \left(t\right)\right) \mathrm{cos}\left(\theta \left(t\right)\right) r\left(t\right)& -\mathrm{sin}\left(\varphi \left(t\right)\right) \mathrm{sin}\left(\theta \left(t\right)\right) r\left(t\right)\\ \mathrm{sin}\left(\varphi \left(t\right)\right) \mathrm{sin}\left(\theta \left(t\right)\right)& \mathrm{cos}\left(\varphi \left(t\right)\right) \mathrm{sin}\left(\theta \left(t\right)\right) r\left(t\right)& \mathrm{cos}\left(\theta \left(t\right)\right) \mathrm{sin}\left(\varphi \left(t\right)\right) r\left(t\right)\\ \mathrm{cos}\left(\varphi \left(t\right)\right)& -\mathrm{sin}\left(\varphi \left(t\right)\right) r\left(t\right)& 0\end{array}\right)$
## Input Arguments
collapse all
Scalar or vector function, specified as a symbolic expression, function, or vector. If f is a scalar, then the Jacobian matrix of f is the transposed gradient of f. | {
"domain": "mathworks.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9920620044904359,
"lm_q1q2_score": 0.8688349952246257,
"lm_q2_score": 0.8757869884059266,
"openwebmath_perplexity": 1376.553835951242,
"openwebmath_score": 0.9302873015403748,
"tags": null,
"url": "https://it.mathworks.com/help/symbolic/sym.jacobian.html"
} |
python, object-oriented, python-3.x, sqlite, selenium
for element in range(len(interpreter)):
interpreter_list.append(interpreter[element].text)
title_list.append(title[element].text)
##------------------------------------------------------------------------------
## create Token with given credentials
##
## @return authentication token
#
def getToken():
# authetication token
token = util.prompt_for_user_token(config.USERNAME, config.SCOPE, config.CLIENT_ID,
config.CLIENT_SECRET, config.REDIRECT_URI)
if token:
return token
else:
raise Exception("Could not get authentication token from spotify!")
##------------------------------------------------------------------------------
## search track and get spotify uri
##
## @param token, authentication token
## @param interpreter && title, strings containing track info
## @return uri string
#
def getUri(spotify_Obj, interpreter, title):
result = spotify_Obj.search(q=interpreter + ' ' + title)
if (result != None):
if (len(result['tracks']['items']) != 0):
track_id = result['tracks']['items'][0]['uri']
uri = str(track_id)
return uri | {
"domain": "codereview.stackexchange",
"id": 33307,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, object-oriented, python-3.x, sqlite, selenium",
"url": null
} |
ros, arduino, rosserial
You'll need to add an #elif before the #else for RKI1340_MOTOR_CONTROLLER, and add a definition of void setMotorSpeeds(int leftSpeed, int rightSpeed).
There are other changes required to support encoders different from the ones already coded. You might compare with the changes Marco Walther made to support the Pololu A-Star board with onboard motor driver. (I've contributed to his mods.)
https://github.com/mw46d/ros_arduino_bridge/tree/indigo-devel/ros_arduino_firmware/src/libraries/ROSArduinoBridge
Originally posted by Mark Rose with karma: 1563 on 2017-02-12
This answer was ACCEPTED on the original site
Post score: 1 | {
"domain": "robotics.stackexchange",
"id": 26992,
"lm_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, arduino, rosserial",
"url": null
} |
java, multithreading, android
Title: FutureTask in Android, wait for a thread to execute the next one This code is executed on a background service every 60 seconds on an Android app. Each class instantiated on FutureTask (WifiInfoFetch and WifiApResults) contains an insert to an SQLite database. We changed the original implementation (without a FutureTask) as we think the first insert was still locking the database when the second one tried to do its insert as they were executed very close to each other.
I think that with the code below, the second thread should wait until the first one is finished to start. Is this true? Also, what happens if for any reason thread 1 does not finish? Is there a way to set a timeout to interrupt it?
WifiInfo wifi = wifiManager.getConnectionInfo();
if (wifi == null) return;
WifiInfoFetch wifiInfo = new WifiInfoFetch(getApplicationContext(), wifi);
WifiApResults scanResults = new WifiApResults(getApplicationContext(), wifiManager.getScanResults());
FutureTask<String> futureWifiInfo = new FutureTask<>(wifiInfo);
FutureTask<String> futureScanResults = new FutureTask<>(scanResults);
ExecutorService executor = Executors.newFixedThreadPool(2);
try {
executor.submit(futureWifiInfo).get();
executor.submit(futureScanResults);
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
} | {
"domain": "codereview.stackexchange",
"id": 24027,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, multithreading, android",
"url": null
} |
condensed-matter, many-body, topological-insulators, quantum-hall-effect
From the momentum-dependent Hall conductivity one can restore the explicit position dependence by Fourier transform $$\sigma_{xy}(\boldsymbol{r}-\boldsymbol{r}')=\sum_{\boldsymbol{q}}\sigma_{xy}(\boldsymbol{q}) e^{\mathrm{i}\boldsymbol{q}\cdot(\boldsymbol{r}-\boldsymbol{r}')}.$$
The uniform conductivity is defined as $\sigma_{xy}=\int d^2\boldsymbol{r}' \sigma_{xy}(\boldsymbol{r}-\boldsymbol{r}')$ which picks out the zero momentum component $\sigma_{xy}(\boldsymbol{q}=0)$. TKNN's paper mainly focus on the uniform Hall conductance and its topological significance. But the generalization of the Kubo formula to the non-uniform (inhomogeneous) case is straight forward as described above. However for a generic momentum $\boldsymbol{q}\neq0$, the Hall conductance $\sigma_{xy}(\boldsymbol{q})$ is no longer quantized to an integer and is no longer related to the topological index (Chern number) of the electronic band structure, for this reason, $\sigma_{xy}(\boldsymbol{q})$ is less investigated. But experimentally $\sigma_{xy}(\boldsymbol{q})$ is definite a quantity that can be measured as well. | {
"domain": "physics.stackexchange",
"id": 40027,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "condensed-matter, many-body, topological-insulators, quantum-hall-effect",
"url": null
} |
ros, c++, opencv
It keeps outputting "can i see you?" i it looks like it keeps looping the same statement, again and again.. how do i fix it..
Originally posted by 215 on ROS Answers with karma: 156 on 2015-03-25
Post score: 0
I choose to remove the waitKey(1) != 'y' solution and use this one instead
http://answers.ros.org/question/63491/keyboard-key-pressed/
Originally posted by 215 with karma: 156 on 2015-04-01
This answer was ACCEPTED on the original site
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 21234,
"lm_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++, opencv",
"url": null
} |
quantum-mechanics, quantum-information, quantum-computer
One might also suggest using a very large number of internal states of a given entity, but then the control problem becomes insuperable. It is a very important property of quantum states that if one has a collection of $n$ qubits stored in $n$ separate systems then the sensitivity to noise scales only in proportion to $n$ or possibly $n^2$, whereas if one tries to use $2^n$ states of a single thing (e.g. internal energy levels) then the sensitivity to noise scales as $2^n$. This is one of the wonderful features of entanglement and lies close to the heart of why quantum computing is powerful. | {
"domain": "physics.stackexchange",
"id": 66109,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, quantum-information, quantum-computer",
"url": null
} |
4. ### statistics
1. Express the indicated degree of likelihood as a probability value. "There is a 40% chance of rain." 2. Find the indicated probability A bag contain 6 red marbles, 3 blue marbles, and 7 green marbles. If a marble is randomly
1. ### Probability!
A bag contains 5 green marbles , 8 red marbles, 11 orange marbles, 7 brown marbles, and 12 blue marbles. You choose a marbles, replace it, and choose again. what is p(red then blue) 20/43 40/43 20/1849 96/1849
2. ### Math
A bag contains 9 red marbles, 8 white marbles, and 6 blue marbles. You draw 4 marbles out at random, without replacement. What is the probability that all the marbles are red? 1 The probability that all the marbles are red is...?
3. ### Math
Tom keeps all of his favorite marbles in a special leather bag. Right now, five red marbles, four blue marbles, and yellow marbles are in the bag. If he randomly chooses one marble to give to a friend what is the probability that
4. ### math
The diagram below shows the contents of a jar from which you select marbles at random. There are 4 red marbles, 7 blue marbles, and 5 green marbles. (A). What is the probability of selecting a red marble, replacing it, and then | {
"domain": "jiskha.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9678992914310605,
"lm_q1q2_score": 0.8001737617649107,
"lm_q2_score": 0.8267117962054049,
"openwebmath_perplexity": 532.5593102383618,
"openwebmath_score": 0.8323330283164978,
"tags": null,
"url": "https://www.jiskha.com/questions/102504/you-have-8-blue-marbles-7-red-marbles-and-5-green-marbles-what-is-the-probability-of"
} |
Also see the entry on numbers that follows:
$(2)$ Number (Encyclopedia of Mathematics)
In particular, scroll down the entry, until you find the following passages:
"Throughout the 19th century, and into the early 20th century, deep changes were taking place in mathematics. Conceptions about the objects and the aims of mathematics were changing. The axiomatic method of constructing mathematics on set-theoretic foundations was gradually taking shape. In this context, every mathematical theory is the study of some algebraic system. In other words, it is the study of a set with distinguished relations, in particular algebraic operations, satisfying some predetermined conditions, or axioms.
From this point of view every number system is an algebraic system. For the definition of concrete number systems it is convenient to use the notion of an "extension of an algebraic system" . This notion makes precise in a natural way the principle of permanence of formal computing laws, which was formulated above..."
You can read then how the numbers, along with appropriate operations and elements like an additive identity (and/or multiplicative identity), etc, comprise algebraic systems and extensions of algebraic systems, with "axioms" related to each system/extended from predecessor systems.
To get to $\mathbb{Z}$, introduce a formal additive inverse for each $n \in \mathbb {N}$ and deduce properties they should obey. Then, consider formal expressions of the form $p/q$ where $p,q \in \mathbb{Z}$. Specifically, look at equivalence classes under the relation $p/q \cong n/m$ if $pn = qm$. – orlandpm Dec 24 '12 at 22:25 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.960361162033533,
"lm_q1q2_score": 0.8237671705717795,
"lm_q2_score": 0.8577681013541611,
"openwebmath_perplexity": 410.35509159054885,
"openwebmath_score": 0.8576375842094421,
"tags": null,
"url": "http://math.stackexchange.com/questions/264753/defining-the-integers-and-rationals/264782"
} |
electrostatics, electric-fields, potential, potential-energy
In the image above, if I change the position of Q1 but keep r1 the same (or rotate Q1 around the point), the electric field at that point will change since the vector sum change, but how can the electric potential keeps the same, it makes no sense. The electric field E is not just a vector field, but it's a conservative vector field (at least in the statics case, and after a straightforward modification for magnetic effects, in the dynamics case as well).
Because the field is conservative, a line integral from a reference point to a test point produces a unique scalar, regardless of the path of that integral. This is the work that is done taking a unit charge between those two points.
Conversely, and equivalently, the electric field can be obtained as the gradient of the potential.
The potential finds use because it's so much easier to work with sums of scalar fields than vector fields. In an electrostatics problem, it's much easier to place charges around, sum the potentials, and differentiate to find the electric field. In particular, a mirror symmetric arrangement of opposite charges results in a zero potential along the plane of symmetry. This construction is frequently used to model ground planes, which of course have zero voltage on them.
How does the electric potential staying the same make sense under charge movement? Making sense is just a luxury, few people understand stuff, you just get used to how things behave. The total energy of the test charge is the sum of the component energies due to its interaction with each point charge. That's the way energy adds up. If you move a point charge to keep the same distance from the test charge, that energy component stays the same, and with it, the total potential. It's what happens.
Electric potential's existence, uniqueness and scalar form can be explained by the fact that the E field is conservative. Why the E field is conservative should be the subject of a separate question. | {
"domain": "physics.stackexchange",
"id": 44196,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electrostatics, electric-fields, potential, potential-energy",
"url": null
} |
optics, waves, spherical-harmonics
$$\dfrac{\partial^2}{\partial{r}^2}(r \psi) = \dfrac{1}{v^2} \dfrac{\partial^2}{\partial{t}^2} (r \psi) \tag{2.71}$$
Notice that this expression is now just the one-dimensional differential wave equation, Eq. (2.11), where the space variable is $r$ and the wavefunction is the product $(r \psi)$. The solution of Eq. (2.71) is then simply
$$r \psi(r, t) = f(r - vt)$$
or $$\psi(r, t) = \dfrac{f(r - vt)}{r} \tag{2.72}$$
This represents a spherical wave progressing radially outward from the origin, at a constant speed $v$, and having an arbitrary functional form $f$. Another solution is given by
$$\psi(r, t) = \dfrac{g(r + vt)}{r}$$
and in this case the wave is converging toward the origin. The fact that this expression blows up at $r = 0$ is of little practical concern.
A special case of the general solution
$$\psi(r, t) = C_1\dfrac{f(r - vt)}{r} + C_2 \dfrac{g(r + vt)}{r} \tag{2.73}$$
is the harmonic spherical wave
$$\psi(r, t) = \left( \dfrac{\mathcal{A}}{r} \right) \cos k(r \mp vt) \tag{2.74}$$
or $$\psi(r, t) = \left( \dfrac{\mathcal{A}}{r} \right) e^{ik(r \mp vt)} \tag{2.75}$$
wherein the constant $\mathcal{A}$ is called the source strength. | {
"domain": "physics.stackexchange",
"id": 97818,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "optics, waves, spherical-harmonics",
"url": null
} |
c++, statistics, machine-learning
int threshold(T value)
{
if (value < 0) return 0;
else return 1;
}
};
This code passed all the unit-tests from the Hacker-rank for some of the statistics exercises.
Most of the ML libraries available in C++ are without documentation so it is hard to understand and implement. So I took this initiative. The main aim is to make is very easy for the end user like scikit-learn does. It is single header so it is easier to be Incorporated in existing projects.
License: Apache 2.0
Documentation: https://github.com/VISWESWARAN1998/statx Wrapper classes
I don't get why many algorithms (like get_mean, get_median, ...) are wrapped inside a class that is basically just a fancy namespace.
Why force the user to write mean{}.get_mean(...) if mean(...) would suffice?
Repetition
In many functions, there is a repeating pattern: The function takes a bool sorted parameter, and the first statement is if(!sorted) std::sort(...);.
First, such boolean flags usually smell. Often the corresponding function might do two different things, and might be better off being split into multiple specialized functions.
Second, in many cases it isn't actually necessary to fully sort the std::vector (\$\mathcal{O}(n \log n)\$): There might be alternatives (like std::nth_element, \$\mathcal{O}(n)\$) that can do the intended job and have better performance.
Last, why pass explicitly std::vector<T>? Not only does this force a copy of all the underlying data, many of those algorithms are general enough so that they should work on other data structures, too! Taking a pair of iterators also means that they can be applied to parts of containers (e.g. simplifying the quartile calculation).
For example, fixing these issues on median::get_medain
template<typename Iter>
auto median_of_sorted(Iter begin, Iter end) {
auto size = std::distance(begin, end); | {
"domain": "codereview.stackexchange",
"id": 31268,
"lm_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++, statistics, machine-learning",
"url": null
} |
Let ${\Omega^p}$ be the sheaf of holomorphic ${p}$-forms on ${X}$. We’d like to compute ${H^r(X, \Omega^p)}$. Let ${T=Hom(V, \mathbb{C})}$, i.e. the (complex) cotangent space at the identity to ${X}$. As with vectors and vector fields, every ${p}$-covector, i.e. element of ${\bigwedge^pT}$ can be extended uniquely to a left invariant ${p}$-form by pulling back along the left multiplication by ${-x}$ map. We’ll denote the correspondence ${\alpha\mapsto \omega_\alpha}$. This map defines an isomorphism of sheaves ${\mathcal{O}_X\otimes_\mathbb{C} \bigwedge^pT\stackrel{\sim}{\rightarrow} \Omega^p}$.
This says that ${\Omega^p}$ is a free sheaf of ${\mathcal{O}_X}$-modules. Now take global sections to get that ${\Gamma(X, \Omega^p)\simeq \Gamma(X, \mathcal{O}_X\otimes \bigwedge^pT)\simeq \bigwedge^pT}$, since the global sections of ${\mathcal{O}_X}$ are constants. Thus the only global sections of ${\Omega^p}$ are the ${p}$-forms that are invariant under left translation. Thus this isomorphism reduces our calculation to ${H^r(X, \Omega^p)\simeq H^r(X, \mathcal{O}_X)\otimes_\mathbb{C} \bigwedge^pT}$. So we’ll start in on that next time.
# Complex Lie Group Properties | {
"domain": "wordpress.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9783846678676151,
"lm_q1q2_score": 0.842915773150305,
"lm_q2_score": 0.8615382076534743,
"openwebmath_perplexity": 120.88430050501222,
"openwebmath_score": 0.9643252491950989,
"tags": null,
"url": "https://hilbertthm90.wordpress.com/category/math/manifolds/page/2/"
} |
entomology, physiology, bio-mechanics, morphology
Title: Why do wasps have "wasp waists"? What's been optimized? I photographed these (unidentified) wasps on a sunny but cool winter day in northern Taiwan because they were conspicuously hanging out on a hand railing and had much lighter coloring than I'd ever seen before.
But after I took the time to look at a close-up I realized "Wow, they really have long, very thin waists!" Mechanically, it looks like they are two large masses connected by a very long thin beam, which must have quite a tiny canal in the center to let all the "juices" flow through.
While other insects and spiders may have segments separated by a tiny connection, this one is both small in diameter and quite long.
Why? Does this specific configuration provide some benefits to them?
click for full size Why do humans have such a flexible shoulder? Our ancestors relied on throwing things so the ones who could throw things better did better. What is the wasp's equivalent weapon? The stinger. Wasps have such thin "waists" to facilitate maneuverability of the stinger. This is especially important in wasps because for many, and for the ancestors who first evolved this feature, a flexible thorax with an ovipositor capable of depositing eggs into grubs and caterpillars was fundamental to their reproduction. The path to their current form seems to have been as follows: 1) early stingless wasps develop an ovipositor and begin implanting their eggs into other insects, 2) the thorax evolves to be thin and flexible to facilitate this method of reproduction, 3) the ovipositor modifies into a stinger and, combined with that flexible thorax, the wasp becomes the Zorro of the skies.
See New Scientist's 20 November 2019 Hourglass figure: Why do wasps have such narrow waists? | {
"domain": "biology.stackexchange",
"id": 12422,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "entomology, physiology, bio-mechanics, morphology",
"url": null
} |
javascript, jquery, plugin
//check if is live
$('.styled-input:checked').each(function() {
$(this).siblings('.input-replacement').addClass('selected');
});
//handlers
$('body').on('change', '.styled-input', function() {//set default action, override if already one exists
var group = $this.attr('name');
var $cur = $(this);
$('input[name="' + group + '"]').each(function() {
$cur.siblings('.input-replacement').toggleClass('selected', $cur.is(':checked'));
});
})
.on('click', '.label-replacement', function() {
$this.prevAll('.input-container').children('.styled-input').prop('checked', 'checked').trigger('change');
});
});
}; | {
"domain": "codereview.stackexchange",
"id": 5909,
"lm_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, plugin",
"url": null
} |
parity, weak-interaction
Title: Why does parity violation in weak decay imply decay asymmetry? I googled the sentence in the title of this question and found the famous experiment by
Wu et al demonstrating that electrons in weak decay are emitted ``in the direction of motion of a left-handed screw rotating with the nuclear spin''.
This show that: asymmetry in decay -> parity violation.
How to prove the opposite? (parity violation -> asymmetry ?) Dear Pie86, the emission of particles in a weak decay is a complicated reaction, and Gell-Mann's totalitarian principle applies: every process or effect that is not prohibited by a symmetry will occur at a nonzero probability. The asymmetry or the spin-momentum correlation for the electrons is such an effect.
In this case, it is infinitely unlikely that the asymmetry will be exactly zero unless the symmetry is implied by a valid symmetry. Because parity is not a valid symmetry, there's no reason for the asymmetry - the correlation between the spin and direction of the electron, among other similar correlation coefficients - to be exactly zero, so it will probably not be exactly zero.
For the particular case of the beta decay, one may calculate the corresponding probability amplitude and the asymmetry - or correlation coefficients - out of it. If the Lagrangian has the $(a+b\gamma_5)$ matrix to guarantee an asymmetry, the asymmetry of the particular decay - or the spin-momentum correlation coefficient - will be proportional to something like $ab$ or $(a^2+b^2)$ times something. More generally, it will be a function of $a,b$ that is manifestly nonzero if both $a,b$ are nonzero. And in weak interactions, they are nonzero; in fact, weak interactions are maximally parity violating so $a=\pm b$. | {
"domain": "physics.stackexchange",
"id": 862,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "parity, weak-interaction",
"url": null
} |
c++, image, template, c++20, constrained-templates
template<std::size_t unwrap_level, std::copy_constructible F, typename T1, typename... Ts>
using recursive_variadic_invoke_result_t = typename recursive_variadic_invoke_result<unwrap_level, F, T1, Ts...>::type;
template<typename OutputIt, std::copy_constructible NAryOperation, typename InputIt, typename... InputIts>
OutputIt transform(OutputIt d_first, NAryOperation op, InputIt first, InputIt last, InputIts... rest) {
while (first != last) {
*d_first++ = op(*first++, (*rest++)...);
}
return d_first;
} | {
"domain": "codereview.stackexchange",
"id": 45263,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, image, template, c++20, constrained-templates",
"url": null
} |
to Homework 2. Lesson 3 Homework Practice Surface Area Of Rectangular Prisms Answers DOWNLOAD (Mirror #1). 2 Math 372: Homework #2: Solutions by Nick Arnosti and Thomas Crawford (2010) 8 3 Math 372: Homework #3: Carlos Dominguez, Carson Eisenach, David Gold 12 4 Math 372: Homework #4: Due Friday, October 12, 2015: Pham, Jensen, Kolo˘glu 16. Such as in oran and then review it, positive stimuli. Real analysis homework solutions narayan. Solutions #5 Assignment #6, due September 28. ) 23: Harmonic oscillator : 24: Completeness of Hermite basis : 25: The fourier transform on the line : 26: Hahn-Banach and review. 1, we have ab ≤ |ab| = |a|·|b|, where we used Exercise 1. Homework 7 Real Analysis Joshua Ruiter March 23, 2018 Proposition 0. What's 2 + 3? You could probably answer that instantly, without having to think about it. (4p) Let X;Y be bounded sets of positive real numbers. 10/08: Homework 0 Solutions have. The projects were harder than homework, and broken down into several parts and you proved "real math things". Basic Analysis: Introduction to Real Analysis, by Jiří Lebl Homework In general, there will be weekly homework posted on the course web page, which will be due in each Friday of class. 11/01: exam2013-solution, exam2014-solution, exam2015-solution, exam2016-solution have been posted! 10/17: Homework 1 Solutions have been posted! 10/14: Homework 2 is out! It's due on Thursday, 11/1, 11pm. Assignment 2, due Friday Sept. page 14: Homework and. Also, see Rudin's "Functional Analysis. More Geometry Lessons Videos, examples, solutions, worksheets, games and activities to help Geometry students learn how to use two column proofs. Math 3210 - Foundations of Analysis Spring 2018 Notes for the final exam. txt) or read online for free. I especially recommend reading through §2. Topics covered in the course will include, The Logic of Mathematical Proofs, Construction and Topology of the Real Line, Continuous Functions, Differential Calculus, Integral Calculus, Sequences and Series of Functions. Lecture Notes: Nov 8 and Nov 11, | {
"domain": "otticamuti.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9835969689263264,
"lm_q1q2_score": 0.8455626628338275,
"lm_q2_score": 0.8596637541053281,
"openwebmath_perplexity": 1898.2495045200533,
"openwebmath_score": 0.4321664273738861,
"tags": null,
"url": "http://nnue.otticamuti.it/real-analysis-homework-solutions.html"
} |
python, game, python-2.x
v = [8,15,3,7]
n = len(v)
print optimal_strategy(0,n-1,v)
optimal_strategy_game(v) 1. Review
It's usually more convenient to return a result rather than printing it. Then you can use the result in other computations, for example test cases.
It's not clear what the meaning of the table t is. It would be helpful to have a comment. I think that if \$i ≤ j\$ then t[i][j] gets filled in with the maximum money obtainable by a player who starts with the coins \$v_i, \dots, v_j\$.
There is some trouble in handling edge cases — you need to avoid an invalid lookup in the table t so instead of writing t[i+1][j-1] you have to write:
0 if i+1 > j-1 else t[i+1][j-1]
to avoid trouble in the cases i+1 == n and j == 0. What this suggests is that t would be better implemented as a mapping from pair (i, j) to money, using collections.defaultdict:
from collections import defaultdict
t = defaultdict(int) # Map from (i,j) to max money on v[i:j+1].
Then you could look up any pair and it would default to zero even if it was out of bounds, like this:
x = t[i + 1, j - 1]
y = t[i + 2, j]
z = t[i, j - 2]
t[i, j] = max(v[i] + min(x, y), v[j] + min(x, z))
In this code:
for gap in xrange(n):
for i in xrange(n):
j = i + gap
if j<n:
you could avoid the test j<n by iterating only over valid values of i:
for gap in xrange(n):
for i in xrange(n - gap):
j = i + gap | {
"domain": "codereview.stackexchange",
"id": 25324,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, game, python-2.x",
"url": null
} |
ros, ros2, network
Title: How to specify the network interface ros2 uses for communication?
When I launch my node, after installing a docker image, I get following warning, luckily it arbitrarily selects the right interface, but how can I specify it to get rid of the warning?
[od-1] 1614701696.982410 [0] od: using network interface eno1 (udp/192.168.254.20) selected arbitrarily from: eno1, docker0, br-ab6309382a59, tun0
I'm using Ros2 build from source master and ros2 branches.
I found: https://answers.ros.org/question/299940/explicitly-constraining-which-network-interfaces-are-used-in-ros2/
and I was wondering if this applies in my case? I didn't find much information and before reading the extensive fast dds api to figure out how to set it, I ask here to make sure, this would even be a solution to my problem and if there is a new(set it directly by ros2) way to specify the network instead of going and fiddling with the default implementation. | {
"domain": "robotics.stackexchange",
"id": 38950,
"lm_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, network",
"url": null
} |
reference-request, communication-complexity
The protocol is correct by the Chernoff–Hoeffding bounds: if $X_i$ denotes the indicator random variable of the event $a_i\in B$, then $X_i$, $i<t$, are i.i.d. variables with mean $p=c/a$. Thus,
$$\Pr\left[a\overline X\le c-d\right]=\Pr\left[\overline X\le p-\tfrac da\right]\le\exp\left(-2\left(\tfrac da\right)^2t\right)\le\frac\epsilon2,$$
and similarly for $\Pr\bigl[a\overline X\ge c+d\bigr]$.
Now, these bounds are somewhat wasteful if $c\ll a$: there are also variant Chernoff bounds stating
$$\begin{align}
\Pr\left[\overline X\le p-\delta\right]&\le\exp\left(-\frac{\delta^2}{2p}t\right),\\
\Pr\left[\overline X\ge p+\delta\right]&\le\exp\left(-\frac{\delta^2}{3p}t\right),\qquad\delta\le p,
\end{align}$$
which would allow us to get by with the number of samples $t$ smaller by a factor of roughly $p$. The problem is that $p=c/a$ is the very quantity we want to approximate, hence we do not know it ahead. This can be remedied by making first a ball-park estimate of $c$. | {
"domain": "cstheory.stackexchange",
"id": 4383,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "reference-request, communication-complexity",
"url": null
} |
c, octree
Here is a test that proves that deletion and insertion work (this is command line I/O while using the test code):
s 31 31 31 1
s 15 15 15 2
s 3 3 3 4
s 1 1 1 5
d
32768
32769 0 0 0 0 0 0 32777
32769 0 0 0 0 0 0 32773
32769 0 0 0 0 0 0 0
32769 0 0 0 0 0 0 32770
0 0 0 0 0 0 0 5
0 0 0 0 0 0 0 4
0 0 0 0 0 0 0 32769
0 0 0 0 0 0 0 32769
0 0 0 0 0 0 0 2
0 0 0 0 0 0 0 32769
0 0 0 0 0 0 0 32769
0 0 0 0 0 0 0 32769
0 0 0 0 0 0 0 1
s 1 1 1
d
32768
32769 0 0 0 0 0 0 32776
32769 0 0 0 0 0 0 32772
32769 0 0 0 0 0 0 0
0 0 0 0 0 0 0 32769
0 0 0 0 0 0 0 4
0 0 0 0 0 0 0 32769
0 0 0 0 0 0 0 32769
0 0 0 0 0 0 0 2
0 0 0 0 0 0 0 32769
0 0 0 0 0 0 0 32769
0 0 0 0 0 0 0 32769
0 0 0 0 0 0 0 1
s 1 1 1 5
d
32768
32769 0 0 0 0 0 0 32777
32769 0 0 0 0 0 0 32773
32769 0 0 0 0 0 0 0
32769 0 0 0 0 0 0 32770
0 0 0 0 0 0 0 5
0 0 0 0 0 0 0 4
0 0 0 0 0 0 0 32769
0 0 0 0 0 0 0 32769
0 0 0 0 0 0 0 2
0 0 0 0 0 0 0 32769
0 0 0 0 0 0 0 32769
0 0 0 0 0 0 0 32769
0 0 0 0 0 0 0 1
s 31 31 31
d
32768
32769 0 0 0 0 0 0 0
32769 0 0 0 0 0 0 32773
32769 0 0 0 0 0 0 0
32769 0 0 0 0 0 0 32770
0 0 0 0 0 0 0 5 | {
"domain": "codereview.stackexchange",
"id": 45034,
"lm_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, octree",
"url": null
} |
field-theory, mathematical-physics, lie-algebra, chirality, sigma-models
$$L=\frac{F^{2}}{4} \rm{Tr}(\partial_{\mu}U^{\dagger}\partial^{\mu}U)= \frac{F^{2}}{4} \rm{Tr}(\partial_{\mu}U^{\dagger}U ~~ U^\dagger\partial^{\mu}U)
,$$
where the $\phi$s are Hermitean matrices!
But there is celebrated systematics in the operator exponential derivatives, to $O(\phi^3)$,
$$
U^\dagger\partial U = \frac{i}{F} \partial \phi + \frac{1}{2F^2} [\phi, \partial \phi]- \frac{i}{6F^3}[\phi, [\phi ,\partial \phi ]] +... ~~~\implies \\
\partial U^\dagger ~ U = - \frac{i}{F} \partial \phi - \frac{1}{2F^2} [\phi, \partial \phi]+ \frac{i}{6F^3}[\phi, [\phi ,\partial \phi ]] +... .
$$
The are each in the Lie Algebra!
Plug these inside the trace, and use its cyclicity to rearrange the commutators.
The quartic term you are seeking comes from the linear times cubic terms, and, of course, the squared quadratic ones,
$$
\frac{F^{2}}{4} \frac{1}{F^4}(1/3-1/4)\rm{Tr} ([\phi,\partial_{\mu}\phi][\phi,\partial^{\mu}\phi]) \\
=\frac{1}{48 F^2} \rm{Tr}([\phi,\partial_{\mu}\phi][\phi,\partial^{\mu}\phi]).$$
Note the surviving quadratic/kinetic term, and the vanishing of the cubic one. | {
"domain": "physics.stackexchange",
"id": 88384,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "field-theory, mathematical-physics, lie-algebra, chirality, sigma-models",
"url": null
} |
javascript, jquery, image
$.fn.thumbnailsCarousel = function(options) {
conf = $.extend(conf, options);
init();
bindUiActions();
return this;
}
})(window, jQuery);
// Kick it
$('.thumbnails-carousel').thumbnailsCarousel({});
Additionally, you can pass center (default: true) and backgroundControl (default: false) if you want (or no) to center your thumbnails or backgroundControl if you want (or no) controls background which is activated on hover in bootstrap carousel.
The only thing worse than missing alt text is bad alt text. 1_tn.jpg is meaningless. Instead, use empty alt text.
Your CSS looks okay. I'll note you can use padding: 5px 0 0;, with padding-left being automatically filled in.
You never use window in your plugin, so you don't need to pass it.
conf is shared across all instances of the plugin. Normally this is fine... but you're mutating conf, instead of using a separate variable to hold the defaults. This means that code like the below won't work as expected:
$(".thumbnails-carousel.not-centered").thumbnailsCarousel({ center: false });
// no need to specify because it's centered by default
$(".thumbnails-carousel.centered").thumbnailsCarousel();
Similarly, you are using a global shared "cache" which apparently holds a jQuery object created from a hard-coded string. In doing so, I am no longer able to:
dynamically generate the carousel
give the carousel my own class name
use more than one carousel in a non-buggy way | {
"domain": "codereview.stackexchange",
"id": 9543,
"lm_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, image",
"url": null
} |
game-of-life, batch
::::::::::::::::::::
:: Generate grid 'A'. This grid holds the cell layout for display
:: Also for safety, delete any grid 'B' cells that might be in memory
:: Grid 'B' used to store temporary cell values before they are assigned to grid 'A'
FOR /L %%h IN (1, 1, %HEIGHT%) DO (
FOR /L %%w IN (1, 1, %WIDTH%) DO (
SET /A RAND=!RANDOM!*100/32768
IF !DENSITY! GEQ !RAND! (
SET A[%%w][%%h]=@
SET /A ALIVECOUNT=!ALIVECOUNT!+1
) ELSE (
SET "A[%%w][%%h]= "
)
SET B[%%w][%%h]=
)
)
::::::::::::::::::::::::::::::
:: TOP OF MAIN PROCESSING LOOP
::
:: Display grid 'A'
:: Loop through all the Grid 'A' cells:
:: - Get values neighbouring cells
:: - Get count of alive neighbours
:: - Apply 'Game of Life' rules and store resulting value in grid 'b' cell
:: Assign grid 'b' cell values to grid 'a' cell values
:: Loop back to start process again
:PROCESS
SET /A GENERATION=%GENERATION%+1
CLS
ECHO Conway's Game of Life.
ECHO Generation: %GENERATION%
ECHO Live Cells: %ALIVECOUNT%/%CELLCOUNT%
CALL :DISPLAY
IF "%ALIVECOUNT%"=="0" (GOTO EOF)
SET ALIVECOUNT=0
SET COUNTER=0
FOR /L %%h IN (1, 1, %HEIGHT%) DO (
FOR /L %%w IN (1, 1, %WIDTH%) DO (
SET /A COUNTER=!COUNTER!+1
TITLE Calculating Cell !COUNTER!/%CELLCOUNT%
SET X=0
SET Y=0
SET NCOUNT=0 | {
"domain": "codereview.stackexchange",
"id": 38343,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "game-of-life, batch",
"url": null
} |
c#, .net
Title: Simple change tracker for POCOs Problem
I have a list of POCO model objects (approximatly 1.000 to 10.000) and I want to track changes on them:
Check if at least one of the items has changed (to show the user that something changed)
Get all new, deleted and modified objects to update the state in the database
For the first version, it is enough to support POCOs with primitive property types. However, probably I'll extend it in future to support complex property types.
Solution
public class ChangeTracker<TEntity> where TEntity : class
{
private static readonly PropertyInfo[] thePropertyInfos;
private readonly List<TEntity> myEntities = new List<TEntity>();
private readonly List<TEntity> myDeletedEntites = new List<TEntity>();
private readonly HashSet<TEntity> myNewEntities = new HashSet<TEntity>();
private readonly Dictionary<TEntity, object[]> myStates = new Dictionary<TEntity, object[]>();
static ChangeTracker()
{
thePropertyInfos = typeof(TEntity).GetProperties().ToArray();
}
public void Add(TEntity entity)
{
if (myStates.ContainsKey(entity))
throw new InvalidOperationException("It is not possible to add an entity twice.");
myStates.Add(entity, new object[thePropertyInfos.Length]);
myNewEntities.Add(entity);
myEntities.Add(entity);
}
public void Delete(TEntity entity)
{
myEntities.Remove(entity);
if (!myNewEntities.Remove(entity))
myDeletedEntites.Add(entity);
}
public void AcceptChanges()
{
myNewEntities.Clear();
myDeletedEntites.Clear();
foreach (var entity in myEntities)
myStates[entity] = GetState(entity);
}
public bool HasChanges()
{
return GetEntities(EntityStates.Deleted
| EntityStates.Modified
| EntityStates.New)
.Any();
} | {
"domain": "codereview.stackexchange",
"id": 29190,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, .net",
"url": null
} |
Columns $2$ through $p$ of the grid contain $\sum_{k=1}^{p-1} k = \binom{p}{2}$ cells, and the remaining $q+1-p$ columns contain $p(q+1-p)$ cells, so \begin{align*}\vert S \vert &= \binom{p}{2} + p(q+1-p)\\ &= \frac{p^2 - p}{2} + pq + p - p^2\\ &= pq - \frac{p^2-p}{2}\\&= pq - \binom{p}{2}. \end{align*} | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9850429147241161,
"lm_q1q2_score": 0.8504777793806565,
"lm_q2_score": 0.8633916011860786,
"openwebmath_perplexity": 419.65787484266326,
"openwebmath_score": 0.9914413690567017,
"tags": null,
"url": "http://math.stackexchange.com/questions/60973/finding-the-minimum-number-of-students"
} |
How do I separate the summand of a double summation?
For example, if I have:
$$\sum_{i=1}^n \sum_{j=1}^n (x_i^2 - 2x_ix_j + x_j^2)$$
How would I separate these terms?
Unfortunately, we've dived into proofs using summation without much background information on how it works.
My best (but I think incorrect) guess is:
$$\sum_{i=1}^n \sum_{j=1}^n x_i^2 - \sum_{i=1}^n \sum_{j=1}^n 2x_ix_j + \sum_{i=1}^n \sum_{j=1}^n x_j^2$$
Any help is much appreciated. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9927672361965209,
"lm_q1q2_score": 0.8069880450246497,
"lm_q2_score": 0.8128673223709252,
"openwebmath_perplexity": 154.6948009987673,
"openwebmath_score": 0.9556224942207336,
"tags": null,
"url": "https://math.stackexchange.com/questions/921817/how-do-i-separate-the-summand-of-a-double-summation"
} |
javascript, html, game-of-life
["","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],
["","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],
["","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],
["","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],
["","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""], | {
"domain": "codereview.stackexchange",
"id": 5581,
"lm_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, game-of-life",
"url": null
} |
Hint:
$a_n=2^n+1 \quad \Rightarrow \quad a_0=2$ and: $a_{n-1}=2^{n-1}+1$ So: $$2a_{n-1}-1=2\cdot 2^{n-1}+2-1=2^n+1=a_n$$
• Thank you. I have a question. Am I allowed to rewrite the question like this: Given that $a_{n+1} = 2a_{(n+1)-1} -1 = 2a_{n} - 1$ and $a_{0} = 2$ then $a_{n} = 2^{n}+1$? Is this the same question as the question in my first post? Oct 6 '16 at 14:41
• yes, with $n$ starting from $0$ it is the same. Oct 6 '16 at 14:56
Rewrite second sequence as:
$a_n=2(2^{n-1}+1)-1=2a_{n-1}-1$
and check if first terms are equal (they are).
General case:
$$a_n=2a_{n-1}-1$$
\begin{align} & =2(2a_{n-2}-1)-1 \\ & =4a_{n-2}-3 \\ & =4(2a_{n-3}-1)-3 \\ & =8a_{n-3}-7 \\ & =16a_{n-4}-15 \\ & \qquad\vdots \\ & =2^na_0-2^n+1?\tag{assumptions} \\ & =2^n(a_0-1)+1 \end{align}
We want to prove our assumed general form with induction:
$$a_n=2^n(a_0-1)+1=2(2^{n-1}(a_0-1)+1)-1=2a_{n-1}-1$$
$$a_0=2^0(a_0-1)+1$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9648551515780319,
"lm_q1q2_score": 0.8312595847961157,
"lm_q2_score": 0.8615382147637196,
"openwebmath_perplexity": 123.28793672475257,
"openwebmath_score": 0.9991117715835571,
"tags": null,
"url": "https://math.stackexchange.com/questions/1956547/how-to-show-that-two-recursive-formulas-are-the-same"
} |
experimental-physics, ads-cft
Title: How would one experimentally prove AdS/CFT correspondence? What would be an experimental test of AdS/CFT correspondence? Or it's extensions?
I've heard that people are studying AdS/CMT (condensed matter) correspondence, but I don't know the details of it?
But in general, how would you test it? It is hard to prove something experimentally that is actually an equivalence of two theories on a mathematical level. The AdS/CFT correspondence is supposed to be an exact correspondence between a quantum field theory and a string theory.
However, it is in principle possible to find support for the correspondence in the following way: construct the holographic dual (or a suitable approximation to it) of a theory that we know describes physics as we know it (e.g. QCD) and use this dual to calculate measurable quantities. If the results agree (if applicable, within the bounds of the approximation) with the observations, you have found experimental support for the correspondence. | {
"domain": "physics.stackexchange",
"id": 16917,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "experimental-physics, ads-cft",
"url": null
} |
ros, ros-kinetic
Title: How to dewrap 360 fov camera footage?
Hi I am using gscam package to publish the footage of Insta360 cam.So is there any process to dewrap the fish view of the camera footage and republish it in two seperate topics.
Originally posted by Katta Nigam on ROS Answers with karma: 1 on 2018-08-29
Post score: 0
Original comments
Comment by PeteBlackerThe3rd on 2018-08-29:
The question is dewarp them to what? Both of the fisheye images have a FOV just over 180 degrees. Rectifying such images will necessarily crop off some of the images. What are you planning on using the dewarped images for? Would a skybox be more suitable?
Comment by Katta Nigam on 2018-08-29:
I want to detect qr codes.So for that the image view should be straight i.e undistorted so for that I thought of dewraping the image and then use the footage for qr detection. So is there any way to do that qr detection. Is there any package to Detect qr or dewraping and republish the footage.
I believe #q277153 has some useful information.
Originally posted by gvdhoorn with karma: 86574 on 2018-08-29
This answer was ACCEPTED on the original site
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 31669,
"lm_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, ros-kinetic",
"url": null
} |
ros, gazebo, velocity
Title: How to get robot velocity in gazebo
Hello all.
I have built a little vehicle robot which can be controlled using keyboard.
Now i am interested to get the robot velocity in order to close control loop on it.
The question is what is the best way to do that ?
Is there a special sensor that I can include in my robot URDF model ?
Or, should I try to get it directly from the /gazebo/model_states topic ?
update :
I tried to subscribing to /gazebo/model_states topic using the following code :
ros::Subscriber vehicle_velocity_sub_;
vehicle_velocity_sub_ = nh_.subscribe<geometry_msgs::Twist>("/gazebo/model_states/twist[2]", 1000, &Dany_Obstacle_Avoidance_Commander::twist_data_processor, this);
But i got the following error :
terminate called after throwing an instance of 'ros::InvalidNameException'
what(): Character [[] at element [26] is not valid in Graph Resource Name [/gazebo/model_states/twist[2]]. Valid characters are a-z, A-Z, 0-9, / and _.
Aborted (core dumped)
It seems that ROS does not understand the vector operator "[]" used with topics.
nevertheless if I try to use it in rostopic command :
rostopic echo /gazebo/model_states/twist[2]
from the terminal it works fine.
Does anyone know what I doing wrong ?
thanks.
Originally posted by dmeltz on ROS Answers with karma: 192 on 2013-01-04
Post score: 1
Yousubscribe to a twist message, so /gazebo/model_states/twist is the topic name, you should then read the value you want from the geometry_msgs::Twist object you receive in the callback!
Best Georg
Originally posted by Georg with karma: 328 on 2013-01-05
This answer was ACCEPTED on the original site
Post score: 1 | {
"domain": "robotics.stackexchange",
"id": 12271,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, gazebo, velocity",
"url": null
} |
gazebo
Msg Waiting for master.Gazebo multi-robot simulator, version 1.9.5
Copyright (C) 2014 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org
Warning [ModelDatabase.cc:335] Getting models from[http://gazebosim.org/models/]. This may take a few seconds.
....Warning [ModelDatabase.cc:206] Unable to connect to model database using [http://gazebosim.org/models//database.config]. Only locally installed models will be available.
Error [ModelDatabase.cc:408] Unable to download model[model://sun]
Error [SystemPaths.cc:371] File or path does not exist[""]
Error [parser.cc:528] Unable to find uri[model://sun]
Warning [ModelDatabase.cc:335] Getting models from[http://gazebosim.org/models/]. This may take a few seconds.
.....Warning [ModelDatabase.cc:206] Unable to connect to model database using [http://gazebosim.org/models//database.config]. Only locally installed models will be available.
Error [ModelDatabase.cc:408] Unable to download model[model://ground_plane]
Error [SystemPaths.cc:371] File or path does not exist[""]
Error [parser.cc:528] Unable to find uri[model://ground_plane]
Msg Waiting for master
Msg Connected to gazebo master @ http://127.0.0.1:11345
Msg Publicized address: 192.168.5.248
2014-04-18 10:22:56.839 gzserver[56504:707] invalid drawable | {
"domain": "robotics.stackexchange",
"id": 3572,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gazebo",
"url": null
} |
# Domain Restriction for ListPlot
I constructed a table (here called 'distanceplot') with a set domain (from 0 to 100). I wish to keep this domain for the table constant. However, I shall be making multiple plots, each using a different subset of the domain. For example, I shall be making a plot which used only data from 0 to 10. Is there a way for ListPlot to restrict the domain already given to a table? I attempted to use the command DataRange, but it didn't change anything.
I tried the following
ListPlot[distanceplot,DataRange->{0,10}]
I know how to do this for Plot, but ListPlot I am not sure.
• PlotRange -> {{0, 10}, Automatic} ? What do you use in the case of Plot, and how does it fail? – MarcoB Jul 31 '15 at 19:48
It may depend on what you would like to achieve visually with your plot.
I'll create some fake data to represent yours:
distanceplot = Table[{x, 2 x}, {x, 0, 100, 1}];
Here are two ways to achieve what you asked, which lead to somewhat different results
The first example, which I suggested in the comments, provides an explicit limit for the horizontal plot range. The vertical plot range is determined automatically by ListPlot, taking into consideration all your data:
ListPlot[distanceplot, PlotRange -> {{0, 10}, Automatic}, PlotRangePadding -> Scaled[0.05]]
As you can see, the vertical range goes all the way to 200, because that is the range encompassed by the full dataset. If this behavior is undesirable, you could a) give an explicit value for the $y$ range as well, or b) pre-select the data that you feed to ListPlot with e.g. Cases:
ListPlot[Cases[distanceplot, {x_, y_} /; 0 <= x <= 10], PlotRangePadding -> Scaled[0.05]] | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9381240108164656,
"lm_q1q2_score": 0.8064712038954176,
"lm_q2_score": 0.8596637487122111,
"openwebmath_perplexity": 714.5797154331449,
"openwebmath_score": 0.45336124300956726,
"tags": null,
"url": "https://mathematica.stackexchange.com/questions/89639/domain-restriction-for-listplot"
} |
python, beginner, parsing, logging
def console_out(lines):
for line in lines:
print("{}{}".format(line.timestamp, line.message.rstrip("\n")))
def main():
if len(sys.argv) != 2:
print("Usage: {0} $logfile".format(sys.argv[0]))
else:
file_name = sys.argv[1]
with open(file_name) as file:
console_out(get_filtered_lines(file))
if __name__ == '__main__':
main()
Feel free to comment.
One thing, what bugs me is the apply_filter function, which does too many things at once. But I have have no solution for that. Let's see if I understand what's going on with get_filtered_lines() and apply_filter(). First, get_filtered_lines() reads physical lines from the file and strings them together in line_buffer. When we find the beginning of the next logical line ('['), we pass line_buffer off to apply_filter() so the material that has been collected gets processed. Then we empty out line_buffer and start over with the beginning of the logical line just read.
Here's an approach I think is simpler and clearer:
def apply_filter(lbuf):
parsed = parse_line(lbuf)
if filter(parsed):
return [parsed]
else
return []
def get_filtered_lines(source):
filtered_lines = []
collected = ""
for line in source:
if line.startswith('[') and collected:
filtered_lines.extend(apply_filter(collected))
collected = ""
collected += line
filtered_lines.extend(apply_filter(collected))
return filtered_lines
That way, apply_filter doesn't have to be aware of the list being built. It just returns a list of what it finds -- either a line that passes the filter or an empty list. Passing an empty list to extend is a no-op. | {
"domain": "codereview.stackexchange",
"id": 7385,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, beginner, parsing, logging",
"url": null
} |
# Volume of cube section above intersection with plane
Suppose we have a unit cube (side=1) and a plane with equation $x+y+z=\alpha$. I'd like to compute the volume of the region that results once the plane sections the cube (above the plane). There are three cases to analyze, and I can't quite visualize one of them.
Case 1: $0 \le \alpha < 1$
In this case, the section looks like a triangle, and the volume of interest is 1 minus the volume of the lower left tetrahedron, i.e., $$V = 1 - \int_0^\alpha \int_0^{\alpha-x} \int_0^{\alpha-x-y} dz\,dy\,dx = 1 - \frac{\alpha^3}{6}.$$
Case 3: $2 < \alpha \le 3$.
Here, the section is again a triangle, and the volume of interest is the upper right tetrahedron, i.e., $$V = \int_{\alpha-2}^1 \int_{\alpha-x-1}^1 \int_{\alpha-x-y}^1 dz\,dy\,dx = \frac{(3-\alpha)^3}{6}.$$
Case 2: $1 \le \alpha \le 2$.
This is where I'm sort of stuck. The section is a hexagon, with one of the inequalities being $\alpha-x-y \le z \le 1$, hence the innermost integral should be $\int_{\alpha-x-y}^1 dz$. The projection of the hexagon slice onto the $xy$-plane is described by $y \ge \alpha-1-x$ and $y \le \alpha-x$. Hence, the area of the hexagon projection is $$A = \int_0^{\alpha-1} \int_{\alpha-x-1}^1 dy\,dx + \int_{\alpha-1}^1 \int_0^{\alpha-x} dy\,dx$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9814534392852384,
"lm_q1q2_score": 0.8399780499029723,
"lm_q2_score": 0.8558511451289037,
"openwebmath_perplexity": 307.7834667011739,
"openwebmath_score": 0.8820827007293701,
"tags": null,
"url": "http://math.stackexchange.com/questions/454583/volume-of-cube-section-above-intersection-with-plane"
} |
fluid-dynamics, aerodynamics
Title: Venturi effect and velocity of the liquid (or air) I know that based on the Venturi effect, the velocity of a liquid (or air) going from a large sectional tube to a narrow sectional tube will increase. So, what happens if the liquid (or air) goes from a narrow sectional tube to a large sectional tube ? That depends on the flow speed in the narrow section:
If it is subsonic, the flow will slow down while its pressure increases. Depending on the pressure gradient, the flow might separate from the tube wall and show a chaotic flow behavior outside of the core flow.
If the speed of sound is reached in the narrow section, a widening tube downstream will cause the flow to accelerate further while pressure continues to drop. Now the details depend on the pressure downstream: If it is high enough, the flow will suddenly decelerate in a straight shock. | {
"domain": "physics.stackexchange",
"id": 47827,
"lm_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, aerodynamics",
"url": null
} |
If $\lambda \ge 0$, we see that $\{ t>0 | {\lambda x \over t } \in C \} = \lambda \{ t>0 | {x \over t } \in C \}$, and since $C$ is balanced, we have $\{ t>0 | {x \over t } \in C \} = \{ t>0 | {-x \over t } \in C \}$, from which we get $\{ t>0 | {\lambda x \over t } \in C \} = |\lambda| \{ t>0 | {x \over t } \in C \}$, and so $n(\lambda x) = |\lambda| n(x)$.
Finally, suppose ${x \over \alpha} \in C$ and ${y \over \beta} \in C$ for some $\alpha,\beta >0$, then since $C$ is convex, we have ${\alpha \over \alpha + \beta} {x \over \alpha} + {\beta \over \alpha + \beta} {y \over \beta} = {x+y \over \alpha + \beta} \in C$. Consequently, we have $n(x+y) \le \alpha+\beta$, and taking the $\inf$ over the appropriate $\alpha,\beta$ gives $n(x+y) \le n(x)+n(y)$, and so $n$ is subadditive.
Hence $n$ is a norm. | {
"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.804930856961117,
"lm_q2_score": 0.8244619263765707,
"openwebmath_perplexity": 197.85365658936044,
"openwebmath_score": 0.943375825881958,
"tags": null,
"url": "https://math.stackexchange.com/questions/1099517/interpreting-norm-definition"
} |
complexity-theory, turing-machines, undecidability, linear-bounded-automata
Title: Prove that it is undecidable whether a given LBA accepts a regular set I know for an LBA the emptiness problem is undecidable. However I am not clear on how to reduce the halting problem of Turing machines to this as LBAs are strictly computationally less powerful than Turing machines. Or should I approach with reductions using computational histories of a Turing machine on an input. Thanks to @YuvalFilmus I managed to reduce the Halting problem to the given problem. We design an LBA B, that given an instance of the Halting problem, $\langle M,x\rangle$, accepts the valid computation histories of M on x. If M doesn't halt on x, $L(B)=\phi$ which is regular. However, if M does halt $L(B)=VAL-COMPS(M,x)$ which is not regular(not even CFL). Techinically, I have reduced the complement of the Halting problem, but as we know that it is also not decidable, so it's fine. | {
"domain": "cs.stackexchange",
"id": 12173,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "complexity-theory, turing-machines, undecidability, linear-bounded-automata",
"url": null
} |
gravity, forces, centrifugal-force, centripetal-force
Title: Centripetal issue when considering gravity Forgive me if my question seems silly, but I am quite baffled. Suppose you have a satellite orbiting a horizontal swing planted into the ground and we want to find the velocity with which the satellite must be moving in order to succeed in taking a fully circular path around the swing (no failure followed by parabolic fall).
Indeed if we solve for $F = m(v^2)/R$, where $F$ can be equated to $g$, we can also solve for the velocity; all nice and good, and the nature of this method makes some intuitive sense but there is a problem (at least for me): the force that the satellite experiences is an inward force towards the center, and therefore the force described in the aforementioned equation is the centripetal force.
However, this conflicts with the method of solving the question, since at the top of the path, the centripetal Force and the gravitational force will be both pointing downwards. Therefore shouldn't the satellite actually be "doubly" compelled to accelerate to the ground? But clearly when we for for $v$ with $g$, we assume that they cancel each other out - hence they point in opposite directions. The idea that the cancel also "explains" the intuition that at the top of the circular path, the satellite will be feeling the most "weightless" it will throughout its revolution.
Additionally from a different reference frame / non centrifugal one, it makes sense that at the top, the most force will be on the satellite to turn its path downward as it is after that instant that the satellite sees its downward acceleration. I am, essentially confused with how to handle centripetal/centrifugal "fictitious" forces in this worked example. I believe your confusion comes from a misunderstanding of the designation of a force as "centripetal".
Any calculation of centripetal force is telling you how much force is needed to make a circular motion take place. This doesn't create the force. There is no guarantee that a force of the calculated size and direction actually exists! You need to go out and look around to see if the force is available from any combination of existing forces. | {
"domain": "physics.stackexchange",
"id": 10610,
"lm_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, forces, centrifugal-force, centripetal-force",
"url": null
} |
keras, tensorflow, cnn
if dim_ordering == 'th':
x[:, 0, :, :] -= 103.939
x[:, 1, :, :] -= 116.779
x[:, 2, :, :] -= 123.68
# 'RGB'->'BGR'
x = x[:, ::-1, :, :]
else:
x[:, :, :, 0] -= 103.939
x[:, :, :, 1] -= 116.779
x[:, :, :, 2] -= 123.68
# 'RGB'->'BGR'
x = x[:, :, :, ::-1]
return x
def decode_predictions(preds, top=5):
"""
Decode the predictionso of the ImageNet trained network.
Parameters
----------
preds : numpy array
top : int
How many predictions to return
Returns
-------
list of tuples
e.g. (u'n02206856', u'bee', 0.71072823) for the WordNet identifier,
the class name and the probability.
"""
global CLASS_INDEX
if len(preds.shape) != 2 or preds.shape[1] != 1000:
raise ValueError('`decode_predictions` expects '
'a batch of predictions '
'(i.e. a 2D array of shape (samples, 1000)). '
'Found array with shape: ' + str(preds.shape))
if CLASS_INDEX is None:
fpath = get_file('imagenet_class_index.json',
CLASS_INDEX_PATH,
cache_subdir='models')
CLASS_INDEX = json.load(open(fpath))
results = []
for pred in preds:
top_indices = pred.argsort()[-top:][::-1]
result = [tuple(CLASS_INDEX[str(i)]) + (pred[i],) for i in top_indices]
results.append(result)
return results | {
"domain": "datascience.stackexchange",
"id": 4559,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "keras, tensorflow, cnn",
"url": null
} |
ros-kinetic, pointcloud
This is my gdb output
Reading symbols from devel/lib/number_output/number_output...done.
(gdb) r
Starting program: /home/dan/catkin_ws/devel/lib/number_output/number_output
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff1855700 (LWP 21659)]
[New Thread 0x7fffe9054700 (LWP 21660)]
[
New Thread 0x7ffff1054700 (LWP 21661)]
[New Thread 0x7ffff0853700 (LWP 21666)]
Thread 1 "number_output" received signal SIGSEGV, Segmentation fault.
0x000000000040cdb0 in main (argc=1, argv=0x7fffffffdaa8)
at /home/dan/catkin_ws/src/number_output/src/send_numbers.cpp:25
25 msg.points[i].x = rand() % 10;
(gdb)
Sorry for the funny format. I'm not sure what happened there. I'm new to ROS so if any help would be appreciated.
Thanks
Originally posted by DRos on ROS Answers with karma: 23 on 2018-07-24
Post score: 0
I think I worked it out, the msg.points array doesn't have a size allocated before assigning values to it. I had to put msg.points.resize(num_points) to assign it the correct size before assignment.
Thanks for looking!
Dan
Originally posted by DRos with karma: 23 on 2018-07-24
This answer was ACCEPTED on the original site
Post score: 2 | {
"domain": "robotics.stackexchange",
"id": 31343,
"lm_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, pointcloud",
"url": null
} |
quantum-field-theory, mathematical-physics
Title: Realistic interacting QFT construction May I ask is it true that all the interacting 4-dimension QFT's couldn't be constructed and defined consistently and rigorously? If we are able to rigorously construct a lower dimension QFT, what are the usage of those algebraic QFT's since real QFT's are in 4 dimensions and have interaction.
Any experts can clarify? We are not able, at least for the moment, to define in a rigorous mathematical fashion a meaningful interacting QFT in $3+1$ dimensions that is coherent with the perturbative theory utilized by physicists (in more precise words, that satisfies the Wightman axioms).
On the contrary, some rigorous interacting QFTs can be defined in lower (spatial) dimensions. Take for example the $\phi^4$ model: it is not well-defined in $3+1$ dimensions, but it is in $1+1$ and $2+1$ (the latter for sure on finite volume, I am not sure about the infinite volume limit) as proved by Glimm and Jaffe in the sixties. This simplified models, even if they may not be physically interesting, has been analyzed in the hope that the same tools may be utilized in the meaningful theories. Unluckily, this has not been the case so far (anyways, there is still ongoing work on the subject, especially concerning the Yang-Mills theory).
However there is no rigorous "no-go theorem" that says that the interacting quantum field theories in $3+1$ dimensions cannot be constructed, but it may be possible that for some model the limitations are more fundamental and not only related to the lack of mathematical tools (see the comment by A.A. below). | {
"domain": "physics.stackexchange",
"id": 21955,
"lm_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, mathematical-physics",
"url": null
} |
special-relativity, spacetime, coordinate-systems, inertial-frames
Title: Lorentz transform derivation From wikipedia page "Derivations of the Lorentz transformations",
$$ \left[ {\gamma^2} - \frac{ \left( 1 - {\gamma^2} \right)^2 c^2}{ {\gamma^2} v^2} \right] x^2 - \left[ 2 {\gamma^2} v + 2 \frac{ \left( 1 - {\gamma^2} \right) c^2}{ v}\right] t x + y^2 + z^2 = \left[ c^2 {\gamma^2} - v^2 {\gamma^2} \right] t^2 $$
Comparing the coefficient of $t^2$ in the above equation with the
coefficient of $t^2$ in the spherical wavefront equation for frame
''O'' produces:
$$c^2 {\gamma^2} - v^2 {\gamma^2} = c^2$$
Equivalent expressions for γ can be obtained by matching the $x^2$
coefficients or setting the $tx$ coefficient to zero. | {
"domain": "physics.stackexchange",
"id": 93022,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "special-relativity, spacetime, coordinate-systems, inertial-frames",
"url": null
} |
javascript, sorting, functional-programming, ecmascript-6
P.S. I apologize in advance for using strong words and for my way of thinking potentially misaligning with the coding standards of your organization. I'm not questioning your internal agreements of course, but rather trying to analyse and evaluate the code as a "spherical cow in a vacuum" from a perspective of the developer on the Clapham omnibus (who obviously can not jump as high as you can).
P.P.S. This is the great question and the code to read/think about! | {
"domain": "codereview.stackexchange",
"id": 28710,
"lm_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, sorting, functional-programming, ecmascript-6",
"url": null
} |
fluid-dynamics, particle-physics, astrophysics, shock-waves, relativistic-jets
$$
where $dV$ is the volume element, $dA$ the area element, $\rho$ the mass density, $\hat{\mathbf{n}}$ unit normal vector to surface area element $dA$, and $\mathbf{u}$ bulk fluid flow velocity. We can see that Equation 4 simplifies to the following in a one-dimensional flow (e.g., flow only along radial vector):
$$
\rho \ u \ A = constant
$$
where in the case of spherical symmetry and constant flow speed results in $\rho \propto r^{-2}$. Note that $\rho(r)$ can be easily exchanged for $n(r)$ in most cases. | {
"domain": "physics.stackexchange",
"id": 28527,
"lm_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, particle-physics, astrophysics, shock-waves, relativistic-jets",
"url": null
} |
electromagnetism, forces, magnetic-fields, electric-fields, charge
Title: Electric field on test charge due to dipole In worked example 4.1 of Intermolecular and Surface Forces by Jacob Israelachvili, he is calculating the electric field on a test charge due to the dipole shown in the picture.
He assumes $r\gg l$ and:
$$AB\approx r-\frac{1}{2} l\cos{\theta}$$
$$AC\approx r+\frac{1}{2} l\cos{\theta}$$
Using this, he writes that the magnitude of the electric field on A due to the negative charge at B is:
$$E_{-}=q / 4 \pi \varepsilon_{0} \cdot A B^{2} \approx\left(q / 4 \pi \varepsilon_{0} r^{2}\right)\left(1+\frac{l}{r} \cos \theta\right)$$
But I don't see where that comes from. Why is the squared distance in the numerator? and what approximation is used on the right-hand side? This is the binomial approximation, where you can approximate $$(1 + x)^\alpha \approx 1 + \alpha x, \quad \text{(if $|\alpha x|\ll 1$)}.$$
The squared distance is in the denominator, as you'd expect: $$E_- = \frac{q}{4\pi\epsilon_0 \cdot AB^2}.$$
If you substitute for $AB$, you can easily show that it's just $$E_- = \frac{q}{4\pi\epsilon_0 r^2} \frac{1}{(1 - \frac{l}{2r}\cos\theta)^2}.$$ | {
"domain": "physics.stackexchange",
"id": 75123,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electromagnetism, forces, magnetic-fields, electric-fields, charge",
"url": null
} |
determinism, randomness
Title: Deterministic universe for dummies Is there a general consensus about whether the universe is deterministic? Is it still up in the air?
I have attempted to read other physics.stackexchange answers and do some independent research, but I'm not a physicist and most literature is beyond my comprehension. If you answer this question, I would most appreciate it if you could attempt to explain it as simply as possible. As soon as I have to start to look up theories or definitions that are used, the web pages that explain it generally go over my head.
The easiest way to phrase my question that I can think of:
Assume there is a being existing prior to the big bang, with infinite intelligence, physics knowledge, memory, and time. The only limitation is this being can not time travel to observe the future universe. However, this being knows everything about everything as it currently stands.
Once the big bang happens, could this being map out every interaction in our universe throughout all time? No, since 1925 or 1926, we have known – thanks to Werner Heisenberg, Niels Bohr, Max Born, and colleagues who have discovered the so-called "quantum mechanics", the new foundation of modern physics – that the Universe is not deterministic in this sense. Even the maximal possible knowledge of the initial state is insufficient for the prediction of phenomena in the future.
In fact, the departure with the classical reasoning your question exhibits is much deeper than that. The sentence
However, this being knows everything about everything as it currently stands. | {
"domain": "physics.stackexchange",
"id": 21194,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "determinism, randomness",
"url": null
} |
Edit: Often the shortest/simplest definition becomes the standard definition. Why not in this case?
• I'm not sure this a good reason but note that your $\Rightarrow$ is shorter than your $\Leftarrow$. So in a statement like: "let $(x_n)$ be Cauchy sequence prove that blabla" You might need the first the first definition and so somehow your proof is shorter. – Surb Jun 8 '16 at 14:33
• @Surb ok, maybe it could be useful if you have proofs going in that direction. – supinf Jun 8 '16 at 14:54
Here is what I think. First of all, as @Surb pointed out, $\Rightarrow$ is shorter than $\Leftarrow$ (and in fact is pretty short in its own right). It can then be seen that your second definition is an almost immediate corollary of the original, whereas the first definition is definitely not as immediately deducible from the one you found. So in practice, if you wanted to use your definition instead of the original, you could easily just derive it from the original. On the other hand, suppose you had your definition and in some situation you found that the original would be more useful. It would take a lot more work to derive it from your definition, so that's a little bit inconvenient. But really this is just a question of convenience.
Also, and this is more a statement about intuition than anything, I think the original definition expresses a particular intuitive point more clearly than your second one does. The original basically says a sequence is Cauchy if the terms become arbitrarily close to one another. Your definition essentially conveys the same point, but if you think about it, it isn't as obvious from that definition. They are, as you've shown, equivalent so you could obviously use whichever you want.
• good point with the intuition, that makes sence! – supinf Jun 8 '16 at 21:12
In any context, the "best definition" of a property should be as clear, natural, and intuitive as possible. That's my belief. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.951142221377825,
"lm_q1q2_score": 0.8046115708264877,
"lm_q2_score": 0.845942439250491,
"openwebmath_perplexity": 244.16903286052172,
"openwebmath_score": 0.9450280070304871,
"tags": null,
"url": "https://math.stackexchange.com/questions/1818520/definition-of-cauchy-sequence"
} |
digital-communications, interpolation, software-defined-radio
Title: Why do we need to increase sampling frequency at the transmitter? I've thinking about this for some time now and I was wondering why do we need to increase smapling rate in the transmitter? I will explain a bit more.
From the point of view of a software-defined radio, you convert bits to symbols (let's suppose I'm doing QPSK) and after pulse shaping with 4 samples per symbol, (which I know it also increase sampling frequency by 4 since it's another interpolation after all) I've seen it's quite common to do some multi-stage interpolation (or a single-stage interpolation, it doesn't matter) to increase the sampling frequency even more. Why is this beneficial? I mean, I can only think of one reason and that'd be because you have more samples per symbol, but if after you're upconverting to passband and send it to the channel, what was that for?
Then, when you get the signal at the receiver, you decimate it to decrease sampling frequency. This one, I think I understand it better, after doing synchronization (for example in symbol sync you might need more than 1 sample per symbol), you want to decrease the sampling frequency so you don't have to deal with so many samples and is less computational costly.
So my question is, why doing interpolation in the transmitter?
Correct me if I said something wrong, please. Thank you. Three reasons to increasing the sampling rate further are
1) To relax the requirements of the post D/A conversion filtering for image rejection.
2) Increase signal SNR by spreading quantization noise for a fixed number of DAC bits across a wider frequency range.
3) Minimize passband droop in the D/A reconstruction. | {
"domain": "dsp.stackexchange",
"id": 8053,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "digital-communications, interpolation, software-defined-radio",
"url": null
} |
pauli-gates
Thus, I have that $$U_l^{\dagger}Y = Y + ie^{-i\frac{\pi}{4}l(z)}Z$$ and therefore $$U_l^{\dagger}YU_l = -ie^{i\frac{\pi}{4}l(z)}Z + ie^{-i\frac{\pi}{4}l(z)}Z$$ which, when we apply Euler's formula, reduces to: $$2\sin(\frac{\pi}{4}l(z))Z$$ which doesn't seem to be correct.
Could you please help me out? I've been stuck on it for a couple of days now. By taking into account the Euler-like formula for Pauli matrices (see, for example, the formula (4.4) or (4.7) in the M. Nielson and I. Chuang textbook):
$$e^{i \theta X} = cos(\theta)I + i sin(\theta) X$$
We can show that:
$$U_l = e^{i \frac{\pi}{4}l(z) X} = cos(\frac{\pi}{4}l(z)) I + isin(\frac{\pi}{4}l(z)) X$$
So
\begin{align*}
U_l^\dagger Y U_l &= \left( cos(\frac{\pi}{4}l(z)) I - isin(\frac{\pi}{4}l(z))
X \right)
Y \left( cos(\frac{\pi}{4}l(z)) I + i sin(\frac{\pi}{4}l(z)) X \right) =
\\ | {
"domain": "quantumcomputing.stackexchange",
"id": 1346,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "pauli-gates",
"url": null
} |
thermodynamics, water, phase-transition, evaporation, gas
Title: Why does water turn into water vapor? I read an article lately and it said that water turns into steam when it reaches its boiling point. But it led me to another question.
Why does water boil and why does the water turn into gas when it boils? Water molecules have attractive forces between them and form the liquid state.
First of all start with a container with water liquid and a vacuum above the water liquid.
This container and the water within it is kept at a constant temperature.
Some the water liquid molecules will have enough kinetic energy to overcome the attraction of their neighbouring water liquid molecules and escape from water liquid surface and become water vapour.
There is a net migration with water liquid molecules becoming water vapour molecules.
As time goes on and the number of water vapour molecules increases but some of those water vapour molecules will hit the water surface and become part of water liquid.
Eventually there are sufficient water vapour molecules and a dynamic equilibrium will be set up where the rate at which water liquid is converted into water vapour is exactly the same as the rate at which water vapour is converted into water liquid.
The pressure of the water vapour when this condition is satisfied is called the saturated vapour pressure.
Increasing the temperature means that the average kinetic energy of the water molecules increases and so the probability of a water liquid escaping from the surface of the liquid is increased.
So the rate at which water liquid turns to into water vapour increases.
For a time there is a net migration from water liquid to water vapour until the increase in the density of water vapour is sufficient for a new dynamic equilibrium to be set up.
The saturated vapour pressure increases as the temperature increases.
Raising the temperature will thus increase the saturated vapour pressure until there comes a temperature when the density of the vapour is the same as the density of the liquid.
The boundary (surface) between the liquid and the vapour disappears and you have just one phase.
That temperature is called the critical temperature and here is one video showing this effect.
Water liquid does not exist above the its critical temperature of $374\,^\circ \rm c$ | {
"domain": "physics.stackexchange",
"id": 97179,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "thermodynamics, water, phase-transition, evaporation, gas",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.