text stringlengths 49 10.4k | source dict |
|---|---|
java, swing, animation
class DrawPanel extends JPanel
{
private static final long serialVersionUID = 1L;
public void paintComponent(Graphics g)
{
g.setColor(Color.BLUE);
g.fillRect(0, 0, this.getWidth(), this.getHeight());
g.setColor(Color.RED);
g.fillRect(3, 3, this.getWidth() - 6, this.getHeight() - 6);
g.setColor(Color.WHITE);
g.fillRect(6, 6, this.getWidth() - 12, this.getHeight() - 12);
g.setColor(Color.BLACK);
g.fillRect(oneX, oneY, 6, 6);
}
}
private void moveIt()
{
while (true)
{
if (oneX >= 283)
{
right = false;
left = true;
}
if (oneX <= 7)
{
right = true;
left = false;
}
if (oneY >= 259)
{
up = true;
down = false;
}
if (oneY <= 7)
{
up = false;
down = true;
}
if (up) oneY--;
if (down) oneY++;
if (left) oneX--;
if (right) oneX++;
try
{
Thread.sleep(10);
}
catch (Exception e)
{
e.printStackTrace();
}
frame.repaint();
}
}
} | {
"domain": "codereview.stackexchange",
"id": 25145,
"lm_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, swing, animation",
"url": null
} |
Differentiate with respect to $x$ twice: $$S''(x) = \sum_{n=1}^{\infty} (x-1/2)^{n-1} = \sum_{k=0}^{\infty} (x-1/2)^{k},$$ geometric series formula gives $$S''(x) = \frac{1}{1-(x-1/2)} = \frac{1}{3/2-x}.$$ Now you have to integrate this twice to get the answer, using (which you should check) $S(1/2)=S'(1/2)=0$.
Differentiate the sum $S(x)$ once reveals that
$$S'(x)=\sum_{n=1}^{\infty}\, \frac{(x-1/2)^n}{n}$$
which we recognize as the series representation of $\log(1-(x-1/2))$.
Integrate once and apply the condition that $S(1/2)=0$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9845754465603678,
"lm_q1q2_score": 0.8072468495054272,
"lm_q2_score": 0.8198933381139646,
"openwebmath_perplexity": 773.0648832184453,
"openwebmath_score": 0.823235809803009,
"tags": null,
"url": "https://math.stackexchange.com/questions/1255037/sum-of-power-series-using-derivation-or-integration"
} |
java, error-handling, servlets, jsp, captcha
// bind objects to session
session.setAttribute("isUsernameBlank", isUsernameBlank);
session.setAttribute("isEmailBlank", isEmailBlank);
session.setAttribute("isPasswordBlank", isPasswordBlank);
session.setAttribute("isEmailValid", isEmailValid);
session.setAttribute("isPasswordLengthValid", isPasswordLengthValid);
session.setAttribute("isExistingUsername", isExistingUsername);
session.setAttribute("isExistingEmail", isExistingEmail);
session.setAttribute("isEmailMatch", isEmailMatch);
session.setAttribute("isPasswordMatch", isPasswordMatch);
if(isUsernameBlank || isEmailBlank || isPasswordBlank || !isEmailValid || !isPasswordLengthValid
|| isExistingUsername || isExistingEmail || !isEmailMatch || !isPasswordMatch) {
response.sendRedirect("register-result.jsp");
// register success
} else {
String userPassword = userPassword1;
String userEmail = userEmail1;
// get current system time
java.util.Date utilDate = new java.util.Date();
// convert to sql date
java.sql.Date registeredDate = new java.sql.Date(utilDate.getTime());
// assemble user bean object
User user = UserAssembler.getInstance(
userId,
userPassword,
userEmail,
2, // 2 = User
registeredDate
);
// insert user into database
um.registerUser(user);
response.sendRedirect("register-result.jsp");
}
// wrong captcha answer
} else {
response.sendRedirect("register-result.jsp");
}
} | {
"domain": "codereview.stackexchange",
"id": 10468,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, error-handling, servlets, jsp, captcha",
"url": null
} |
$$\gcd(3(2n+1), 2^2(n+1)) = \gcd(3,n+1)$$.
All comes down to "casting out" relatively prime factors.
\begin{align} (\color{#c00}4(n\!+\!1),\,3(2n\!+\!1))\, &=\, (n\!+\!1,\,3(\color{#0a0}{2n\!+\!1}))\ \ \ {\rm by}\ \ \ (\color{#c00}4,3)=1=(\color{#c00}4,2n\!+\!1)\\[.2em] &=\, (n\!+\!1,3)\ \ {\rm by} \ \bmod n\!+\!1\!:\ n\equiv -1\,\Rightarrow\, \color{#0a0}{2n\!+\!1\equiv -1} \end{align}
Remark Your argument that the gcd $$\,d\mid \color{#c00}3$$ is correct, but we can take it further as follows
$$d = (4n\!+\!4,6n\!+\!3) = (\underbrace{4n\!+\!4,6n\!+\!3}_{\large{\rm reduce}\ \bmod \color{#c00}3},\color{#c00}3) = (n\!+\!1,0,3)\qquad$$
Therefore $$\, d = 3\,$$ if $$\,3\mid n\!+\!1,\,$$ else $$\,d= 1$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9833429599907709,
"lm_q1q2_score": 0.841595196554813,
"lm_q2_score": 0.855851143290548,
"openwebmath_perplexity": 725.6734418598273,
"openwebmath_score": 0.9550416469573975,
"tags": null,
"url": "https://math.stackexchange.com/questions/3059698/greatest-common-divisor-of-two-elements"
} |
quantum-gate, quantum-state, logical-gates
$
and after gate A it becomes:
$
\begin{pmatrix}
a'c\\
a'd\\
b'c''\\
b'd''
\end{pmatrix}
$
so the 2 are equivalent?But this cannot be correct , intuitively it is not correct.Where am I wrong here? Your problem is that your notation is leading you astray. In your first way of writing the circuit, you have the gate $B$ achieving the change in amplitudes $b'c\rightarrow b'c''$ while in the second you have $bc\rightarrow bc''$ assuming that those two $c''$ should be the same. There is no reason that they should be.
To illustrate this more concretely, consider $A$ and $B$ both being the not gate, and both qubits start in $|0\rangle$. In the first case, you get
$$
\begin{bmatrix}
1 \\ 0 \\ 0 \\ 0
\end{bmatrix}\rightarrow\begin{bmatrix}
0 \\ 0 \\ 1 \\ 0
\end{bmatrix}\rightarrow \begin{bmatrix}
0 \\ 0 \\ 0 \\ 1
\end{bmatrix}
$$
while in the second case, you get
$$
\begin{bmatrix}
1 \\ 0 \\ 0 \\ 0
\end{bmatrix}\rightarrow\begin{bmatrix}
1 \\ 0 \\ 0 \\ 0
\end{bmatrix}\rightarrow \begin{bmatrix}
0 \\ 0 \\ 1 \\ 0
\end{bmatrix}.
$$
The initial conditions for the controlled-B gate are different between the two cases, so give different outputs. | {
"domain": "quantumcomputing.stackexchange",
"id": 5599,
"lm_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-gate, quantum-state, logical-gates",
"url": null
} |
in the past, while expected rates of return predict how they'll do in the future and by nature are estimates. As another example, a two-year return of 10% converts to an annualized rate of return of 4.88% = ((1+0.1)(12/24) − 1), assuming reinvestment at the end of the first year. g It is calculated by multiplying the rate of return at each possible outcome by its probability and summing all of these values. These terms are most frequently used when comparing the market price of an asset vs the intrinsic value of that asset to determine if it represents a suitable investment. Average annual return = Sum of earnings in Year 1, Year 2 and Year 3 / Estimated life = ($25,000 + $30,000 +$35,000) / 3 = $30,000. If the initial value is negative, and the final value is more negative, then the return will be positive. R {\displaystyle r} {\displaystyle R_{\mathrm {log} }} n t Otherwise, the investment does not add value. 1 Logarithmic or continuously compounded return, Comparisons between various rates of return, Money-weighted return over multiple sub-periods, Comparing ordinary return with logarithmic return, Comparing geometric with arithmetic average rates of return, Foreign currency returns over multiple periods, Mutual fund and investment company returns, PROVISIONS OF THE GLOBAL INVESTMENT PERFORMANCE STANDARDS 5.A.4, Learn how and when to remove this template message, "return: definition of return in Oxford dictionary (British & World English)", "rate of return: definition of rate of return in Oxford dictionary (British & World English)", "Time Value of Money - How to Calculate the PV and FV of Money", "Final Rule: Registration Form Used by Open-End Management Investment Companies: Sample Form and instructions", https://en.wikipedia.org/w/index.php?title=Rate_of_return&oldid=998453152, Articles with unsourced statements from May 2020, Articles needing additional references from February 2020, All articles needing additional references, Creative Commons Attribution-ShareAlike License. {\displaystyle r_{\mathrm {log} }} Reinvestment rates or factors are based on total distributions (dividends plus capital gains) during each | {
"domain": "abo-sommerhuse.dk",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.975576912786245,
"lm_q1q2_score": 0.8021087273052373,
"lm_q2_score": 0.8221891239865619,
"openwebmath_perplexity": 2160.510007665216,
"openwebmath_score": 0.49565374851226807,
"tags": null,
"url": "http://abo-sommerhuse.dk/f1wc7/archive.php?id=453a80-rate-of-return"
} |
# Set theory and Bayes’ Rule Sets and set operations Axioms of probability Probabilities of sets Bayes’ rule Chapter 2 of Haldar and Mahadevan’s Probability,
## Presentation on theme: "Set theory and Bayes’ Rule Sets and set operations Axioms of probability Probabilities of sets Bayes’ rule Chapter 2 of Haldar and Mahadevan’s Probability,"— Presentation transcript:
Set theory and Bayes’ Rule Sets and set operations Axioms of probability Probabilities of sets Bayes’ rule Chapter 2 of Haldar and Mahadevan’s Probability, Reliability and Statistical Methods in Engineering Design, John Wiley, 2000. Slides based in part on lecture by Prof. Joo-Ho Choi of Korea Aerospace University
Emergency car depot Three car sets –Sample space has 8 mutually exclusive outcomes. –Figure defines 4 other mutually exclusive events. –Random variable X is the number of good cars.
Set notation An event with no sample point is an impossible event or a null set –Give an example for car space? The complement of an event E is denoted as –What is the complement of X=2 ? Union of events denoted, intersection The answer to the previous question may be written as Events E 1 and E 2 both happening is written as E 1 E 2 or
Venn diagrams Intersection Other relationships
Axioms of Probability 1.P( E ) ≥ 0: probability of an event E is non-negative. 2.Probability of certain event P(S)=1. 3.Probability of two mutually exclusive events Corollaries: How do you prove them ?
Design office quiz P( E1∩E2 ) = ? P( E1 U E2 ) = ? –Are E1, E2 mutually exclusive ? P( E3∩E2 ) = ? P( E3 U E2 ) = ? –Are E3, E2 mutually exclusive ? E1: 80, E2: ≥90., E3=80,100
Conditional probability P(E 1 |E 2 ) denotes the probability that E 1 will happen given the fact that E 2 did. When joint occurrence is possible For statistically independent events Bayes’ rule
California example Are F,E mutually exclusive? Calculate P( E U F ) Recall that | {
"domain": "slideplayer.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9830850832642353,
"lm_q1q2_score": 0.810516213059765,
"lm_q2_score": 0.8244619177503205,
"openwebmath_perplexity": 2617.070715795175,
"openwebmath_score": 0.8353519439697266,
"tags": null,
"url": "http://slideplayer.com/slide/3421161/"
} |
homework-and-exercises, general-relativity, newtonian-gravity, orbital-motion, geodesics
$$\begin{align}
\frac{dt}{d\tau} = constant
\end{align}$$
and when we see that when $\mu=i$:
$$\begin{align}
\frac{d^{2}x^{i}}{dt^{2}} &= - \frac{1}{2} \partial_{i} h_{00}
\end{align}$$
in which we have $h_{00} = -2 \Phi$, reminiscent of that of the acceleration $\vec{a} = -\nabla \Phi $ where $\Phi$ is the newtonian potential.
Thus
$$\begin{align}
g_{00} &= - (1+2\Phi).
\end{align}$$
Now my problem is trying to solve for the spatial components $g_{ij}$ in a similar fashion.
When trying to work it out, my work starts to look convoluted and messy and I just get lost in translation:
$$\begin{align}
\Gamma^{\mu}_{ij}&= \frac{1}{2} g^{\mu \nu} ( \partial_{i}g_{\nu j} + \partial_{j}g_{i \nu} - \partial_{\nu}g_{i j} ). \\
\end{align}$$
Taking $\mu=0$, the whole connection goes to zero. But for a spatial components while implementing the perturbed metric, I get stuck. I might have found the solution.
In the spatial configuration:
$$
\begin{align}
\frac{d^{2}x^{\mu}}{d \tau^{2}} + \Gamma^{\mu}_{ij}\frac{dx^{i}}{d\tau}\frac{dx^{j}}{d\tau} = 0
\end{align}
$$
The affine connection expanded out is of the form:
$$
\begin{align} | {
"domain": "physics.stackexchange",
"id": 37726,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises, general-relativity, newtonian-gravity, orbital-motion, geodesics",
"url": null
} |
ros, rosdep, package
Title: satisfying package dependencies
I have package that depends on the willow garage pr2_cockpit package. Is there a way to inform a user that this dependency exists if the package is not already installed (besides looking through the output of rosmake or the package manifest file and checking manually)? I tried adding "ros-diamondback-pr2-cockpit" as an external dependency in the manifest file. However, rosdep install for my package failed with the following error:
rosdep install <package_name>
Failed to find rosdep ros-diamondback-pr2-cockpit for package <package_name> on OS:ubuntu version:10.04
ERROR: ABORTING: Rosdeps [u'ros-diamondback-pr2-cockpit'] could not be resolved
Any suggestions of a structured way to install external ros packages would be nice. Is rosinstall the only other option?
Thanks for any help.
marc
Originally posted by mkillpack on ROS Answers with karma: 340 on 2011-05-03
Post score: 0
At the moment installation instructions usually consist of
install the following debian packages: ros-diamondback-foo ros-diamondback-bar
install this rosinstall file http://example.com/example.rosinstall
In general ros packages are not designed to be installed via rosdep. Though it does work. There are some tools in development to facilitate the installation of larger systems. However the above system so far works in most cases.
Originally posted by tfoote with karma: 58457 on 2011-05-03
This answer was ACCEPTED on the original site
Post score: 1
Original comments
Comment by Benoit Larochelle on 2013-01-20:
The link seems broken now | {
"domain": "robotics.stackexchange",
"id": 5501,
"lm_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, rosdep, package",
"url": null
} |
c++, game
return;
}
Monster.h
#pragma once
#include "Entity.h"
#include <vector>
#include <memory>
#include <map>
typedef std::vector<std::string> creature_t;
class Monster : public Entity
{
private:
static creature_t centaur;
static creature_t ghost;
static creature_t gryphon;
static std::vector<creature_t> creatures;
creature_t shape;
public:
Monster(std::string _n, int att, int def) {
name = _n;
health = 100;
attack = att;
defense = def;
unsigned seed = time(0);
srand(seed);
shape = creatures[rand() % 3];
};
~Monster(){};
void fillInventoryWithRandomItems();
static std::shared_ptr<Monster> generateMonster();
void dropFromInventory() { inventory.clear(); };
void itemsInInventory(int& w, int& a, int& c);
creature_t getShape() { return shape; }
};
Player.cpp
#include "Player.h"
std::vector<std::string> Player::shape = {
" \\\\\\|||///",
" . =======",
"/ \\| O O |",
"\\ / \\`___'/ ",
" # _| |_",
"(#) ( )",
" #\\//|* *|\\\\ ",
" #\\/( * )/",
" # =====",
" # ( U )",
" # || ||",
".#---'| |`----.",
"`#----' `-----'"
};
void Player::useSelectedItemFromInventory() {
std::shared_ptr<Item> item = inventory.getSelectedItem();
if(!item)
return; | {
"domain": "codereview.stackexchange",
"id": 40467,
"lm_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++, game",
"url": null
} |
$$P(\text{A OR B}) = P(\text{A}) + P(\text{B}) - P(\text{A AND B})$$
Also, the statement "The first die is 6 OR the second die is 6 OR both dice are 6" is redundant- it means the exact same thing as "The first die is 6 OR the second die is 6", and this is the exact same thing as "At least one die is 6".
• Further to that, the proper way to partition the event into disjoint sets, is: \begin{align}\mathsf P(\textsf{One of both rolls are }6) = & \mathsf P(\textsf{the first roll is 6 AND the second roll is not 6}) \\[0ex] & + \mathsf P(\textsf{the first roll is not 6 AND the second roll is 6})\\[0ex] & +\mathsf P(\textsf{the first roll is 6 AND the second roll is 6}) \\[1ex] = & \frac{5}{36}+\frac{5}{36}+\frac{1}{36}\end{align} Dec 2, 2015 at 3:14 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.978712645102011,
"lm_q1q2_score": 0.8091132846226491,
"lm_q2_score": 0.826711791935942,
"openwebmath_perplexity": 138.04834624599502,
"openwebmath_score": 0.9217916131019592,
"tags": null,
"url": "https://math.stackexchange.com/questions/1555364/roll-a-fair-6-sided-die-twice-what-is-the-probability-that-one-or-both-rolls-ar"
} |
black-holes, hawking-radiation
Title: What would happen if a supermassive blackhole at the center of a galaxy evaporates? Well the title says it all but I will just explain it in detail a bit. We know that a blackhole eventually has to evaporate due to the hawking radiation. It is also said that the blackholes at the center of galaxies are the galaxies' source of energy. So what would happen if that blackhole evaporates? This is really an extension to kleingordon's answer.
The net rate of evaporation of a black hole is the rate of energy loss through Hawking radiation minus the rate energy/mass is accreted from the universe outside the black hole. At the moment the temperature of a supermassive black hole is far lower than the cosmic microwave background, so even a completely isolated supermassive black hole will grow over time not shrink.
As time goes on the expansion of the universe will cool the CMB until it becomes lower than the temperature of the black hole, but this will take a long, long time. The temperature of the supermassive black hole at the centre of the Milky Way (Sagittarius A$^*$) is around $10^{-14}$ Kelvin so it will take around $10^{14}$ times the current lifetime of the universe before Sagittarius A$^*$ even starts to evaporate.
Now galaxies are not static objects. They evolve in lots of different ways, and after $10^{24}$ years they are likely to look completely different. So when you ask what effect the black hole evaporating will have on the galaxy, you need to bear in mind that the galaxy we know and love will no longer exist by that time. | {
"domain": "physics.stackexchange",
"id": 11738,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "black-holes, hawking-radiation",
"url": null
} |
python, mysql
def cursor(self, connection):
return connection.cursor
def __call__(self, database):
self.database = database
return self
def __enter__(self):
self.db = self.connections[self.database]
self.cursor = self.cursors[self.database](pymysql.cursors.SSDictCursor)
return self.cursor
def __exit__(self, exc_type, exc_value, tb):
if not exc_type:
self.db.commit()
self.cursor.close()
Usage:
db = Database()
with db('db1') as cursor:
cursor.execute("SELECT 1 FROM table_name") Neat idea! Some suggestions:
__exit__ should try to commit or roll back based on whether there is an unhandled exception, should then close the cursor, and should finally unconditionally close the connection. This is one of the main reasons for using a context manager - it is expected to always clean up after itself, leaving the relevant parts of the system in the same state as before using it.
I would reuse the configuration section name as the keys in the dict. That way you don't need to maintain a mapping in your head or the code - what's in the configuration is what you get when you use the context manager.
Rather than opening all connections and then using only one of them, it should open the connection and the cursor with the name passed in. Otherwise you're wasting resources. | {
"domain": "codereview.stackexchange",
"id": 33499,
"lm_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, mysql",
"url": null
} |
python, graph, mathematics, sympy
def _recursive(G):
# If the graph is not connected, then it has a rel poly of 0
if not nx.is_connected(G):
return sympy.Poly(0, p)
# if # edges > 0, then we perform the two subcases of the
# Factoring theorem.
if len(G.edges()) > 0:
e = random.choice(G.edges())
contracted = nx.contracted_edge(G, e, self_loops=False)
G.remove_edge(*e)
rec_deleted = _recursive(G)
rec_contracted = _recursive(contracted)
s = sympy.Poly(p)*(rec_contracted) + sympy.Poly(1-p)*(rec_deleted)
return s
# Otherwise, we only have 0 edges and 1 vertex, which is connected,
# so we return 1.
return sympy.Poly(1, p)
print(relpoly(nx.petersen_graph())) Some suggestions:
_recursive isn't a particularly descriptive name. A lot of things can be recursive. _relpoly_recursive may be a better name.
You can factor out the Poly call
s = sympy.Poly(p*rec_contracted + (1-p)*rec_deleted, p)
also note that I've removed the redundant parentheses.
Calling simplify on the result is completely useless, since rel is a Poly and Poly instances are always stored in canonical (expanded) form.
What is the value of going through the edges randomly? Don't you end up going through all of them.
As I noted in a comment, modifying the graph in-place seems problematic. I can't tell for sure just by looking at the code if it does the right thing or not. It seems that you should rather move the
H = nx.MultiGraph(G)
line to the top of the recursive function, and operate on H instead of G in the function. | {
"domain": "codereview.stackexchange",
"id": 20418,
"lm_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, graph, mathematics, sympy",
"url": null
} |
waves, acoustics, diffraction, classical-mechanics
Why aren't such phenomenon encountered in daily life, not being able to hear a source because of diffraction (or interference)? My question also relates to radio waves whose wavelengths is comparable to that of sound waves. These things do happen. The phenomena is called multipath interference. You don't notice it much in ordinary life becase there is rarely a situation where sound isn't being scattered from lots of different surfaces and that the frequency is pure enough so that there exists a single null point for all the sound. Note that the nodes and anti-nodes caused by the multipath interference move around as a function of frequency. Ordinary sounds contains a wide range of frequencies such that even if one specific tone is partly nulled out, we usually don't notice.
You can create situations without a fancy lab where you can observe interference effects yourself. For example, in college we put a speaker at one end of a long hallway and drove it with a frequency generator. At the right frequency, which was 43 Hz for that hallway if I remember right, there were nodes and anti-nodes dues to standing waves. You could of course still hear the tone at the anti-nodes, but it was significantly softer than at the nodes. The effect was strong enough that if you were at one of the nodes and started walking toward the speaker, the sound would get softer and you'd think it was coming from the other direction. It was great fun to see peoples' reactions that couldn't figure out where the sound was coming from.
With radio waves you can experience this more easily without a deliberate setup because any one radio transmission is in a very narrow frequency band. Particularly with commerical FM (about 3 meter wavelength) you can notice this driving around in a car. There will be spots where the reception is very poor, even though a few meters in any direction it will be better. | {
"domain": "physics.stackexchange",
"id": 11030,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "waves, acoustics, diffraction, classical-mechanics",
"url": null
} |
output voltage range of 0 to 10 volts will have a resolution of 39. For example the same digit 2 used in each of the decimal numbers 200, 20, and 2 contributes a different value in each number. The Decimal type also provides methods that convert Decimal values to and from Single and Double values. Power or exponents will be among the expressions that will be encountered in this section of the course. Wastes a combination to represent -0 0000 = 1000 = 0 10 2. The most significant bit of number is the sign bit. The second number is added to the first and is subtracted from the first; values are calculated to 18 digits in both decimal and binary. (4310) 5 Find the 9th and 10th complement of following decimal numbers a. binary to decimal confusion!!! signed numbers! OKay this makes no sense to me THe directions say: The following binary numbers have a sign in the leftmost postion and if negative, are in 2's complement form. %1100110 d. This article gives more details about the type, including its representation and some differences between it and the more common binary floating point types. Some works require only[0,5]×X via recoding digits of Y to one-hot representation of signed digits in[-5,5]. The binary numbers can be signed, unsigned, integers or fractions. There are many methods to multiply 2's complement numbers. 1 Floating Point Arithmetic CS 365 Floating-Point What can be represented in N bits? •Unsigned 0 to 2N • 2s Complement -2 N-1to 2 -1 • But, what about? –very large numbers?. | {
"domain": "ecbu.pw",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9658995723244552,
"lm_q1q2_score": 0.8028007124468136,
"lm_q2_score": 0.831143045767024,
"openwebmath_perplexity": 808.8451726687958,
"openwebmath_score": 0.4758775234222412,
"tags": null,
"url": "http://wkns.ecbu.pw/decimal-to-signed-magnitude-converter.html"
} |
organic-chemistry, inorganic-chemistry, alcohols, halogenation, amides
Title: Can I make orthophosphoric acid from sodium dihydrogen phosphate and an acid which I can use to make ethyl iodide? For my project I needed to di-substitute benzamide with ethyl group at N position to create DEB as a mosquito repellent. The first part of creating benzamide I was able to do, but the second part of substituting is a bit hard for me. I wanted to substitute using ethyl iodide as it was not a gas while the bromide and chloride was a gas.
Our lab apparently did not have the orthophosphoric acid to create hydroiodic acid in situ, so I resorted to using chloroethane, but I wasn't able to do it due to complications in my bubbling setup. Then I thought I could prepare orthophosphoric acid from sodium dihydrogen phosphate as it is available in our lab. Can someone help me on doing it,
or is there any other method to do it without the above methods?
The available materials are ethanol, $\ce{KI}$, $\ce{NaH2PO4}$, $\ce{HCl}$, $\ce{HNO3}$, $\ce{H2SO4}$, and there is no hydroiodic acid. Phosphoric acid can be produced from sulfuric acid $\ce{H2SO4}$, as it reacts with sodium dihydrogen phosphate $\ce{NaH2PO4}$ to produce phosphoric acid $\ce{H3PO4}$ according to : $$\ce{NaH2PO4 + H2SO4 -> NaHSO4 + H3PO4}$$ Phosphoric acid can be used to produce $\ce{HI}$ even if it is mixed with $\ce{NaHSO4}$. | {
"domain": "chemistry.stackexchange",
"id": 17690,
"lm_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, inorganic-chemistry, alcohols, halogenation, amides",
"url": null
} |
terminology, definition, non-linear-systems, complex-systems, stochastic-processes
Title: Stochastic system vs. stochastic process I work on a project on stochastic diffusive systems described by stochastic differential equations (SDEs).
My background is from dynamical systems, so I tend to call the system under consideration a stochastic system. However my collaborator has a statistics background, and they naturally name the systems under consideration a stochastic process.
Since we are currently finishing our article, there are parts of the text where we refer to systems and parts where we refer to processes.
So I was wondering whether I can use these two terms interchangeably, or whether there are some subtle formalities that I have to consider?
Or is stochastic system equivalent to stochastic process in every respect? TL;DR: "Stochastic system" is probably best, but either one is fine.
First, one can investigate a deterministic (non-stochastic) system using statistical tools that treat the variables as random (even though they aren't) so, since your system truly contains a random element, this fact is made more clear by using the term "stochastic system", which makes it arguably preferable to "stochastic process".
Besides, a given system can be described by different models, and a given model can yield different measurements (variables) — hence, one can ascribe different stochastic processes to the same system: So, calling it "system" highlights it's the focus of the work and the "process" is just being used to study it.
Now, that's of course a very fine distinction, and these terms often remain loosely defined, so it's also OK to just add a remark in the beginning of the paper along the lines of "the terms 'stochastic system' and 'stochastic process' are used interchangeably", or even to choose either term and stick to it throughout the text.
Here are some excerpts that, besides my own experience, might support my statements above:
Book chapter:
Variables that fluctuate randomly in time are called stochastic processes or random functions.
Lecture notes: | {
"domain": "physics.stackexchange",
"id": 79091,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "terminology, definition, non-linear-systems, complex-systems, stochastic-processes",
"url": null
} |
ros, catkin.workspace
Title: error processing catkin package gt_gui_cpp
Hello, I am trying to build the catkin workspace on fedora 23 . I am following instructions given here
Installation/Source-ROS Wiki. Under the section 2.1.3 Building the Catkin Workspace, for the command-
$
./src/catkin/bin/catkin_make_isolated
--install -DCMAKE_BUILD_TYPE=Release
My command line session shows the following : | {
"domain": "robotics.stackexchange",
"id": 26471,
"lm_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.workspace",
"url": null
} |
quantum-mechanics, heisenberg-uncertainty-principle, wave-particle-duality
Title: Did I get hit by a car this morning? Quantum mechanics allows us to describe a particle as a wave, and also a collection of particles, which a car happens to be. What separates a typical wave from a classical particle is that the position is not well defined for a wave.
I think that it is hard to tell exactly how big an atom is, because the electron of the atom may be anywhere, but the probability of finding the electron gets very small as you look far away from the nuclei. I think in some sense the atom is as large as we want, depending on the definition.
When a car drives past me, is the position of the car separate from my position in a quantum mechanical way, or is it correct to say that "part" of the car hit "part" of me? I understand that no matter the answer the force from the hit is so small that it is negligible in every way, but that is not the core of the question.
In addition, if I made any wrong claims, please correct me, thanks in advance. Asher's comment written above is simply wrong, and the reason is rather fundamental in quantum mechanics. "The car slightly hits you" isn't how it works in quantum mechanics.
The reason is that weak effects – such as very small but nonzero values of the wave function of an electron very far from the nucleus – do not cause tiny but observable effects like they do in classical physics.
Instead, the wave function has a probabilistic interpretation. So its being nonzero very far from the nucleus means that there is a small probability that a finite effect takes place.
So in quantum mechanics, you can ask whether a car hit you – whether some reaction took place. In quantum mechanics, questions about physical systems (including this one) have to be answered by measurements, otherwise they are physically and scientifically meaningless.
And quantum mechanics predicts some probabilities for one outcome of the measurement or another. If only 0.0001% of the integrated $\int |\psi|^2$ of the electron was located at the distance $R$ equal to the distance of your body from the car, then it means that there was a 99.9999% probability that no interaction has taken place at all. | {
"domain": "physics.stackexchange",
"id": 38741,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, heisenberg-uncertainty-principle, wave-particle-duality",
"url": null
} |
Can you now express the angle between their respective radial vectors as a function of time? (hint: find the difference in angular velocity and relate that to the angle between their respective radial vectors).
AM
6. May 3, 2013
### LovePhys
@voko and Andrew Mason
Thank you very much.
I can easily find angular velocity $ω=\frac{2\pi}{T}$. Also, since this is uniform circular motion, I then think that $θ=ωt$, so the angle between radial vectors as a function of time is: $\Deltaθ=t(ω_{1}-ω_{2})$. But $\Deltaθ=0$ only when t=0 (initial condition). Please tell me if I am missing something...
Thank you!
Last edited: May 3, 2013
7. May 3, 2013
### voko
What about $\Delta \theta = 2 \pi n$, where $n$ is integer?
8. May 3, 2013
### LovePhys
@voko
Yes!!! Why didn't I think about that??? Thanks a lot, I got the correct answer! Now I just let n=1 and then find t. :) | {
"domain": "physicsforums.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9790357567351324,
"lm_q1q2_score": 0.8093804110897975,
"lm_q2_score": 0.8267117983401363,
"openwebmath_perplexity": 748.6836320417647,
"openwebmath_score": 0.778552234172821,
"tags": null,
"url": "https://www.physicsforums.com/threads/two-satellites-in-parallel-orbits.689299/"
} |
bst = backsub[lu, perm, Mode -> Transpose];
bst[new] // Chop
{{23.9333 - 115.4 I, 1., -21.8 - 74.4 I},
{2.93333 + 32.9333 I, 2., 13.2 + 17.6 I},
{6.6 + 14.5333 I, 3., 9. + 8. I}} | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9664104962847372,
"lm_q1q2_score": 0.8289561017976111,
"lm_q2_score": 0.8577681068080749,
"openwebmath_perplexity": 2554.094342677018,
"openwebmath_score": 0.47746536135673523,
"tags": null,
"url": "https://mathematica.stackexchange.com/questions/161301/what-are-the-counterparts-in-wolfram-to-left-and-right-division-of-a-matrix-in-o"
} |
javascript, ecmascript-6, compression
document.getElementById("tree").appendChild(rectangle);
var text = document.createElementNS(svgNS, "text");
text.appendChild(document.createTextNode(letters[nodeName].frequency+"/"+inputString.length));
text.setAttribute("x", x+5);
text.setAttribute("y", y + 20);
text.style.fill = "black";
text.setAttribute("font-family", "monospace");
text.setAttribute("font-size", 14);
document.getElementById("tree").appendChild(text);
if (nodeName.length==1) {
let character = document.createElementNS(svgNS, "text");
character.appendChild(document.createTextNode(nodeName));
character.setAttribute("x", x+20);
character.setAttribute("y", y + 40);
character.style.fill = "black";
character.setAttribute("font-family", "monospace");
character.setAttribute("font-size", 14);
document.getElementById("tree").appendChild(character);
}
for (let i = 0; i < letters[nodeName].childrenNodes.length; i++) {
draw(letters[nodeName].childrenNodes[i], x + (i - 0.5) * space, y + 100, space / 2, id + 1);
let line = document.createElementNS(svgNS, "line");
line.setAttribute("x1", x + 25);
line.setAttribute("y1", y + 50);
line.setAttribute("x2", x + (i - 0.5) * space + 25);
line.setAttribute("y2", y + 100); | {
"domain": "codereview.stackexchange",
"id": 38257,
"lm_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, ecmascript-6, compression",
"url": null
} |
soft-question, astrophysics, units, conventions
CGS has persisted in astrophysics and continuum mechanics. The exact reasons are not 100% clear: however in both cases it is nice that it is within a few factors of 10 from the equivalent SI units, which allows you to quickly communicate to the engineers on the team what a wattage is if you have a power output in erg/s, so probably that is a huge factor. This reminds me of the eV unit where it is a compromise between the theorist's requirement that we never use Coulombs and the engineer's requirement that we use volts.
In the latter case of continuum mechanics, it's probably just because cgs gave nice names to viscosity properties, "poise" and "stokes". In the astrophysical case I am less certain, but it seems like it's probably just because occasionally theorists need the Maxwell equations and yet nobody really wants to be bothered by the permeability and permittivity of free space, these being highly unnecessary concepts created by the ubiquity of volts and amps. | {
"domain": "physics.stackexchange",
"id": 97630,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "soft-question, astrophysics, units, conventions",
"url": null
} |
scattering, simulations, gamma-rays
plt.plot(theta_vals, f_vals)
plt.title("PDF")
plt.xlabel("Theta")
plt.ylabel("f(theta)")
plt.show() $d\sigma$ needs to be converted to a probability density function $f(\theta)$, then plot $f(\theta)$.
The well-known cross section for Compton scattering is
$$
\frac{d\sigma}{d\Omega}
=\frac{\alpha^2(\hbar c)^2}{2s}
\left(\frac{\omega'}{\omega}\right)^2
\left(\frac{\omega}{\omega'}+\frac{\omega'}{\omega}-\sin^2\theta\right)
$$
where
$$
\omega'=\frac{\omega}{1+\frac{\hbar\omega}{mc^2}(1-\cos\theta)}
$$
We can integrate $d\sigma$ to obtain a cumulative distribution function.
Let $I(\theta)$ be the following integral of $d\sigma$.
(The $\sin\theta$ is due to $d\Omega=\sin\theta\,d\theta\,d\phi$)
\begin{equation*}
I(\theta)=
\int
\left(\frac{\omega'}{\omega}\right)^2
\left(\frac{\omega}{\omega'}+\frac{\omega'}{\omega}-\sin^2\theta\right)
\sin\theta\,d\theta
\end{equation*}
The solution is
\begin{multline*}
I(\theta)=-\frac{\cos\theta}{R^2}
+\log\big(1+R(1-\cos\theta)\big)\left(\frac{1}{R}-\frac{2}{R^2}-\frac{2}{R^3}\right)
\\ | {
"domain": "physics.stackexchange",
"id": 96546,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "scattering, simulations, gamma-rays",
"url": null
} |
c++, c++11, console, game-of-life
unsigned char Population::getPointColor(int x, int y) const {
return cells[getIndexOf(x, y)];
}
void Population::addPoint(int x, int y, unsigned char color) {
newCells[getIndexOf(x, y)] = color;
}
void Population::killPoint(int x, int y) {
newCells[getIndexOf(x, y)] = '\0';
}
NeighborData Population::getNeighborData(int x, int y, int depth) const {
int count = 0;
for (int cY = y - depth; cY <= y + depth; cY++) {
if (cY < 0 || cY >= height) continue;
for (int cX = x - depth; cX <= x + depth; cX++) {
if (cX < 0 || cX >= width || (cX == x && cY == y)) continue;
unsigned char color = getPointColor(cX, cY);
if (color != '\0') {
count += 1;
colorFreqs[color] += 1;
}
}
}
unsigned char c = consumeColorFrequencies();
return NeighborData(count,c);
}
void Population::decideLifeOf(int x, int y) {
NeighborData nD = getNeighborData(x, y, 1);
unsigned int ns = nD.count;
unsigned char color = nD.color;
if (ns < 2 || ns > 3) killPoint(x, y);
else if (ns == 3) addPoint(x, y, color);
}
int Population::getIndexOf(int x, int y) const {
return y * width + x;
}
void Population::replacePopulation() {
cells = newCells;
}
unsigned char randomColor(unsigned char starting) {
return (rand() % (COLORS - starting)) + starting;
} | {
"domain": "codereview.stackexchange",
"id": 12980,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, c++11, console, game-of-life",
"url": null
} |
# Proof verification for the equivalence of two sets.
I have constructed two identical draft proofs for the following question using implications and words. Can you please verify whether they are logically correct. Should I have used De Morgan's Laws?
Exercise:
Suppose that $$C,D$$ are subsets of a set $$X$$. Prove that $$(X\setminus C){\,}\cap{\,}D =D\setminus C.$$
Proof 1:
Suppose that $$x\in{(X\setminus C){\,}\cap{\,}D}$$. Then $$x\in{(X\setminus C)}$$ and $$x\in{D}$$. Then ($$x\in{X}$$ and $$x\notin{C}$$) and $$x\in{D}$$. Then ($$x\in{X}$$ and $$x\in{D}$$) and ($$x\in{D}$$ and $$x\notin {C}$$). Then $$x\in(X \cap D) \cap (D \setminus C)$$. Thus, $$x\in(D \setminus C)$$. So, $$(X \setminus C) {\,} \cap D \subseteq (D \setminus C)$$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9766692271169855,
"lm_q1q2_score": 0.815991052450215,
"lm_q2_score": 0.8354835289107307,
"openwebmath_perplexity": 547.5530576512327,
"openwebmath_score": 0.9999332427978516,
"tags": null,
"url": "https://math.stackexchange.com/questions/3074001/proof-verification-for-the-equivalence-of-two-sets"
} |
homework-and-exercises, thermodynamics, temperature, measurements
Title: Definition of temperature: "absolute" temperature and linear relations between temperature and thermometric properties I'm confused about the definition of temperature, and I would like to make some points clearer since I did not find an explanation.
Firstly I have heard of three adjectives regarding temperature (scales): empirical, absolute and thermodynamical.
I think I understood the difference between empirical and thermodynamical, but what is exactly meant by absolute?
Is this the same as "indipendent from the particular system used to measure temperature", or does this adjective indicates that the scale can only have positive numbers, with the $0 K$ placed, indeed, at absolute zero?
For example, ideal gas constant volume thermometer gives absolute temperature, because the measurement is not affected by the use of different gases, as long as they are ideal? Or is it because in the definition
$$T=\mathrm{lim}_{p_0->0} 273.16 \frac{p}{p_0} \, K$$
it is implicit that $T=0K$ is a temperature that can be reached only if $p=0 Pa$ (a limiting condition) and hence the scale has the zero in a very particular place, that cannot be reached? | {
"domain": "physics.stackexchange",
"id": 33690,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises, thermodynamics, temperature, measurements",
"url": null
} |
automata, regular-languages, regular-expressions
Title: Regular expression or automata for language with odd number of 0's and odd number of 1's Let $\Sigma=\{0,1\}$ and $L=\{u \in \Sigma^* : u \text{ has odd number of 0's and odd number of 1's}\}$. How can I build a regular expression or an automaton for this language? I have no idea, and I guess $L$ is not regular, but I haven't been able to prove it with the pumping lemma.
If it is not regular, can you give me a hint to prove it? Hint: You are trying to solve two problems (i.e., odd number of zeros and odd number of ones) at once. Try to solve each separately instead and then combine the solutions appropriately. | {
"domain": "cs.stackexchange",
"id": 12894,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "automata, regular-languages, regular-expressions",
"url": null
} |
How about a very primitive proof?
All positive integers are congruent to 0, 1, 2, 3, 4, or 5 (mod 6).
. . So we need to test only these six values.
. . . . . $\begin{array}{cccccc}
0^3 &=& 0 & \equiv & 0 & \text{mod 6)} \\
1^3 &=& 1 &\equiv & 1 & \text{(mod 6)} \\
2^3 &=& 8 & \equiv & 2 & \text{(mod 6)} \\
3^3 &=& 27 & \equiv & 3 & \text{(mod 6)} \\
4^3 &=& 64 & \equiv & 4 & \text{(mod 6)} \\
5^3 &=& 125 &\equiv& 5 & \text{(mod 6)}
\end{array}$
Why do I need to only check the six? Does this mean, if I had some congruence eqaution in mod 13, I would only have to test values from 0 to 12?
6. Originally Posted by Danneedshelp
Q1:
Prove or disprove: for every positive integer n, the congruence equation $n^{3}=n(mod6)$ must hold.
Here are my thoughts:
A1: Let n be any positive integer. Suppose $n^{3}=n(mod6)$ does not hold. Thus, it is not the case that $6|n^{3}-n$. Now, notice that $n^{3}-n=n(n^{2}-1)$. We can see that $n^{2}-1$ is even whenever $n$ is odd and vice-versa. Hence, either expression will at least be divisible by two, which is a factor of 6. Thus, $6|n(n^{2}-1)$ which is the same as $6|n^{3}-n$. This contradicts our original claim.
I don't know much about modular arithmetic, so I am not sure if I am doing this right.
Soroban has done this for you. | {
"domain": "mathhelpforum.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9585377237352756,
"lm_q1q2_score": 0.831086493477755,
"lm_q2_score": 0.8670357701094303,
"openwebmath_perplexity": 131.90170996293384,
"openwebmath_score": 0.8831621408462524,
"tags": null,
"url": "http://mathhelpforum.com/number-theory/154859-congruence-equation.html"
} |
python, beginner, algorithm, sorting, mergesort
The list elements must implement the `<=` operator (`__le__`). The sort is stable;
the order of elements which compare as equal will be unchanged.
Complexity: Time: O(N*Log N) Space: O(N)
"""
Implementation details, (which would be important for someone who is reviewing, maintaining or modifying the code) should be left as comments.
See sphinx-doc.org for one utility which can extract """docstrings""" to build documentation in HTML/PDF/HLP/... formats. | {
"domain": "codereview.stackexchange",
"id": 36065,
"lm_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, algorithm, sorting, mergesort",
"url": null
} |
javascript, jquery, game, html5, snake-game
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<body>
<canvas id="snakePlatform" width="400" height="400"></canvas></body> It's pretty good for a first game. There are a few things I would change:
1. Dependencies
You use jQuery for two purposes in your code: $(document).ready to trigger the game setup, and $(document).keydown to catch the keyboard events.
However, there really isn't any need to use jQuery for either of these things, so all it does is add to the load time of the page.
You can get rid of the $(document).ready completely if you move the JavaScript down to the bottom of the page (instead of inside the <head>).
You can replace $(document).keydown(function(event){ with document.addEventListener('keydown',function(event){.
2. Objects Namespaces
If you create a single component that uses a lot of JavaScript code, it is often considered best practice to put the code into an object. The biggest benefits of doing this are: | {
"domain": "codereview.stackexchange",
"id": 20604,
"lm_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, game, html5, snake-game",
"url": null
} |
slam, navigation, mapping, hokuyo, hector-slam
Originally posted by tlinder with karma: 663 on 2012-08-31
This answer was ACCEPTED on the original site
Post score: 1
Original comments
Comment by Tirgo on 2012-08-31:
Hello thx for your response. So basically i have to avoid spots with over 4-7 meter free space. That would explain the broken maps. Are there any tricks to work around? Or other stacks like hector_slam which could work? Because 4-7 meter is even indoor not that much.
Comment by bredzhang on 2015-12-17:
hector slam can handle slam without any odom param, I can understand when the robot do the linear move, but think about this situation, if the robot just do rotation in the same place, the hector slam can know the rotation accurate? and if it is a round spheric environment, I don't think hector c
Comment by Tirgo on 2016-04-08:
Depends on your hardware and the enviroment, but yes it can also handle rotations. If you have a short range laser scanner or an enivorement without many charactaristica you are running into problems. | {
"domain": "robotics.stackexchange",
"id": 10835,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "slam, navigation, mapping, hokuyo, hector-slam",
"url": null
} |
c++, c++11, pointers
template <typename T>
constexpr bool operator<=( optional<T> const& lhs, optional<T> const& rhs )
noexcept( noexcept( operator>( lhs, rhs ) ) )
{
return !operator<( rhs, lhs );
}
template <typename T>
constexpr bool operator>=( optional<T> const& lhs, optional<T> const& rhs )
noexcept( noexcept( operator<( lhs, rhs ) ) )
{
return !operator<( lhs, rhs );
}
// 20.5.8, comparison with nullopt
template <typename T>
constexpr bool operator==( optional<T> const& opt, nullopt_t ) noexcept
{
return !opt;
}
template <typename T>
constexpr bool operator==( nullopt_t, optional<T> const& opt ) noexcept
{
return !opt;
}
template <typename T>
constexpr bool operator!=( optional<T> const& opt, nullopt_t ) noexcept
{
return static_cast<bool>( opt );
}
template <typename T>
constexpr bool operator!=( nullopt_t, optional<T> const& opt ) noexcept
{
return static_cast<bool>( opt );
}
template <typename T>
constexpr bool operator<( optional<T> const& opt, nullopt_t ) noexcept
{
return false;
}
template <typename T>
constexpr bool operator<( nullopt_t, optional<T> const& opt ) noexcept
{
return static_cast<bool>( opt );
}
template <typename T>
constexpr bool operator<=( optional<T> const& opt, nullopt_t ) noexcept
{
return !opt;
} | {
"domain": "codereview.stackexchange",
"id": 19826,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, c++11, pointers",
"url": null
} |
structural-engineering
Title: Effect of Moment on Excavator arm i'm trying to apply free body diagram to simplified excavator consept.
As you see, earth drill causes moment on the arm. If we know the "L", we can find F = M / L. But let's say ground friction is very very high. The F force cant move the excavator. Then the arm is going to try take excavator down. Because the arm comes from upper not the ground level.
So the problem is how can i find the force and its moment arm which causes taking down? I will try to answer your question.
The problem, from what I can understand, goes something like this.
How are you going to determine the maximum weight the excavator arm can support without tipping over?
Your understanding is quite wrong there. It is not as simple as M = F*d. | {
"domain": "engineering.stackexchange",
"id": 1684,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "structural-engineering",
"url": null
} |
vectors, Calculating similarity and clustering question. Where did all the old discussions on Google Groups actually come from? First, it is computationally efficient when dealing with sparse data. So it shouldn't be there. What would happen if we applied formula (4.4) to measure distance between the last two samples, s29 and s30, for Thanks! So we can inverse distance value. The threshold for similarity. The following will find the most similar user to Praveena, and return their favorite cuisines that Praveena doesn’t (yet!) computing the similarity of Item B to Item A. The threshold for the number of items in the targets list. $\textrm{person} \times \textrm{movie} \mapsto \textrm{score})$ . However, standard cluster analysis creates “hard” clusters. So, in order to get a similarity-based distance, he flipped the formula and added it with 1, so that it gives 1 when two vectors are similar. f ( x, x ′) = x T x ′ | | x | | | | x ′ | | = cos. . Euclidean Distance 2. Who started to understand them for the very first time. The Euclidean Distance function computes the similarity of two lists of numbers. Right? The 95 percentile of similarities scores computed. If so, we can filter those out by passing in the similarityCutoff parameter. Use MathJax to format equations. Euclidean is basically calculate the dissimilarity of two vectors, because it'll return 0 if two vectors are similar. The distance between vectors X and Y is defined as follows: In other words, euclidean distance is the square root of the sum of squared differences between corresponding elements of the two vectors. smaller the distance value means they are near to each other means more likely to similar. We can use it to compute the similarity of two hardcoded lists. In the case of high dimensional data, Manhattan distance is preferred over Euclidean. While harder to wrap your head around, cosine similarity solves some problems with Euclidean distance. ? What is the similarity score for that customer? distance/similarity measures. Asking for help, clarification, or responding to other answers. If you have a square symmetric matrix of squared euclidean distances and you perform "double centering" operation on it then you get the matrix of the scalar products which would be observed when you put the origin | {
"domain": "qurumbusinessgroup.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9664104972521579,
"lm_q1q2_score": 0.8135491346899265,
"lm_q2_score": 0.8418256393148982,
"openwebmath_perplexity": 857.0032982544594,
"openwebmath_score": 0.5698342323303223,
"tags": null,
"url": "https://qurumbusinessgroup.com/dm8j07/4c0c03-euclidean-distance-similarity"
} |
raspberry-pi, cameras, ros-humble
$ ros2 run v4l2_camera v4l2_camera_node -ros-args --params-file /home/ubuntu/ros2ws/v4l2_camera_params.yaml
[INFO] [1667398998.222438071] [v4l2_camera]: Driver: unicam
[INFO] [1667398998.223092209] [v4l2_camera]: Version: 331580
[INFO] [1667398998.223198373] [v4l2_camera]: Device: unicam
[INFO] [1667398998.223268817] [v4l2_camera]: Location: platform:fe801000.csi
[INFO] [1667398998.223331871] [v4l2_camera]: Capabilities:
[INFO] [1667398998.223396278] [v4l2_camera]: Read/write: YES
[INFO] [1667398998.223460721] [v4l2_camera]: Streaming: YES
[INFO] [1667398998.223542720] [v4l2_camera]: Current pixel format: pgAA @ 2592x1944
[INFO] [1667398998.223637940] [v4l2_camera]: Available pixel formats:
[INFO] [1667398998.223709587] [v4l2_camera]: Available controls:
[INFO] [1667398998.225908478] [v4l2_camera]: Requesting format: 2592x1944 YUYV
[INFO] [1667398998.226086845] [v4l2_camera]: Success
[INFO] [1667398998.226256139] [v4l2_camera]: Requesting format: 640x480 YUYV
[INFO] [1667398998.226385618] [v4l2_camera]: Success | {
"domain": "robotics.stackexchange",
"id": 2646,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "raspberry-pi, cameras, ros-humble",
"url": null
} |
python, algorithm, dynamic-programming, pathfinding
What are your comments on this? What do you think are its drawbacks compared to the two solutions provided in the article? I'm particularly interested in comments regarding the time and space complexity of my algorithm. You can do it without using any additional table. I want to do it without recursion, but you can create recursive version very easily yourself.
First, let's see what is the second table in the link solution. In that table, the value of each table cell is the minimum cost for accessing that cell. But what about the cost table? in the cost table, the value of each cell is simply the cost of that cell.
So, for turning the cost table to the minimum cost table of each cell, we need to run the minimum-path algorithm on it.
For each cell, we will choose the minimum value of {cost of upper cell + cost of the current cell, cost of top-left cell + cost of the current cell, cost of left cell + cost of current cell}. Don't forget that we only allowed moving to the right, down and right-down, and because now we are moving in the opposite direction in each row, we should consider opposite movements.
Talking is enough, let's code speaks a little:
def test(cost, m, n):
# Initializing the first column
for i in range(1, m + 1):
cost[i][0] += cost[i - 1][0]
# Initializing the first row
for j in range(1, n + 1):
cost[0][j] += cost[0][j - 1]
for j in range(1, n + 1):
for i in range(1, m + 1):
cost[i][j] += min(cost[i - 1][j - 1], cost[i][j - 1], cost[i - 1][j])
return cost | {
"domain": "codereview.stackexchange",
"id": 35055,
"lm_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, algorithm, dynamic-programming, pathfinding",
"url": null
} |
javascript, jquery, event-handling
// don't override user action
if (!userScroll) {
// indicate that scroll happens programmatically
scriptScroll = true;
// do the scrolling
content.scrollTo(
( content.scrollLeft() + $('#col-' + hash).position().left ) - 20
, 500, {
onAfter: function() {
// done with JavaScript scrolling
// start polling current section again
scriptScroll = false;
}
});
}
userScroll = false;
} else {
// support back-button up to empty-hash state
content.scrollTo(0);
}
// on page load, scroll to the proper section
}).trigger('hashchange');
// scroll to the next/previous column controls
// just updating location.hash
// controller will take care of taking appropriate action
$('.column .scroll').bind('click', function(e) {
e.preventDefault();
var arrow = $(this);
// change the column
changeColumn({
direction : arrow.hasClass('right') ? 'right' : 'left',
currentColumn : arrow.closest('.column')
});
});// .scroll bind('click) fn
// handle left and right arrows
$(window).bind('keyup', function(e) {
// 37 – left arrow
// 39 - right arrow
if (e.keyCode == 37 || e.keyCode == 39) {
e.preventDefault();
changeColumn({
direction: (e.keyCode == 39) ? 'right' : 'left'
});
}
});// window bind('keyup') fn
// updates location.hash with slug of the column
// user wants to view, either by scrolling to it,
// either by navigating to it with arrows/header nav
//
// @param {Object} options object
// @option {String} direction – determens change direction
// @option {jQuery} currentColumn – currently selected column
function changeColumn(opts) { | {
"domain": "codereview.stackexchange",
"id": 151,
"lm_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, event-handling",
"url": null
} |
stability, chaos-theory, complex-systems
In this simple case, the LEs $λ_i$ are the real parts of the eigenvalues.
In general, Lyapunov exponents are properties of the dynamics, not of a certain point².
Roughly speaking, they are a temporal average of the projection of the Jacobian to a specific direction along the trajectory.
Analogously, chaos is a property of a dynamics or set of trajectories (a chaotic attractor, saddle, transient, or invariant set), not of a fixed point.
If you look at a stable fixed point, a trajectory within its basin of attraction will be very close to the fixed point for this average and thus you obtained the quoted definition¹.
For an unstable fixed point, almost any trajectory will eventually move away from it and its type of dynamics (fixed point, periodic, chaos, …) depends on the structure of the phase-space flow in regions distant from the unstable fixed point.
So, the nature of a fixed point does not tell you anything about a system being chaotic or not.
Your second quote alludes to the following:
Chaos does not only require a positive Lyapunov exponent, but also a bounded dynamics.
For example, $\dot{x} = x$ also has a positive Lyapunov exponent, but is not chaotic – it is unbounded and not folding back (also see this question on Math SE).
¹ “Given a dynamical system $\dot{\vec{x}}=\vec{F}(\vec{x})$ and a fixed point $\vec{x}_0$ such that $\vec{F}(\vec{x}_0)=\vec{0}$, the Lyapunov exponents are defined as the real parts of the relevant Jacobian eigenvalues.”
² “A notion of local/instantaneous/… Lyapunov exponents also exists, but it’s probably not what you’re asking about and doesn’t play into the definition of chaos.
³ “A strictly positive maximal Lyapunov exponent is often considered as a definition of deterministic chaos. This makes sense only when the corresponding unstable manifold folds back remaining confined within a bounded domain (an unstable fixed point is NOT chaotic)” | {
"domain": "physics.stackexchange",
"id": 48708,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "stability, chaos-theory, complex-systems",
"url": null
} |
java, algorithm, sorting
if (rangeLength < 2) {
return;
}
if (depth == 0) {
Heapsort.sort(array, fromIndex, toIndex);
return;
}
// Not deep enough, use quicksort. CLRS Chapter 7.1
int q = partition(array, fromIndex, toIndex);
sortImpl(array, fromIndex, q, depth - 1);
sortImpl(array, q + 1, toIndex, depth - 1);
}
// CLRS Chapter 7.1
private static int partition(int[] array, int fromIndex, int toIndex) {
int pivot = array[toIndex - 1];
int i = fromIndex - 1;
for (int j = fromIndex; j < toIndex - 1; ++j) {
if (array[j] <= pivot) {
int tmp = array[++i];
array[i] = array[j];
array[j] = tmp;
}
}
int tmp = array[++i];
array[i] = array[toIndex - 1];
array[toIndex - 1] = tmp;
return i;
}
}
Demo.java:
import java.util.Arrays;
import java.util.Random;
import java.util.stream.IntStream;
import net.coderodde.util.sorting.Introsort;
/**
* This class implements a demonstration of Introsort's performance as compared
* to {@link java.util.Arrays.sort}.
*
* @author Rodion "rodde" Efremov
* @version 1.6
*/
public class Demo {
private static final int LENGTH = 5000000;
private static final int ITERATIONS = 30;
public static void main(String[] args) {
long seed = System.currentTimeMillis();
System.out.println("Seed: " + seed);
Random random = new Random(seed);
long totalArraysSort = 0L;
long totalHeapsort = 0L; | {
"domain": "codereview.stackexchange",
"id": 15190,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, algorithm, sorting",
"url": null
} |
### Show Tags
12 Jan 2015, 12:48
1
This post was
BOOKMARKED
I also used a table to do this, like that:
1_2_3_4_5_6_7_8
1_1_1_1_1_1_1_1
2_2_2_2_2_2_2_2
3_3_3_3_3_3_3_3
4_4_4_4_4_4_4_4
5_5_5_5_5_5_5_5
6_6_6_6_6_6_6_6
7_7_7_7_7_7_7_7
8_8_8_8_8_8_8_8
Then you delete the same team pairs: e.g. 1-1, 2-2, 3-3 and then 2-1 (because you have 1-2), 3-2 (because you have 2-3). After you cross out the first 2 columns you then see that you cross out everything from the diagonal and below. The remaining is 28.
However, the 8!/2!*6! approach is better, because if you have many numbers the table will take forever to draw. In case there is sth similar though and your brain gets stuck, use the table...
Kudos [?]: 141 [0], given: 169
EMPOWERgmat Instructor
Status: GMAT Assassin/Co-Founder
Affiliations: EMPOWERgmat
Joined: 19 Dec 2014
Posts: 10158
Kudos [?]: 3530 [2], given: 173
Location: United States (CA)
GMAT 1: 800 Q51 V49
GRE 1: 340 Q170 V170
Re: There are 8 teams in a certain league and each team plays [#permalink]
### Show Tags
12 Jan 2015, 14:46
2
KUDOS
Expert's post
2
This post was
BOOKMARKED
Hi All,
Using the Combination Formula IS one way to approach these types of questions, but it's not the only way. Sometimes the easiest way to get to a solution on Test Day is to just draw a little picture and keep track of the possibilities....
Let's call the 8 teams: ABCD EFGH | {
"domain": "gmatclub.com",
"id": null,
"lm_label": "1. Yes.\n2. Yes.\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 1,
"lm_q1q2_score": 0.9136765275272111,
"lm_q2_score": 0.9136765275272111,
"openwebmath_perplexity": 3576.657479026001,
"openwebmath_score": 0.18992069363594055,
"tags": null,
"url": "https://gmatclub.com/forum/there-are-8-teams-in-a-certain-league-and-each-team-plays-134582.html"
} |
fluid-dynamics, integration, dimensional-analysis
\nonumber\\
&=\frac{P_s(x,t)^2}{2}\Biggr|_{P_s(o,t)}^{P_s(L,t)}+bP_s\Biggr|_{P_s(o,t)}^{P_s(L,t)} \end{align}
let $P_s(L,t)=P_{s,L}$ and $P_s(o,t)=P_{s,o}$
\begin{align}
&=\frac{P_{s,L}^2}{2}-\frac{P_{s,o}^2}{2}+P_{s,L}b-P_{s,o}b \\
\nonumber\\
&=\frac{1}{2}(P_{s,L}-P_{s,o})(P_{s,L}+P_{s,o}+2b) \\
\nonumber\\
\frac{V_t \mu P'_{s,o}(t)L}{k_lA}&=\frac{1}{2}(P_{s,L}-P_{s,o})(P_{s,L}+P_{s,o}+2b) \\
\nonumber\\
\frac{-1}{-1} \times \frac{2 V_t \mu P'_{s,o}(t)L}{k_lA(P_{s,L}-P_{s,o})}&=P_{s,L}+P_{s,o}+2b \\
\nonumber\\
\frac{-2 V_t \mu P'_{s,o}(t)L}{k_lA(P_{s,o}-P_{s,L})}&=P_{s,L}+P_{s,o}+2b
\end{align} | {
"domain": "physics.stackexchange",
"id": 15417,
"lm_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, integration, dimensional-analysis",
"url": null
} |
plink, nextflow
process step5 {
input:
tuple val(prefix), val(chr_name), path(bfiles) from step4_frq
path hrc_sites
"""
your_script.pl \\
-b "${prefix}${chr_name}.step4.bim" \\
-f "${prefix}${chr_name}.step4.frq" \\
-r "${hrc_sites}" \\
-h
"""
} | {
"domain": "bioinformatics.stackexchange",
"id": 1768,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "plink, nextflow",
"url": null
} |
python, python-3.x, django
#TODO Need to check the name
def get_bookmark_by_name(request):
bookmark = GetBookMarks.get_bookmark_by_name(request.GET.get("name", ""))
categories = GetCategories.get_categories_by_bookmark(bookmark)
result = [category.name for category in categories]
return HttpResponse(json.dumps(result), 'application/json')
def get_category(request):
category = Category.objects.get(name=request.GET.get('value', ''))
return render(request, 'BookMarker/partials/category.html', {
'category': category,
})
models.py
from django.db import models
class Category(models.Model):
name = models.CharField(max_length=50)
def __str__(self):
return self.name
class BookMark(models.Model):
name = models.CharField(max_length=50)
url_content = models.CharField(max_length=500)
category = models.ManyToManyField(Category)
def __str__(self):
return self.name Overall, this is pretty nicely written.
Abstractions and code structure
I am mainly concerned with the quality of the abstractions. Other reviews are also welcome but I am mainly concerned with the structure of the code.
The models are nice and simple, no comments there.
The classes in the views file are not great.
Since they only have static methods,
they are essentially utility classes.
As such, the methods don't really need to be in a class at all,
they could be simply top-level functions.
For example, these kind of calls are a bit awkward:
return Autocomplete.autocomplete(request, Category, 'name') | {
"domain": "codereview.stackexchange",
"id": 11244,
"lm_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, django",
"url": null
} |
quantum-field-theory, particle-physics, angular-momentum, conservation-laws, quantum-electrodynamics
Title: Spin conservation in pair production In QED, when two photons collide, they can turn into an electron and positron pair. We know from $U(1)$ gauge symmetry that the total charge of the initial and final states must be conserved. On the other hand, I expect that the total spin must also be conserved. But I do not quite get the details of how this works.
In this post the total spin of two-photon-state is discussed. Based on the transversality argument, OP argues there are three distinct spin states associated with the two-photon system. Two of them correspond to the spin-0 representation and the remaining one corresponds to a spin-2 state.
Based on the above argument, if the total spin in pair production is to be conserved, I would assume that the incoming photons must be in the spin-0 state, excluding the spin-2 state because the spin-state of the created electron-positron pair does not have a spin-2 representation. As far as I know, this spin state can have one spin-0 rep. and three spin-1 rep.
Edit: Also, in Wikipedia page there is Landau–Yang theorem, stating that a massive particle with spin 1 cannot decay into two photons. I suspect this selection rule follows from the requirement of the conservation of the total spin. Because as suggested in the linked question two-photon state does not have a spin-1 rep.
Is this reasoning correct?
The second point is about symmetry. If the total spin is to be conserved, what is the associated symmetry? I am thinking it must the rotational invariance of pair production amplitude. But what do the generators of this rotational symmetry look like? and where do they act? These generators must not correspond to the ordinary rotations in space. Because this would correspond to the conservation of orbital angular momentum, not spin. Spin angular momentum is not conserved; only the sum of spin and orbital angular momentum is conserved. As a trivial example of this, consider a hydrogen atom decaying from $2p$ to $1s$ by emitting a photon. The photon carries one unit of angular momentum, but the spin of the electron doesn't change; instead orbital angular momentum is lost. | {
"domain": "physics.stackexchange",
"id": 70750,
"lm_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, particle-physics, angular-momentum, conservation-laws, quantum-electrodynamics",
"url": null
} |
So we're left with the system:
$\begin{array}{rcll} x & \equiv & 2 & (\text{mod } 4) \\ x & \equiv & 4 & (\text{mod } 5) \\ x & \equiv & 2 & (\text{mod } 3) \end{array}$
And by the Chinese Remainder theorem, since $(4, 5, 3) = 1$, there is a unique solution modulo $4\cdot 5 \cdot 3 = 60$. Should be pretty simply to solve this one.
i get the right answer after applying the CRT to the reduced congruences, but i still dont know how u reduced the congruences or simplified them. Could you maybe explain it a little bit. Could u find the inverse modulo of each congruence and and reduce it to the form x=a mod m
5. Hello,
Divide the formula of o_O into 2 formulae:
1) If $ac\equiv bc\pmod m$ and $(c, m)=1$ then $a\equiv b\pmod m$.
2) If $ac\equiv bc\pmod {mc}$ then $a\equiv b\pmod m$.
1) corresponds to the case where you can find an inverse.
2) is a technique to decrease the modulus.
You add the modulus as many times as you want so that the coefficient of x and the right-hand-side have a common divisor.
Bye.
6. What I did was play around with the congruences a little. Remember, they sort of act like equality signs as well. Let's take the middle one I did: | {
"domain": "mathhelpforum.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9886682444653242,
"lm_q1q2_score": 0.8641723991314373,
"lm_q2_score": 0.8740772286044094,
"openwebmath_perplexity": 287.7361449484711,
"openwebmath_score": 0.8481968641281128,
"tags": null,
"url": "http://mathhelpforum.com/number-theory/49939-congruences-2-a.html"
} |
objective-c, ios
+ (instancetype)defaultModel;
@end
@interface ATProductModel : ATBaseModel
@property (strong, nonatomic) NSArray <ATProductSubModel *>* products;
@property (assign, nonatomic) ATFilterLayoutType layoutType;
@property (assign, nonatomic) BOOL recommended;
@end
NS_ASSUME_NONNULL_END
ATProductViewController.h
#import "ATProductModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface ATProductViewController : UIViewController
@property (strong, nonatomic) ATProductSubModel *model;
@end
ATProductViewController.m
#import "ATStringUtil.h"
@implementation ATProductViewController
@property (strong, nonatomic) ATProductModel *productModel;
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[self defaultModels];
}
- (void)defaultModels{
NSMutableArray *smallImages = [NSMutableArray arrayWithArray:self.model.smallImages];
if (![ATStringUtil containStr:self.model.icon inArr:self.model.smallImages]) {
[smallImages insertObject:self.model.icon atIndex:0];
}
self.model.smallImages = smallImages;
} | {
"domain": "codereview.stackexchange",
"id": 35825,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "objective-c, ios",
"url": null
} |
genetics, molecular-genetics, mutations, dna-damage
Title: Difference between mutation and DNA damage What is the strict difference between mutation and DNA damage? As far as I understand it, a mutation is an alteration in the genetic sequence, having "tricked" the repairing machinery and thus getting replicated in the future. DNA damage, on the other hand, is any alteration of the DNA molecule including breaks, chemical alterations of the molecule, etc.
Then, are mutations considered a type of DNA damage? I would thank the strict definition of both concepts. Have you read the DNA repair article on Wikipedia? The DNA damage and mutation section answers exactly what you're asking:
DNA damages and mutation are fundamentally different. Damages are physical abnormalities in the DNA... [and] can be recognized by enzymes, and, thus, they can be correctly repaired if redundant information, such as the undamaged sequence in the complementary DNA strand or in a homologous chromosome, is available for copying.... In contrast to DNA damage, a mutation is a change in the base sequence of the DNA. A mutation cannot be recognized by enzymes once the base change is present in both DNA strands, and, thus, a mutation cannot be repaired.
Here's the entry from the NCBI MeSH Glossary saying the same thing:
Injuries to DNA that introduce deviations from its normal, intact structure and which may, if left unrepaired, result in a MUTATION or a block of DNA REPLICATION... They include the introduction of illegitimate bases during replication or by deamination or other modification of bases; the loss of a base from the DNA backbone leaving an abasic site; single-strand breaks; double strand breaks; and intrastrand (PYRIMIDINE DIMERS) or interstrand crosslinking. Damage can often be repaired (DNA REPAIR).
And for mutation:
Any detectable and heritable change in the genetic material that causes a change in the GENOTYPE and which is transmitted to daughter cells and to succeeding generations. | {
"domain": "biology.stackexchange",
"id": 1435,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "genetics, molecular-genetics, mutations, dna-damage",
"url": null
} |
matlab, audio
Title: Understanding Digital Audio - "From Audio Device" in Matlab I understand that digital audio has both a sample rate (time "discretization") and a bit depth ("amplitude" discretization). Also, it can have multiple channels (stereo would be 2 channels).
But things that I can't find readily in the internet:
What is the range that is discretized in the bit depth? My experience is in motions, so I know if I have an accelerometer with a range of +-10 g's, and I discretize it in 8bit, well I would have a resolution of 20g/256. What would be the equivalence in audio?
Matlab's Simulink has a block for reading audio. It's output has the dimensions of MxN(xTime), where M is the number of "consecutive samples" and N the number of channels. What is "consecutive samples" (also called in the same help file as "Frame Size (samples)"). If I set this value to one, I would get what I would expect from a Mono sound, just a time history of amplitudes. But if I set it to two, it's almost as if they are both the same with minor differences in fast transitions. Is this meant for to get a average of the signals to be somewhat more "true to sound"? | {
"domain": "dsp.stackexchange",
"id": 1142,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "matlab, audio",
"url": null
} |
quantum-chemistry, computational-chemistry
Note that these results came from a program I wrote myself, but it usually match very well Szabo's [3] and Gaussian09 values for the total energy. If these results match your calculations, then the problem might be in integrals with higher angular momentum.
[1] Cook, Handbook of Computational Chemistry, Oxford University Press, 1998.
[2] T. Helgaker, P. Jørgensen and J. Olsen, Molecular Electronic-Structure Theory, Wiley, 2000.
[3] A. Szabo and N. Ostlund, Modern Quantum Chemistry, Dover, 1996. | {
"domain": "chemistry.stackexchange",
"id": 4666,
"lm_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-chemistry, computational-chemistry",
"url": null
} |
computational-chemistry, nmr-spectroscopy, software
Title: Software for simulating NMR spectra I am wondering is there any open source software that predict NMR spectra by giving the chemical shift?
Something like Spinach library http://spindynamics.org/group/?page_id=12 (Matlab is not free, so...). There is still the old WINDNMR programme developed by Hans Reich: https://www.chem.wisc.edu/areas/reich/plt/windnmr.htm which apparently should still work on modern versions of Windows.
It is not quite as sophisticated as Spinach, but if all you want is a 1D spectrum with various multiplets, then it is probably good enough.
If you have the computational resources, then there is software developed by Stefan Grimme's group https://xtb-docs.readthedocs.io/en/latest/enso_doc/enso.html, but you can't specify shifts manually, you need to generate them via a quantum chemical calculation using ORCA. Technically, all of these are free to use, but obviously it is not always practical. But in any case, if you are interested, the relevant publication is Angew. Chem. Int. Ed. 2017, 56 (46), 14763–14769. It should be possible now to run all the steps using just one ORCA input file; I suggest looking in the ORCA manual for more information. | {
"domain": "chemistry.stackexchange",
"id": 13342,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "computational-chemistry, nmr-spectroscopy, software",
"url": null
} |
complexity-theory
Title: How does "language" relate to "problem" in complexity theory? I am looking up the meaning of reduction in complexity theory:
On Wikipedia it says: reduction is an algorithm for transforming one problem into another problem
On the Princeton's notes on NP-Completeness, it says: reduction is whereby given all x $\in $ language L1, for instance f(x) $\in$ L2, apply decision algorithm to f(x), then L1 $<=$ L2
Can someone make clear how a language (which is just a bunch of numbers) relates to a problem? If they are used interchangeably, can someone show how does I can conceptualize a language as a problem?
Thanks A (decision) problem is a predicate on strings (that is, a property of strings) that can be either TRUE or FALSE; the problem is to decide whether a string satisfies the predicate (that is, has the property). We represent this predicate as the set of TRUE strings (that is, strings satisfying the property). A language is a set of strings. Thus the denotations of problem and language are the same – they are both sets of strings – and they can be used interchangeably. But semantically we use problem when our set of strings comes from a predicate, and language in other cases. | {
"domain": "cs.stackexchange",
"id": 3704,
"lm_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",
"url": null
} |
programming, q#
~\anaconda3\lib\site-packages\qsharp\__init__.py in reload()
70 Q# compilation errors are raised as an exception.
71 """
---> 72 client.reload()
73
74 def get_available_operations() -> List[str]:
~\anaconda3\lib\site-packages\qsharp\clients\iqsharp.py in reload(self)
117
118 def reload(self) -> None:
--> 119 return self._execute(f"%workspace reload", raise_on_stderr=True)
120
121 def add_package(self, name : str) -> None:
~\anaconda3\lib\site-packages\qsharp\clients\iqsharp.py in _execute(self, input, return_full_result, raise_on_stderr, output_hook, **kwargs)
207 # There should be either zero or one execute_result messages.
208 if errors:
--> 209 raise IQSharpError(errors)
210 if results:
211 assert len(results) == 1 | {
"domain": "quantumcomputing.stackexchange",
"id": 1655,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "programming, q#",
"url": null
} |
c++, unit-testing, template, boost, overloading
namespace TinyDIP
{
// Forward Declaration class Image
template <typename ElementT>
class Image;
template<class T = GrayScale>
requires (std::same_as<T, GrayScale>)
constexpr static auto constructRGB(Image<T> r, Image<T> g, Image<T> b)
{
is_size_same(r, g);
is_size_same(g, b);
is_size_same(r, b);
return;
}
template<typename T>
T normalDistribution1D(const T x, const T standard_deviation)
{
return std::exp(-x * x / (2 * standard_deviation * standard_deviation));
}
template<typename T>
T normalDistribution2D(const T xlocation, const T ylocation, const T standard_deviation)
{
return std::exp(-(xlocation * xlocation + ylocation * ylocation) / (2 * standard_deviation * standard_deviation)) / (2 * std::numbers::pi * standard_deviation * standard_deviation);
}
template<class InputT1, class InputT2>
constexpr static auto cubicPolate(const InputT1 v0, const InputT1 v1, const InputT1 v2, const InputT1 v3, const InputT2 frac)
{
auto A = (v3-v2)-(v0-v1);
auto B = (v0-v1)-A;
auto C = v2-v0;
auto D = v1;
return D + frac * (C + frac * (B + frac * A));
} | {
"domain": "codereview.stackexchange",
"id": 41999,
"lm_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++, unit-testing, template, boost, overloading",
"url": null
} |
1. Sep 27, 2017
DS2C
Not a homework problem, just something I came across in my book that makes sense but not fully.
1. The problem statement, all variables and given/known data
Factor: $a^4-b^4$
2. Relevant equations
3. The attempt at a solution
The book's solution:
$a^4-b^4$
$=a^4-a^3b+a^3b-a^2b^2+a^2b^2-ab^3+ab^3-b^4$
$=a^3\left(a-b\right)+a^2b\left(a-b\right)+ab^2\left(a-b\right)+b^3\left(a-b\right)$
$=\left(a-b\right)\left(a^3+a^2b+ab^2+b^3\right)$
Just what is going on here? Such a tiny binomial resulting in something way larger, with what seem like arbitrary terms added in.
Additionally, it gives another factorization of the given problem $a^4-b^4$ which is also factored into $\left(a^2-b^2\right)\left(a^2+b^2\right)$
You can have more than one correct solution when factoring a polynomial? In what situations would one be the "correct vs incorrect" way? Or is it synonymous with something like factoring 12 into 4*3, 6*2, 12*1 where they are all correct?
2. Sep 27, 2017
Staff: Mentor
You could still perform another factorization on $a^2-b^2$. Since it didn't say until only irreducible factors are left, it has indeed more than one solution.
3. Sep 27, 2017
DS2C
Man this factoring stuff goes deep. Feels like there should be an entire semester focusing on just this. Must be pretty important!
4. Sep 27, 2017
Staff: Mentor
It is, and of course it's always only up to units, as one can always factor $f(x) = c \cdot (c^{-1} \cdot f(x))$ and which is of no use. | {
"domain": "physicsforums.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.972414716174355,
"lm_q1q2_score": 0.8017189080369619,
"lm_q2_score": 0.8244619242200082,
"openwebmath_perplexity": 1030.8907307174075,
"openwebmath_score": 0.6978882551193237,
"tags": null,
"url": "https://www.physicsforums.com/threads/adding-annihilating-terms-to-factor.926789/"
} |
stabilizer-state
The motivations behind my question are that in this paper, on page 11 right after the beginning of the part A, they claim that a pure state stabilized by a family $\{g_1,...,g_n\}$ can be written in density matrix form as ( * ):
$$|\psi\rangle \langle \psi |=\frac{1}{2^n} \prod_{i=1}^n (1+g_i)$$
I am not understanding this. For me, this equation only implies that $|\psi\rangle$ will necessarily be stabilized by $\pm g_i$ but we do not know if it is a $+$ or a $-$.
For instance, I can show that $|\psi\rangle$ will be stabilized by any $\pm g_k$ ($k \in [1,n]$) because, first (I use $g_k^{\dagger}=g_k$ as it is an $n$-Pauli operator):
$$\pm g_k |\psi \rangle \langle \psi | (\pm g_k^{\dagger}) = g_k |\psi \rangle \langle \psi | g_k^{\dagger}=\frac{1}{2^n} \left(\prod_{i\neq k}^{n} (1+g_i) \right) g_k (1+g_k)g_k^{\dagger}=|\psi \rangle \langle \psi |$$
And then, for $A$ unitary, $A |\psi \rangle \langle \psi | A^{\dagger} = |\psi \rangle \langle \psi | \Rightarrow A |\psi \rangle = e^{j \phi} |\psi\rangle$. Then, as $A=g_k$ is also Hermitian, $e^{j \phi}=\pm 1$, hence $|\psi\rangle$ is stabilized by $\pm g_k$. | {
"domain": "quantumcomputing.stackexchange",
"id": 3817,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "stabilizer-state",
"url": null
} |
\begin{aligned} \sum_{k = 2}^{n - 1} k\lg k & < (\lg n - 1) \sum_{k = 2}^{\lceil n / 2\rceil - 1} k + \lg n \sum_{k = \lceil n / 2\rceil}^{n - 1} k \\ & = \lg n \sum_{k = 2}^{n - 1} k - \sum_{k = 2}^{\lceil n / 2 \rceil - 1} k \\ & \le \frac{1}{2} n(n - 1)\lg n - \frac{1}{2}\Big(\frac{n}{1} - 1\Big) \frac{n}{2} \\ & \le \frac{1}{2} n^2\lg n - \frac{1}{8} n^2 \end{aligned}
if $n \ge 2$.
Now we show that the recurrence
$$P(n) = \frac{2}{n} \sum_{k = 2}^{n - 1} P(k) + \Theta(n)$$
has the solution $P(n) = O(n\lg n)$. We use the substitution method. Assume inductively that $P(n) \le an\lg n + b$ for some positive constants $a$ and $b$ to be determined. We can pick $a$ and $b$ sufficiently large so that $an\lg n + b \ge P(1)$. Then, for $n > 1$, we have by substitution | {
"domain": "github.io",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9840936101542133,
"lm_q1q2_score": 0.8113477071958384,
"lm_q2_score": 0.8244619199068831,
"openwebmath_perplexity": 190.87764974590294,
"openwebmath_score": 0.9954012632369995,
"tags": null,
"url": "https://walkccc.github.io/CLRS/Chap12/Problems/12-3/"
} |
at BYJU 's connective which is first... Two inputs, say a and b: we will determine whether or not the given is! Think of the given statement is defined to be true whenever the two are! Binary operations along with their truth-tables at BYJU 's can state the truth tables determine! Statements are the same truth value, 4 months ago false only when the front is as! - 3 ; Class 6 - 10 ; Class 11 - 12 ; CBSE iff! From above binary biconditional statement truth table along with their truth-tables at BYJU 's always.... ( ~P ^ q ) and q is shown below is provided in the same truth! Tips on writing great answers summary: a biconditional statement is defined to be true the form x. Mistake, choose a different button truth or falsity of a conditional statement is p: 2 is even... Y is a truth table of logical equivalence means that the biconditional to an equivalence statement first are of length. Mathematical Thinking examples 1 through 4 using this method for the biconditional is Note that is always true to... And a quiz ; otherwise, it is helpful to think of the following: 1 p ” iff. Choose to omit such columns if you are confident about your work. in Texas if you are Houston. Do not see them, a value of a conditional free lessons and adding more guides... Class 1 - 3 ; Class 4 - 5 ; Class 6 - ;... X = 5. your Last operator learn the different types of unary and operations... Is equivalent to: \ ( ( m \wedge \sim p ) \Rightarrow r\ ) Solution will then the. Statement that is always false properties of logical equivalence and compound propositions thus be.!, using multiple operators double implication determine the truth table for biconditional: truth table each. Types of unary and binary operations along with their truth-tables at BYJU 's exists between statements... “ q implies that p < = > q is true only when front... Has two congruent ( equal ) sides. saying “ p implies q ” also! Meaning of these statements the implication p→ q is always true: ↔ is! A quadrilateral, then q will immediately follow and thus be true whenever the two statements have the truth... To show that | {
"domain": "scenv.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9648551546097941,
"lm_q1q2_score": 0.8661459199556888,
"lm_q2_score": 0.8976952818435994,
"openwebmath_perplexity": 716.6132722582131,
"openwebmath_score": 0.46349072456359863,
"tags": null,
"url": "https://scenv.com/dreamcatcher-you-cqq/479aff-biconditional-statement-truth-table"
} |
python, catkin
Title: Catkin insists on using em.py 3.4 and nosetests 3.4, when configured to use python 2.7
When I call catkin_make like this
catkin_make -DPYTHON_EXECUTABLE=/usr/bin/python2 -DPYTHON_INCLUDE_DIR=/usr/include/python2.7 -DPYTHON_LIBRARY=/usr/lib/libpython2.7.so
I see this in the output
-- Using PYTHON_EXECUTABLE: /usr/bin/python2
-- Using Python nosetests: /usr/bin/nosetests-3.4
-- Using empy: /usr/lib/python3.4/site-packages/em.py
Naturally my build process fails because the python 2 executable cannot interpret these versions. How do I force catkin to use the python 2.7 versions?
Originally posted by clauniel on ROS Answers with karma: 23 on 2014-09-16
Post score: 0
Creating a symboilc link from the 2.7 to 3.4 package helped me. I know this is not a perfect solution,but it works for now.
ln -s /usr/lib/python2.7/site-packages/em.py /usr/lib/python3.4/site-packages/em.py
Hoping someone with a better knowledge could provide a more concrete solution
Originally posted by marauder with karma: 26 on 2014-09-27
This answer was ACCEPTED on the original site
Post score: 1
Original comments
Comment by clauniel on 2014-10-06:
This is an option, but it also means you cannot use the 3.4 version for anything else anymore, right?
Comment by marauder on 2014-10-12:
Yes, it does | {
"domain": "robotics.stackexchange",
"id": 19417,
"lm_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, catkin",
"url": null
} |
statistical-mechanics, atomic-physics, entropy, atoms, cold-atoms
Remark 1: While the beam is being cooled in the first stage, one could also add that there is a slight increase of entropy due to the dispersion of the gas in the direction perpendicular to the beam's axis. I haven't accounted for it in the formula I have given. | {
"domain": "physics.stackexchange",
"id": 30562,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "statistical-mechanics, atomic-physics, entropy, atoms, cold-atoms",
"url": null
} |
electromagnetic-induction
Title: Is the induced current produced on a Loop of wire by a changing exterior magnetic flux only due to this exterior magnetic flux? Imagine a Loop of perfectly conducting wire with a Resistor with resistance R. The north pole of a magnet goes straight towards the loop and thus the magnetic flux through the Loop changes with time which induces an emf. My question is: If for example the rate of change of the exterior Flux is constant 10 Webers/sec (assming that this flux goes perpendicular to the surface) and the Resistance of resistor in loop is 5 Ohms. Would the current produced be 2 Amps? Or would we also need to consider the induced emf that tries to oppose the exterior change in flux? (which would then yield a smaller net flux and thus a smaller current through the Loop)
Or would we also need to consider the induced emf that tries to oppose the exterior change in flux?
Correct, you would have to consider this. The tendency of the loop to resist a change in its own current, because changing current induces a changing magnetic flux which induces a back emf, is known as the loop's inductance, denoted by $L$. The differential equation governing the current in the loop is then:
$$I = \frac{1}{R} \left[ \mathcal{E} - L \frac{\mathrm{d}I}{\mathrm{d}t} \right]$$
where $\mathcal{E}$ is the external emf due to the changing flux from the external magnet.
The value of $L$ is a function of the loop's geometry; a loop containing many tightly packed coils, for instance, would be much more efficient at generating a magnetic field that has a flux through itself, than a simple circular loop. | {
"domain": "physics.stackexchange",
"id": 93011,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electromagnetic-induction",
"url": null
} |
lagrangian-formalism, coordinate-systems, variational-calculus, constrained-dynamics
we can say that $d \delta \mathbf{r} = \delta d \mathbf{r} $ ?
meaning of $d \, ( \delta \mathbf{r} )$ or meaning of $\frac{ d }{dt}\delta \mathbf{r}$, if necessary in these expressions. | {
"domain": "physics.stackexchange",
"id": 68448,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "lagrangian-formalism, coordinate-systems, variational-calculus, constrained-dynamics",
"url": null
} |
spinors, dirac-matrices, lorentz-symmetry
$$
where
$$
(\sigma_{\mu \nu})_{a}^{\quad b} = -\frac{1}{4}\left(\sigma_{\mu}\tilde {\sigma}_{\nu}-\sigma_{\nu}\tilde {\sigma}_{\mu}\right), \quad (\tilde {\sigma}_{\mu \nu})_{\quad \dot {a}}^{\dot {b}} = -\frac{1}{4}\left(\tilde {\sigma}_{\mu} \sigma_{\nu}- \tilde {\sigma}_{\nu}\sigma_{\mu}\right),
$$
$$
(\sigma_{\mu})_{b\dot {b}} = (\hat {E}, \sigma_{i}), \quad (\tilde {\sigma}_{\nu})^{\dot {a} a} = -\varepsilon^{\dot {a}\dot {b}}\varepsilon^{b a} \sigma_{\dot {b} b} = (\hat {E}, -\sigma_{i}).
$$
Why do we always take the Dirac spinor as
$$
\Psi = \begin{pmatrix} \varphi_{a} \\ \kappa^{\dot {b}} \end{pmatrix},
$$
not as
$$
\Psi = \begin{pmatrix} \varphi_{a} \\ \kappa_{\dot {b}} \end{pmatrix}?
$$
According to $(1), (2)$ first one transforms as
$$
\delta \Psi ' = \frac{1}{2}\omega^{\mu \nu}\begin{pmatrix}\sigma_{\mu \nu} & 0 \\ 0 & -\tilde {\sigma}_{\mu \nu} \end{pmatrix}\Psi ,
$$
while the second one - as
$$ | {
"domain": "physics.stackexchange",
"id": 12329,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "spinors, dirac-matrices, lorentz-symmetry",
"url": null
} |
octomap, ros-kinetic
Title: Pick a cup from a table
Hi there.
I have been trying to pick up a cup from a table.
if the cup is at the edge of the table it works pretty well.
the thing is what I am doing is adding a "surface" under the detected cup (just a rectangle) and then it avoid the collision nicely.
But when the cup is not at the end of the table, the measures of the "surface" is hard coded, hence it doesn't avoid the table and the arm collide with it.
I have been looking for answers but I didn't find any, Is there a way to add the table to the collision avoiding with a not hard coded surface? using point-cloud or something? I have also seen something regarding Octomap if so is there any good tutorial for that? I couldn't understand the one on Move it tutorials.
My robot has kinect camera with point cloud2 and depth.
Originally posted by omer91 on ROS Answers with karma: 60 on 2020-01-02
Post score: 0
You can add the point cloud to the MoveIt collision scene as you're probably already doing with the hardcoded surface as explained in the perception tutorials. That tutorial is pretty well explained especially if you follow along with the previous tutorials in that series. You don't need to understand octomap beyond that it essentially is a compact representation for point clouds. I would recommend trying the setup with the panda arm used in the tutorial in simulation first and then setting up your own system once you get it working.
You would have to add a pretty accurate transformation to the tf tree from the base of your arm to the camera center. It would give you a collision scene that includes everything the camera can see, not necessarily the entire table.
Originally posted by achille with karma: 464 on 2020-01-05
This answer was ACCEPTED on the original site
Post score: 1 | {
"domain": "robotics.stackexchange",
"id": 34214,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "octomap, ros-kinetic",
"url": null
} |
python, genetic-algorithm
Title: Python genetic algorithm I haven't done any research into how you actually write a genetic algorithm, so this is my best guess. What I'm really curious to know is two-fold:
Have I created a genetic algorithm?
If I have, how can I continue to explore the subject more?
I hope this code and docstrings are enough explanation for how the code works.
from random import randint
import time
class Organism(object):
def __init__(self, r=0, g=0, b=0):
"""Initialize the class with the RGB color values."""
self.r = r
self.g = g
self.b = b
@property
def fitness(self):
"""The lower the fitness the better."""
total = self.r + self.g + self.b
return abs(765 - total)
@classmethod
def spawn(cls, parent):
"""Return a mutated generation of ten members."""
generation = []
for number in range(0, 10):
r = cls.mutate(parent.r)
g = cls.mutate(parent.g)
b = cls.mutate(parent.b)
generation.append(cls(r, g, b))
return generation
@staticmethod
def mutate(value):
"""Mutate the value by 10 points in either direction."""
min_, max_ = value - 10, value + 10
return randint(min_, max_)
def breed_and_select_fittest(individual):
"""Return the fittest member of a generation."""
generation = Organism.spawn(individual)
fittest = generation[0]
for member in generation:
if member.fitness < fittest.fitness:
fittest = member
return fittest
if __name__ == '__main__':
individual = Organism() # abiogenesis!
while True:
individual = breed_and_select_fittest(individual)
print individual.fitness | {
"domain": "codereview.stackexchange",
"id": 21855,
"lm_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, genetic-algorithm",
"url": null
} |
mechanical-engineering, electrical-engineering, structural-engineering, solid-mechanics, power-transmission
The pantograph or pole's uplist force creates a local rise in the wire as it passes, but it's very consistent; no stress hotspots. Note the droppers are made to rise up in a controlled way.
The next evolution of speed requires abandoning the trolley pole (at least for regular trains). Up until this point, wire tension was set as a compromise to work well in the summer without deforming or breaking the wire in the winter. In order to go faster than this, we really need "winter tension" all year, and that means the line must be actively tensioned with counterweights. (so in the winter, the shrinking metal lifts the counterweights instead of breaking). This requires interrupted segments of trolley wire, which preclude use of trolley poles for any but maintenance equipment (which could stop and move the pole to the other wire).
So why no catenary in photo 2? Because you're in "the twisty bits" there. Trains can't go all that fast, so catenary is not required.
What about current? Why is the catenary wire energized?
Plain and simple: because NOT energizing it would be a pain in the @$$, and make repairing the wire very dangerous.
Wire line work (on sub-5000 volt lines) is done with the trolley energized, from car roofs or platforms made of insulating material. Workers on the platform are simply energized at trolley voltage, and that is fine. Ground is lethal to them, and nothing may ever be passed up except via an insulated rope. Trailing a wire down is folly. As such, these systems take care that everything near the trolley wire is on the "energized" side of the insulator, or attached to a wood pole.
Does the catenary wire add to current ampacity? Sure, but it's just considered a bonus. Current is augmented by intentional feeder wire run parallel to the track, with bridging over to the trolley wire made every few poles depending on the voltage and draw. (due to the numerous droppers, tying to the catenary wire will suffice). | {
"domain": "engineering.stackexchange",
"id": 4721,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "mechanical-engineering, electrical-engineering, structural-engineering, solid-mechanics, power-transmission",
"url": null
} |
• @TMM Binomial coefficients are a bit of a sledgehammer here. Instead, more simply, one needs only that every sequence of consecutive integers of length $\rm\:b\:$ contains a multiple of $\rm\:b.\:$ See my answer. Jun 30, 2012 at 14:33
• @BillDubuque Why do you consider it is a sledgehammer? Maybe it is true from a number theoretical view, but very straightforward from a combinatorial one, right?
– Pedro
Jun 30, 2012 at 15:28
• @Peter Integrality of binomial coefficients is a much deeper result than said divisibility result. See the note I added to my answer. Jun 30, 2012 at 15:57
• @BillDubuque I ask again, Bill: In terms of combinatorics, isn't it "natural"? (I know in NT it is not trivial)
– Pedro
Jun 30, 2012 at 16:37
Hint $$\rm\ n\, =\, \color{#C00}a\:\!\color{#0A0}b\mid1\!\cdot\! 2\cdots\color{#C00} a\:\color{#0A0}{(a\!+\!1)\, (a\!+\!2) \cdots (a\!+\!b)}\cdots (\color{#90f}{ab\!-\!1})=(n\!-\!1)!\,\$$ by $$\rm\,\ \color{#0a0}{a\!+\!b}\le \color{#90f}{ab\!-\!1}$$
Note $$\rm\,\color{#0A0}b\,$$ divides $$\rm\color{#0A0}{green}$$ product since a sequence of $$\rm\,b\,$$ consecutive integers has a multiple of $$\rm\,b,\,$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9755769106559808,
"lm_q1q2_score": 0.817162692177969,
"lm_q2_score": 0.837619959279793,
"openwebmath_perplexity": 168.34378303999097,
"openwebmath_score": 0.9585927128791809,
"tags": null,
"url": "https://math.stackexchange.com/questions/164852/if-n-ne-4-is-composite-then-n-divides-n-1/164872"
} |
mathematical-physics, waves, acoustics, interference
Let's suppose the analogy is perfect, in that case you detect each frequency $\omega_n$, which would correspond to the trigonometric Fourier descomposition (using sines and cosines) of the detected wave.
In the case of an ideal string, the sound would be a sum of sines, where each possible frequency is a multiple integer of a fundamental one. In the case of a circular membrane, the solutions are sines and cosines, where the frequencies are related to the zeros of the Bessel functions.
Anyway, we detect the frequencies of the Fourier decomposition of the wave, not the eigenvalues of the differential equation, unless they both coincide.
Then, you ask:
So is there easy way of calculating Fourier eigenvalues, knowing the eigenvalues in the other basis?
The eigenvalues are:
$$Lf_n=\lambda_n f_n$$
where $L$ is the Sturm-Liouville operator. But a change of basis won't modify the eigenvalues. | {
"domain": "physics.stackexchange",
"id": 14122,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "mathematical-physics, waves, acoustics, interference",
"url": null
} |
Hence, the result.
Choose the correct answers in questions 20 and 21:
Question 20.
The value of $$\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}}$$(x3 + x cosx + tan5x + 1) dx is
(A) 0
(B) 2
(C) π
(D) 1
Solution:
∴ Part(C) is the correct answer.
Question 21.
The value of $$\int_{0}^{\frac{\pi}{2}}$$ log ($$\frac{4+3sinx}{4+3cosx}$$) dx is
(A) 2
(B) $$\frac{3}{4}$$
(C) 0
(D) – 2
Solution:
∴ I = 0.
∴ Part(C) is the correct answer. | {
"domain": "gsebsolutions.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9848109516378093,
"lm_q1q2_score": 0.8028498814343565,
"lm_q2_score": 0.8152324871074608,
"openwebmath_perplexity": 11807.031335431575,
"openwebmath_score": 0.9203677773475647,
"tags": null,
"url": "https://gsebsolutions.com/gseb-solutions-class-12-maths-chapter-7-ex-7-11/"
} |
Cohomology ring of BG - MathOverflow most recent 30 from http://mathoverflow.net 2013-05-24T18:02:24Z http://mathoverflow.net/feeds/question/116894 http://www.creativecommons.org/licenses/by-nc/2.5/rdf http://mathoverflow.net/questions/116894/cohomology-ring-of-bg Cohomology ring of BG Paul Siegel 2012-12-20T19:10:01Z 2012-12-20T20:30:11Z <p>Let $G$ be a compact Lie group, let $T$ be a maximal torus, and let $W$ be the Weyl group. My main question is as follows: </p> <ul> <li>How does one prove that <code>$H^\ast(BG,\mathbb{Q})$</code> is isomorphic to the $W$-invariant part of $H^\ast(BT,\mathbb{Q}) \cong \mathbb{Q}[[x_1, \ldots, x_n]]$? This is apparently basic knowledge in algebraic topology, because I keep reading "recall that..." followed by some version of this statement and no references. But I can't find a proof in any of my textbooks.</li> </ul> <p>I would ideally like a reference which also addresses the following secondary question:</p> <ul> <li>When is the natural map $H^\ast(BG,\mathbb{Z}) \to H^\ast(BT,\mathbb{Z})^W$ an isomorphism, and what can one say about the integral cohomology ring of $BG$ when it is not? Note the fact that the map above is an isomorphism for $G = U(n)$ is equivalent to the statement that the Chern classes are integral.</li> </ul> <p>Thanks!</p> | {
"domain": "mathoverflow.net",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9706877696726268,
"lm_q1q2_score": 0.8067803974944758,
"lm_q2_score": 0.8311430541321951,
"openwebmath_perplexity": 330.0774785984216,
"openwebmath_score": 0.9727056622505188,
"tags": null,
"url": "http://mathoverflow.net/feeds/question/116894"
} |
python-3.x, object-oriented, regex, console
def word_wrap(
text, width: int = None, indent: int = INDENT, max_width: int = MAX_CHARACTER_WiDTH
) -> str:
max_terminal_width = get_max_terminal_width(max_width)
width = min(max_terminal_width, width) if width else max_terminal_width
indent_width = INDENT_WIDTH * indent
lines = []
current_line = ""
for word in text.replace("\n", "").split(" "):
if len(current_line) + len(word) > width:
lines.append(indent_width + current_line.strip())
current_line = word
else:
current_line += " " + word
lines.append(indent_width + current_line.strip())
return "\n".join(lines)
def replace_text_w_regex(
file_path: str, compiled_text, regex
) -> None:
with open(file_path, "r+") as f:
file_contents = f.read()
file_contents = compiled_text.sub(regex, file_contents)
f.seek(0)
f.truncate()
f.write(file_contents)
def compile_latex(filename: str, latexmk: str):
"""
Runs the compilation for the latex file, example:
latexmk -xelatex -shell-escape
pdflatex
etc
"""
compile_command = f"{latexmk} {filename}"
os.system(compile_command)
def ask_user_2_confirm() -> bool:
return input(INDENT_STR + "[yes/no]: ").lower().strip() in ["yes", "ja", "ok", "y"]
def replace_suffix(filepath: Path, suffix: str = None) -> Path:
return filepath.with_suffix("").with_suffix(suffix) | {
"domain": "codereview.stackexchange",
"id": 41495,
"lm_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-3.x, object-oriented, regex, console",
"url": null
} |
Hence, there are: . $36 \times 126 \:=\:4,\!536$ ways to get 2 A's and 4 B's.
Therefore: . $Pr(\text{2 A's and 4 B's}) \:=\:\frac{4,\!536}{16,\!564} \;=\;\frac{54}{221}$
Get the idea?
4. Originally Posted by Kostas
Suppose you have an 18-card deck. 9 of the cards show the letter "A" and the rest 9 the letter "B". If you shuffle the deck and then draw 6 cards then what are the chances...
1) ...of having 6 "A"s?
...
of the 18 cards you have 9 A's.
thus your chance of getting an A on the first on the first draw is 9 out of 18. or 9/18
2nd card there are only 8 A's and 17 cards. 8/17
3rd card there are only 7 A's left with a total of 16 cards: 7/16
4th: 6/15
5th: 5/14
6th: 4/13
Multiply: 9/18 * 8/17 * 7/16 * 6/15 * 5/14 * 4/13
That will give you the probability of getting 6 A's on the first 6 draws.
---
Similiar procedure for the other questions.
5. Um, I'll try aidan's way for a bit...
3) 2 "A"s and 4 "B"s:
This goes: 9/18 * 8/17 * 9/16 * 8/15 * 7/14 * 6/13 = around 1/62 = around 1.6% which is too low I think... Soroban results in a 4,536/18,564 = around 25% (which I think it's correct). This way works for 6 "A"s but in this I think it's wrong, except if I am mistaken somewhere...
P.S. Soroban where you write 4,536/16,564 I think it's 18,564 | {
"domain": "mathhelpforum.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9890130554263734,
"lm_q1q2_score": 0.8284170752134226,
"lm_q2_score": 0.837619959279793,
"openwebmath_perplexity": 590.7954144426413,
"openwebmath_score": 0.7893233299255371,
"tags": null,
"url": "http://mathhelpforum.com/statistics/74312-small-problem.html"
} |
quantum-mechanics, quantum-field-theory, potential, perturbation-theory
Title: Is it possible to tell whether a potential is unbounded using only perturbation theory? A very common inverse problem in mathematical physics is trying to understand the potential of a quantum mechanical system given its scattering data. Such problems, although very interesting, are very challenging and usually ill-posed. I'm trying to understand one inverse problem that I guess is particularly simple.
Some quantum mechanical models are ill-defined because their potential is unbounded from below (e.g., $\phi^3$). Still, perturbation theory is typically well-defined, as least in the sense of formal power series. As far as Feynman diagrams is concerned, the theories $\phi^3$ and $\phi^4$ are not fundamentally different, although only the second one represents an approximation to a meaningful non-perturbative theory. The same thing can be said about standard quantum mechanical models such as an anharmonic oscillator with cubic and quartic terms.
Assume we are given an arbitrarily large but finite number of terms in the perturbative expansion of, say, the partition function of a certain unknown system. (Recall that the logarithm of partition function represents the ground state energy, so it is in principle observable). Question: Can we predict whether the underlying potential of such a series is bounded from below?
In other words, a single term in the perturbative series is qualitatively identical in the bounded and unbounded case. But what if we zoom-out and look at many terms? Does the (truncated) series contain any information that allows us to tell them apart? Or is the series truly oblivious to the behaviour of the potential far from the equilibrium position?
It seems clear to me that from a truncated series we can at best predict the probability that the potential is bounded. The more terms, the better the prediction (in the sense of a confidence interval). As long as the number is finite, we can never be sure the potential is bounded or not. But is there such a probabilistic estimator at all? or is it really impossible to even predict a probability? I hope I'm not misreading; I think the answer is certainly no. Let's say we have a potential $V(\phi)$. | {
"domain": "physics.stackexchange",
"id": 47731,
"lm_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-field-theory, potential, perturbation-theory",
"url": null
} |
planet, fundamental-astronomy, terminology, observational-astronomy
Title: Questions about terminology used for Mars and its moons I am having difficulty with some terminology:
sub-Martian hemisphere of Deimos ... what place on Deimos does it refer to?
leading/trailing apex of Phobos ... what place are those?
Apex ... in general it means a top of something, or an end of something pointed; but what does it mean on a relatively spherical body?
Anti-Mars meridian ... is this a meridian on the side of the moon facing away from Mars?
Thank you. Deimos is, like our own moon, tidally locked to Mars, so one hemisphere of Deimos faces the planet, and the faces away. The Sub-Martian hemisphere faces Mars.
Since Deimos is locked, there is a point on its surface that always faces in the direction of orbital motion, that point is the leading apex. It is an apex in the sense of a "leading point"
A meridian is a line of longitude, running from the North to the South pole. One of Deimos's meridians goes through the centre of its hemisphere that faces away from Mars, this is the anti-Mars Meridian. As you say, the "meridian on the side of Deimos facing away from Mars.
The image here shows a map of Deimos:
The leading face is the left side of the image, and the trailing face is on the right. The central 50% is the sub-martian hemisphere and the anti mars meridian is the line on the left and right edge, where the 3D image of Deimos has been cut to make a 2D map | {
"domain": "astronomy.stackexchange",
"id": 1137,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "planet, fundamental-astronomy, terminology, observational-astronomy",
"url": null
} |
thermodynamics, phase-transition, metals, liquid-state
A correct microscopic picture of the melting transition
The different behavior of many observables characterizes crystalline solids and liquids. However, we should not forget that amorphous solids exist, blurring many possible characterizations of the transition based on the concept of spatial order or, on average static quantities. Dynamical properties remain a much clearer indication of the passage from a solid to a liquid phase. In particular, the apparently simple concept that liquid flow and solid don't is a good starting concept to build intuition on the melting process.
Here, I'll try to underline a few (correct) ideas one can connect to the fact that liquids flow. | {
"domain": "physics.stackexchange",
"id": 74381,
"lm_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, phase-transition, metals, liquid-state",
"url": null
} |
Finish solving the differential equation; then use the second sentence to find A and B. Note that when t=0, y=600; and when t=10, y=30,000.
We’ll be seeing how to finish in the following answers. But for this version, the equation will turn out to be $$y = \frac{p}{1 + ke^{-rt}}$$ where $$k = e^{-Bp}$$ and $$r = Ap$$ are new constants derived from the arbitrary constants A and B; it doesn’t matter what A and B actually were. Instead, let’s think about what r and k themselves mean.
Observe that as t increases, y approaches p, as expected. (The whole population will eventually be infected in this model, which has no isolation and no immunity.)
The initial number infected (t = 0) is $$\displaystyle p_0 = \frac{p}{1+k}$$, so we find that $$k = \frac{p – p_0}{p_0},$$ which in our problem is $$\displaystyle k = \frac{260,000-600}{600} = 432.333$$. This is the initial ratio of uninfected to infected.
Similarly, if we know that after T days, the number infected is $$p_T$$, then $$\displaystyle p_T = \frac{p}{1 + ke^{-rT}}$$; solving this for r, we get $$r = \frac{1}{T}\ln\frac{p-p_T}{kp_T} = \frac{1}{T}\ln\frac{p_T(p-p_0)}{p_0(p-p_T)}$$
In our problem, after 10 days, the number infected is 30,000; so $$\displaystyle r = \frac{1}{10}\ln\frac{30,000(260,000-600)}{600(260,000-30,000)} = 0.40323$$. | {
"domain": "themathdoctors.org",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9923043519112751,
"lm_q1q2_score": 0.8247468572250122,
"lm_q2_score": 0.8311430415844385,
"openwebmath_perplexity": 630.2632837487861,
"openwebmath_score": 0.8452986478805542,
"tags": null,
"url": "https://www.themathdoctors.org/logistic-growth/"
} |
homework-and-exercises, fluid-dynamics, flow, bernoulli-equation, lift
Title: Is it possible to lift a bald person with an airstream? (Coanda effect and Bernoulli's principle) Lately, a high school teacher called Bruce Yeany has been uploading some fluid dynamics demonstrations on his YouTube channel. Here's his first demo video using various objects like vegetables and containers. He's also uploaded a follow-up demo with dolls.
There's a comment thread at the time of writing on that second video about whether or not it would be possible to lift an actual bald person using a rapid airstream.
I wasn't sure how to start, so here are my assumptions:
the person has average body proportions
the head of a bald person is roughly three quarters of a sphere (at the back)
the radius of that sphere is $r_{head}$ of about $8$ cm
the mass of the person is $m_{person}$ of about $80$ kg
atmospheric pressure of $1013$ hPa
airstream velocity $v_{air}$ (variable) | {
"domain": "physics.stackexchange",
"id": 78180,
"lm_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, fluid-dynamics, flow, bernoulli-equation, lift",
"url": null
} |
fft, downsampling, resampling
if I'm using the right code snippet to upsample/downsample?
highlight the benefits of upsampling(A to 4ms) compared to
downsampling(B to 1ms)?
The problem is that the output is distorted because
Your method is not quite correct. You have good reference in your question - How to resample audio using fft or dft. Please, read comment of Bjorn Roche to this question. And read answer of Jim Clay. Especially point 2).
Usually it is bad idea to use frequency filtration in frequency domain. There is good blog of Bjorg. See - Why EQ Is Done In the Time Domain | {
"domain": "dsp.stackexchange",
"id": 979,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fft, downsampling, resampling",
"url": null
} |
ros, matlab, rosservice, service
Title: When I try to do a client of a service of ROS, Matlab and ROS give me an error!
Hello! I'm trying to interface Matlab and ROS. I've a service in ROS and I want to do a client of this service in Matlab but when I do:
rosinit ('http://....:11311')
client = rossvcclient('/launch_by_service')
Matlab and ROS make me an error as this:
Failed to create a /launch_by_service service client.
[ERROR] ServiceClientHandshakeHandler - Service client handshake failed: client wants service /launch_by_service to have md5sum e1d8c050aed05957d504a68117eb0528, but it has 546971982e3fbbd5a41e60fb6432e357. Dropping connection.
When I do rosservice list from Matlab I see the service and the type. Can somebody help me? Thanks!
Originally posted by viola on ROS Answers with karma: 1 on 2016-05-03
Post score: 0
There is a difference in the service specification of the different nodes. Is this on one or on two PCs? Custom service?
You should check the md5 sums of the services on the respective machines with rossrv md5 PACKAGE/SRV and if they are not the same, you need to figure out which one to update.
Originally posted by mgruhler with karma: 12390 on 2016-05-03
This answer was ACCEPTED on the original site
Post score: 1 | {
"domain": "robotics.stackexchange",
"id": 24543,
"lm_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, matlab, rosservice, service",
"url": null
} |
newtonian-mechanics, forces, lagrangian-formalism, reference-frames, acceleration
Title: Lagrangian mechanics: May I consider the reference frame acceleration by adding an external force? Take a simple example like the pendulum with a moving support (But only considering the pendulum mass $m$, not the support mass $M$):
https://en.wikipedia.org/wiki/Lagrangian_mechanics#/media/File:PendulumWithMovableSupport.svg
From my understanding I could formulate the Lagrangian for the moving reference frame from the perspective of an observer sitting on the support. Using the pendulum angle $\theta$ as the only coordinate and considering only the velocity relative to the moving reference frame. $r$ is the length of the pendulum. With $L=T-V$ ($T$ for kinetic, $V$ for potential energy, $Q$ for generalized forces not included in the energy) I end up with:
$$
\frac{\mathrm{d}}{\mathrm{d}t} \frac{\partial L}{\partial \dot{\theta}} - \frac{\partial L}{\partial \theta} - Q = m r^2 \ddot{\theta} + m g r \sin \theta - Q = 0
$$
With the acceleration of the frame $\ddot{x}$ and the position vector of m, $\mathbf{r}$ I can add the only additional force:
$$
Q = \frac{\partial \mathbf{r}}{\partial \theta} \cdot \ddot{x} (-1, 0) = - m \ddot{x} r \cos \theta
$$
So I can eliminate $m$ and $r$ and get:
$$
r \ddot{\theta} + g \sin \theta + \ddot{x} \cos \theta = 0
$$
Which is the same solution as wikipedia gives for the moving pendulum. | {
"domain": "physics.stackexchange",
"id": 95889,
"lm_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, lagrangian-formalism, reference-frames, acceleration",
"url": null
} |
optics, visible-light, refraction
Title: light travels the fastest path of two points, how do you determine those two points? so in this diagram from Richard Feynman's book: QED Strange Theory of Light and Mater
the light takes the fastest path from S to P and the lens makes it so that there are many fastest paths that go through the lens. how does light 'choose' to follow the S to P paths, why not S to P where p is 5 more cm to the right? In the book Feynman talks at some length about how some set of putative paths will all contribute little arrows in the same direction and therefore not cancel out other paths, right?
Well, that only actually happens for certain pairs of point: those for which light actually goes from one point to the other.
If you choose starting and ending points for which there is no physical path on which light travels you get a negligible final result (essentially everything cancels out).
As a practical matter it is you may be able to deduce a set of rules for knowing in advance what pairs of points will "work". For ray optics those rules are
Light travels in straight lines unless it is reflected, refracted, scattered or absorbed.
On reflection the angle of reflection is equal to the angle of incidence
On refraction the light bends as it passes through an interface according to Snell's Law: $n_1 \sin \theta_1 = n_2 \sin \theta_2$
and thereby avoid an endless set of "well, it doesn't go from here to there" computations. | {
"domain": "physics.stackexchange",
"id": 55278,
"lm_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, visible-light, refraction",
"url": null
} |
Minimize trace($MX$) with $M$ rank-deficient and $X$ positive semidefinite
I have an optimization problem of the following form:
$$\min_{X\succeq0} \mathrm{trace\;} MX$$
under the linear constraint $\mbox{diag} (X) = \mathrm{Id}$ and the non-convex constraint $\mbox{rank} (X) = 1$. The matrix $M$ is square and rank-deficient.
The convex relaxation of this problem corresponds to dropping the rank-1 constraint, and merely keeping $X$ positive semidefinite.
I tried running a standard SDP solver (Mosek) on this problem but it yields a matrix $X$ which, despite satisfying the linear constraint and being positive semidefinite, is not of rank one. Instead, it is typically of rank $(n - \mathrm{rank\;} M)$ where $n$ is the number of rows of $X$.
Can you explain why I am getting this result? | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9867771774699747,
"lm_q1q2_score": 0.806763838375993,
"lm_q2_score": 0.8175744806385542,
"openwebmath_perplexity": 330.5804332073552,
"openwebmath_score": 0.8837171792984009,
"tags": null,
"url": "https://math.stackexchange.com/questions/2105348/minimize-tracemx-with-m-rank-deficient-and-x-positive-semidefinite"
} |
bash, installer
git-buildpackage is a suite of commands to create Debian packages based on Git repositories.
grunt-debian-package is a command to create a Debian package from a grunt build.
Consider the advantages of working with the ecosystem:
Less code for you to maintain.
The installation process works the way users expect it to. I, for one, don't like to run strangers' scripts as root, as I have no idea how they might be trashing my system. (And in my opinion, you are trashing my system, as I will discuss below.)
Users get the benefits of package management, such as clean uninstallation and upgrades, dependency and conflict checking, standard filesystem paths, etc.
You'll eventually need to package the product properly for release anyway, so you might as well start now.
Maybe you think it's OK for Popcorn Time to do its own thing. But if every application did the same, it would be chaos.
Building vs. installing
Your script commingles the build and installation steps. I'd like to see them separated:
The build process fetches the code from the Internet and generates installable packages. This step should be done without root privileges, as it runs a lot of complex programs, such as compilers.
The installation process, in contrast, usually does require root privileges. It should therefore be restricted to simple, trustworthy tasks, namely unpacking the previously generated packages and maybe running some pre- and post-install scripts. I'd like to have the opportunity to inspect the packages and the pre-/post-install scripts before performing the installation.
There should only be approximately one invocation of sudo that encompasses all of the installation process. After all, you shouldn't assume that /etc/sudoers contains a conveniently permissive entry for the user.
Respecting the user's machine
It appears that the application installs primarily to /opt/Popcorn-Time, which is good (for an application that is not managed as a .deb package). Anything that you install outside of /opt/Popcorn-Time would be unexpected, and should deserve special mention, perhaps even confirmation, and ideally avoided altogether.
You also write to | {
"domain": "codereview.stackexchange",
"id": 7843,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "bash, installer",
"url": null
} |
reductions, undecidability
I am thinking a decidable problem could be reduced to a recognizable, undecidable problem because a polynomial time verifier would work on a decidable problem. Is this a correct idea?
I think you're confusing the set of recognizable languages with NP. A recognizable language has a computable verifier but the verifier doesn't necessarily run in polynomial time (and the time hierarchy theorem says that there are languages whose verifiers can't run in polynomial time). It's true that every decidable problem has a computable verifier (because being able to decide the problem essentially means that you can verify a given answer by just computing the correct answer and comparing) but that doesn't give you a reduction. Rather, it proves that every decidable language is itself recognizable. | {
"domain": "cs.stackexchange",
"id": 8715,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "reductions, undecidability",
"url": null
} |
php, datetime, form
In both cases the second submit can happen just moments after the first, so I don't understand how a time-based limit can stop either kind of double submit.
In the past when I've wanted to prevent double submits without using redirects I've done so by keeping track of a unique key in the session everytime I displayed the form. When the form came back up, the unique key came with it (in a hidden input like yours), and I marked that unique key as "used". Anytime a submit came up I checked its key against the list of "used" unique keys. If the key in the form was marked as used, then I knew it was a double submit, and returned an error to the user letting them know.
As an aside, the need to send out a unique key with each form happens to also be a requirement for CSRF protection, so I actually just rolled both bits of functionality into one and killed two birds with one stone. | {
"domain": "codereview.stackexchange",
"id": 27629,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "php, datetime, form",
"url": null
} |
algorithms, arrays, integers, numerical-analysis
Title: Detecting overflow in summation Suppose I am given an array of $n$ fixed width integers (i.e. they fit in a register of width $w$), $a_1, a_2, \dots a_n$. I want to compute the sum $S = a_1 + \ldots + a_n$ on a machine with 2's complement arithmetic, which performs additions modulo $2^w$ with wraparound semantics. That's easy — but the sum may overflow the register size, and if it does, the result will be wrong.
If the sum doesn't overflow, I want to compute it, and to verify that there is no overflow, as fast as possible. If the sum overflows, I only want to know that it does, I don't care about any value.
Naively adding numbers in order doesn't work, because a partial sum may overflow. For example, with 8-bit registers, $(120, 120, -115)$ is valid and has a sum of $125$, even though the partial sum $120+120$ overflows the register range $[-128,127]$.
Obviously I could use a bigger register as an accumulator, but let's assume the interesting case where I'm already using the biggest possible register size.
There is a well-known technique to add numbers with the opposite sign as the current partial sum. This technique avoids overflows at every step, at the cost of not being cache-friendly and not taking much advantage of branch prediction and speculative execution.
Is there a faster technique that perhaps takes advantage of the permission to overflow partial sums, and is faster on a typical machine with an overflow flag, a cache, a branch predictor and speculative execution and loads? | {
"domain": "cs.stackexchange",
"id": 2303,
"lm_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, arrays, integers, numerical-analysis",
"url": null
} |
c++
Title: Displaying a menu I created this for a project at class, and I already turned it in so I know it's too late for changing it and whatnot as it's the end of the semester, but I want to know from the community how well I did. Don't judge all the std:: stuff. I built this using using namespace std;.
#include <iostream>
#include <fstream>
#include <vector>
using std::cout;
using std::cin;
using std::string;
using std::ifstream;
using std::iostream;
using std::endl;
using std::ofstream;
void openFile(){
string getcontent;
ifstream openfile ("namelist.txt");
if(openfile.is_open())
{
while(getline(openfile, getcontent))
{
cout << getcontent << endl;
}
}
}
void addName(){
string name;
cout << "Please type a name you would like to add:";
ofstream outfile;
outfile.open("namelist.txt", std::ios_base::app);
cin >> name;
outfile << name << endl;
cout << "Name added!" << endl;
outfile.close();
}
int main(int argc, const char * argv[]) {
char ch;
while(1) {
/// print the menu
cout << "Menu Lab v1" << endl;
cout << "--------------" << endl;
cout << endl;
cout << "A) Display Names in list" << endl;
cout << "B) Add a name to a list" << endl;
cout << "C) Exit" << endl;
cout << endl;
cout << "Enter your choice:";
cin >> ch;
cout << endl; | {
"domain": "codereview.stackexchange",
"id": 31583,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++",
"url": null
} |
newtonian-mechanics, forces, classical-mechanics, kinematics, calculus
Let $T(t)$ denote the thrust from the engine and $M(t)$ be the total mass of the rocket at time $t$.
At $t=0$, $T(0)=M(0)g$ (so that the normal force due to the launch pad needs not to be considered).
The acceleration $a(t)$ of the rocket at time $t$ can be obtained (along with other variables like the ejection speed of the fuel that are less important to my question) from Newton's second law of motion:
$$T(t)-M(t)g=\frac{dp}{dt}=\frac{d(M(t)v(t))}{dt}$$
$$=M(t)\frac{dv}{dt}+v(t)\frac{dM}{dt}=M(t)\frac{dv}{dt}=M(t)a(t)\tag{1}$$
So it seems to me that in general, we do not need to consider the $\frac{dM}{dt}$ term? But shouldn't $\frac{dM(t)}{dt}$ be non-zero if the total mass of the rocket is decreasing over time.
Or is it that the change in mass over time is accounted for by $M=M(t)$ alone already?
And when do we need we to consider the $\frac{dm}{dt}$ term in $N2$? Your second equation in $(1)$ isn't valid when the mass is changing, see here.
When you have a variable mass (or rather the mass of the body of concern is changing), you need to think carefully about the system on which you are applying the second law. Here are two ways to go about this: | {
"domain": "physics.stackexchange",
"id": 68708,
"lm_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, classical-mechanics, kinematics, calculus",
"url": null
} |
supernova, gaia, red-supergiant
Unfortunately you will probably find that data for extremely bright stars (G<3) is missing from the Gaia catalogue. The stars are too bright to be recorded and measured properly.
You probably would do better by search the Yale Bright Star Catalogue for objects with V<2.38 and a colour redder than some threshold (the catalogue also has spectral types, so you could just strip out the class I luminosity sources using this). You will then have to individually search for distance information to those stars (their parallaxes will not be very good).
You might find Messineo & Brown (2019) of interest. They produce a catalogue of red supergiants using the Gaia DR2 data (which still has the bright star problem). | {
"domain": "astronomy.stackexchange",
"id": 6376,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "supernova, gaia, red-supergiant",
"url": null
} |
electromagnetic-induction, inductance
Title: Where I made mistake(s)? of $~-\frac{d\left(\Phi\right)}{dt}-L\frac{dI}{dt}=RI~$ of a coil with a long bar magnet? The very long bar magnet and the coil exist .
I want to find out the amount of charges which flows as the bar magnet is inserted deep enough into the coil.
$$ J:=\text{strength of magnetization of the bar magnet} $$
$$ S:= \text{cross-sectional area of the bar magnet} $$
$$ N:= \text{number of the turns of the coil} $$
$$ R:=\text{total resistance of the coil} $$
$$ L:=\text{self-inductance of the coil} $$
$$ \Phi:=\text{sum of each magntic flux which penerates each surface of the turns of the coil} $$
$$ I:=\text{current which flows the coil(as induced EMF occurs)} $$
$~ \Phi_{} ~$ is constant for any time .
What I can't get currently is the below equation .
$$ \color{red}{} -\frac{ d \left( \Phi \right) }{ dt } - L \frac{ dI }{ dt } =RI \color{black} ~~~~~~~~~~~~~~~~~~~~~ \left( 1 \right) $$
I know Faraday's law of induction which can be represented in the below equation .
$$ \text{induced EMF of the coil}= -\frac{ d \left( \Phi \right) }{ dt } $$
And also I know that the above EMF of the coil can be represented by the below equation .
$$ \text{induced EMF of the coil} = -L \frac{ d \left( \text{current which flows the coil} \right) }{ dt } $$
So the $~ RI ~$ of the equation1 is a induced EMF of the coils . | {
"domain": "physics.stackexchange",
"id": 82006,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electromagnetic-induction, inductance",
"url": null
} |
water, ph
Title: How can water below a pH of 7 still be alkaline? Alkalinity is a measure of the water's ability to neutralize acidity and is expressed in levels of bicarbonates, carbonates, and hydroxides.
How can water that is slightly acidic, e.g. 5.5-6.5, still boast any alkalinity? Or put another way, is there a maximum level of alkalinity for water at any given acidic pH?
This is based on my understanding that acidity is, put simply, when there are more H+ than OH- ions. So why don't all carbonates react with the surplus H+ ions at pH ranges 5.5-6.5 until either alkalinity is 0 or the pH has reached a neutral 7? Classically, alkalinity is determined by $\ce{HCl}$ titration with methyl orange as indicator ( $\mathrm{pH}$ transition range $3.1 - 4.4$ ). IF some $\ce{HCl}$ is spent by lowering $\mathrm{pH}$ from $5.5-6.6$ to $\mathrm{pH}$ of noticing red colour, there is some nonzero alkalinity.
Note that at $\mathrm{pH} \approx 6.3$, the ratio $\dfrac{[\ce{CO2}]}{[\ce{HCO3-}]}$ is 1 : 1. (*)
Generaly, there is no direct relation between $\ce{pH}$ and maximal alkalinity, similarly as there is no direct relation between $\ce{pH}$ and $\mathrm{pH}$ buffer capacity.
But for typical water composition, containing $\ce{CO2/HCO3-}$ $\mathrm{pH}$ buffer, the alkalinity can be estimated from $\ce{pH}$ and expected $\ce{CO2(aq)}$ concentration, which is supposed to be in equilibrium with gaseous $\ce{CO2}$. | {
"domain": "chemistry.stackexchange",
"id": 14847,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "water, ph",
"url": null
} |
quantum-mechanics, quantum-information, entropy, landauers-principle
Title: Maximum theoretical data density Our ability to store data on or in physical media continues to grow, with the maximum amount a data you can store in a given volume increasing exponentially from year to year. Storage devices continue to get smaller and their capacity gets bigger.
This can't continue forever, though, I would imagine. "Things" can only get so small; but what about information? How small can a single bit of information be?
Put another way: given a limited physical space -- say 1 cubic centimeter -- and without assuming more dimensions than we currently have access to, what is the maximum amount of information that can be stored in that space? At what point does the exponential growth of storage density come to such a conclusive and final halt that we have no reason to even attempt to increase it further? The answer is given by the covariant entropy bound (CEB) also referred to as the Bousso bound after Raphael Bousso who first suggested it. The CEB sounds very similar to the Holographic principle (HP) in that both relate the dynamics of a system to what happens on its boundary, but the similarity ends there.
The HP suggests that the physics (specifically Supergravity or SUGRA) in a d-dimensional spacetime can be mapped to the physics of a conformal field theory living on it d-1 dimensional boundary.
The CEB is more along the lines of the Bekenstein bound which says that the entropy of a black hole is proportional to the area of its horizon:
$$ S = \frac{k A}{4} $$
To cut a long story short the maximum information that you can store in $1\ \mathrm{cm^3} = 10^{-6}\ \mathrm{m^3}$ of space is proportional to the area of its boundary. For a uniform spherical volume, that area is:
$$ A = V^{2/3} = 10^{-4}\ \mathrm{m^2}$$
Therefore the maximum information (number of bits) you can store is approximately given by:
$$ S \sim \frac{A}{A_\mathrm{pl}} $$ | {
"domain": "physics.stackexchange",
"id": 29609,
"lm_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, entropy, landauers-principle",
"url": null
} |
Find all Pythagorean triples $x^2+y^2=z^2$ where $x=21$
Consider the following theorem:
If $$(x,y,z)$$ are the lengths of a Primitive Pythagorean triangle, then $$x = r^2-s^2$$ $$y = 2rs$$ $$z = r^2+z^2$$ where $$\gcd(r,s) = 1$$ and $$r,s$$ are of opposite parity.
According to the previous theorem,My try is the following:
since $$x = r^2-s^2$$, $$x$$ is difference of two squares implying that $$x \equiv 0 \pmod 4$$. But $$x=21 \not \equiv 0 \pmod 4$$. Hence, there are no triangles having such $$x$$.
Is that right?
• I don't understand your argument at all. It is simply not true that the difference of two squares is always $\equiv 0 \pmod 4$. – lulu Dec 15 '18 at 0:10
• It was understandable before, but it is wrong. There are primitive triples with $21$. $(21,20,29)$, say – lulu Dec 15 '18 at 0:18
• The hint I wrote out in an earlier comment is close to a complete solution. You should be able to follow it to list all the triples with $21$. – lulu Dec 15 '18 at 0:20
• Squares are either $0 \text{ mod } 4$ or $1 \text{ mod } 4$, and hence there is at least one square which is $1 \text{ mod } 4$ and another which is $0 \text{ mod } 4$, whose difference will be $1 \text{ mod } 4$. – AlexanderJ93 Dec 15 '18 at 0:20
• @MagedSaeed Do not mind for misakes, that's the way we learn a lot! Your question was fine and properly posted. Bye – gimusi Dec 15 '18 at 0:33
Recall that | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9664104982195784,
"lm_q1q2_score": 0.8413543496451815,
"lm_q2_score": 0.8705972784807406,
"openwebmath_perplexity": 335.68157817996104,
"openwebmath_score": 0.7863243818283081,
"tags": null,
"url": "https://math.stackexchange.com/questions/3040030/find-all-pythagorean-triples-x2y2-z2-where-x-21"
} |
quantum-field-theory, lagrangian-formalism, gauge-theory, degrees-of-freedom, gauge
where I know there are three real degrees of freedom in $A_\mu$, because gauge fixing always removes one and we have no gauge fixing here.
What confuses me is that there must be two massive degrees of freedom, just as there were in the original theory. So that somehow means that one of the degrees of freedom in $A_\mu$ is massive while the other two aren't -- but how can that be? There's no mass term for $A_\mu$ in sight. What you can remove with a field redefinition (of the form of a $U(1)$ gauge transformation) is the phase of $\phi$. But the total number of degrees of freedom (dof's) is not going to change since the resulting lagrangian is not longer gauge invariant. The new counting is $3+1$ where the $3$ dof's come from $A_\mu$ (with a covariant constraint, see below, so that really $3=4-1$), and the 1 dof comes instead from the scalar radial mode of $\phi$.
More explicitly, write $$\phi(x)=e^{ie\pi(x)}\frac{h(x)}{\sqrt{2}}$$ (with both $\pi$ and $h(x)$ real scalar fields) and the covariant derivative $D_\mu \phi=(\partial_\mu-i e A_\mu)\phi$ becomes
$$
D_\mu \phi=e^{ie\pi}\left[ie(\partial_\mu\pi-A_\mu)+\frac{1}{\sqrt{2}}\partial_\mu h\right]
$$
so that the lagrangian reads
$$ | {
"domain": "physics.stackexchange",
"id": 46849,
"lm_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, lagrangian-formalism, gauge-theory, degrees-of-freedom, gauge",
"url": null
} |
Another modular approach to $C$ is via the $(2,3,10)$ triangle group, call it $G^*$, which appears in class VIII of the nineteen commensurability classes tabulated in
Takeuchi, K.: Commensurability classes of arithmetic triangle groups, J. Fac. Sci. Univ. Tokyo 24 (1977), 201-212.
According to Takeuchi's table, $G^*$ is the normalizer of the unit-norm group $G_1$ of a maximal order in a quaternion algebra over ${\bf Q}(\sqrt 5)$ ramified over one real place and the prime $(\sqrt 5)$.
Moreover $G_1$ is the $(3,3,5)$ triangle group, contained in $G^*$ with index $2$. Let $G_5$ be the normal subgroup of $G_1$ consisting of units congruent to $1 \bmod (\sqrt 5)$. Then $G^*/G_5 \cong \lbrace \pm 1 \rbrace \times A_5$, and the quotient of the upper half plane $\cal H$ by $G_5$ has genus $5$, so must be our $C$. Moreover, ${\cal H} / G_5$ has no elliptic points, so this identifies the image of the fundamental group $\pi_1(C)$ in ${\rm Aut}{\cal H} = {\rm SL}_2({\bf R})$ with an arithmetic congruence group. | {
"domain": "mathoverflow.net",
"id": null,
"lm_label": "1. Yes\n2. Yes",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9787126469647337,
"lm_q1q2_score": 0.8046869087671272,
"lm_q2_score": 0.8221891392358015,
"openwebmath_perplexity": 168.98352318438393,
"openwebmath_score": 0.918337345123291,
"tags": null,
"url": "http://mathoverflow.net/questions/89844/is-there-anything-special-about-the-riemann-surface-y2-xx1011x5-1?sort=newest"
} |
swift, ios, stackexchange, mobile
override init() {}
init(username:String,location:String,bronzeBadges:Int,silverBadges:Int,goldBadges:Int,profilePicUrl:String,profilePicImg:UIImage?) {
self._username = username
self._location = location
self._profilePicUrl = profilePicUrl
self._profilePicImage = profilePicImg
self._bronzeBadges = bronzeBadges
self._silverBadges = silverBadges
self._goldBadges = goldBadges
}
required init?(coder aDecoder: NSCoder) {
if let usernameObj = aDecoder.decodeObject(forKey: Keys.Username) as? String {
_username = usernameObj
}
if let locationObj = aDecoder.decodeObject(forKey: Keys.Location) as? String {
_location = locationObj
}
if let bronzeBadgesObj = aDecoder.decodeObject(forKey: Keys.BronzeBadges) as? Int {
_bronzeBadges = bronzeBadgesObj
}
if let silverBadgesObj = aDecoder.decodeObject(forKey: Keys.SilverBadges) as? Int {
_silverBadges = silverBadgesObj
}
if let goldBadgesObj = aDecoder.decodeObject(forKey: Keys.GoldBadges) as? Int {
_goldBadges = goldBadgesObj
}
if let profilePicUrlObj = aDecoder.decodeObject(forKey: Keys.ProfilePicUrl) as? String {
_profilePicUrl = profilePicUrlObj
}
if let profilePicImgObj = aDecoder.decodeObject(forKey: Keys.ProfilePicImg) as? UIImage {
_profilePicImage = profilePicImgObj
}
} | {
"domain": "codereview.stackexchange",
"id": 30171,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "swift, ios, stackexchange, mobile",
"url": null
} |
Much more can be said, but my computer is already freezing up at this big an answer.
Here's a partial answer that increases the lower bound for any (not necessarily optimal) solution to $$m\ge 74$$.
Suppose there is a solution with $$m$$ members and we know that there are two members each in $$l+1$$ commissions, then $$m\ge 9(l+1)+(8-l)(l+1)+2.$$ This is because if member one is in $$\ge l+1$$ commissions, each commission needs to be filled with $$9$$ new members since these $$l+1$$ commissions already have maximum overlap. For the commissions that member two is in, each needs $$9$$ more members to be accounted for. We can't have any overlap between these commissions because they already have maximum overlap (that being member two). We can at best choose one member from each group with member one in it, giving us $$l+1$$ members, but the other $$9-(l+1)=8-l$$ are new. This gives $$9(l+1)+(8-l)(l+1)$$ members other than the two we started with. (Note that this is the best bound in $$l$$ possible). | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9835969698879862,
"lm_q1q2_score": 0.8771826370558871,
"lm_q2_score": 0.8918110404058913,
"openwebmath_perplexity": 480.8203853774128,
"openwebmath_score": 0.827904999256134,
"tags": null,
"url": "https://math.stackexchange.com/questions/3023032/finding-the-minimal-number-of-members"
} |
newtonian-mechanics, fluid-dynamics, aerodynamics
\text{Temperature ($\mathrm{K}$)} & 288.15 & 277 \\
\text{Temperature ($\mathrm{^\circ{}C}$)} & 15 & 4 \\
\text{Pressure ($\mathrm{kPa}$)} & 101.325 & 82.0 \\
\text{Density ($\mathrm{kg/m^3}$)} & 1.225 & 1.03 \\
\end{array}
In this case, the density at the higher elevation is only $84\%$ the density at sea level. Thus the aerodynamic force will be only $84\%$ as strong, and the radius of curvature of the path, $R = mv^2/F$, will be $19\%$ larger. If I apply this to a kick that goes a distance $11\ \mathrm{m}$ in its original direction and also deflects $2\ \mathrm{m}$ sideways2, we originally have $R = 31\ \mathrm{m}$. Going from sea level to $1750\ \mathrm{m}$ elevation changes $R$ to $37\ \mathrm{m}$, which results in a deflection of only $1.4\ \mathrm{m}$.
The result is a measurable change from $2\ \mathrm{m}$ to $1.4\ \mathrm{m}$, though maybe this is not too large compared to player-to-player or kick-to-kick variation. For example, this analysis predicts the deflection will be affected by changes in the spin imparted to the ball in exactly the same way as changes to air density. And of course, weather conditions can vary a lot compared to the standard atmosphere model, and this analysis doesn't take into account how people react at different altitudes. | {
"domain": "physics.stackexchange",
"id": 21151,
"lm_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, fluid-dynamics, aerodynamics",
"url": null
} |
Suppose for contradiction that this is not the case. Then it must hold that the line $$b(y)$$ is parallel to to the plane spanned by the columns of $$P$$. That is, there exists a vector $$v$$ for which $$Pv = e_3$$. Let $$w$$ denote a non-zero solution to $$Pw = 0$$; one exists because $$P$$ is not invertible. Because $$P$$ is symmetric, $$w$$ must be orthogonal to $$Pv$$ for all $$v$$, which means that we must have $$e_3^Tw = 0$$. In other words, there is a non-zero vector $$w = (w_1,w_2,0)$$ for which $$Pw = 0 \implies w_1 \pmatrix{x_1\\x_2\\x_3} = -w_2 \pmatrix{x_2\\x_3\\x_4}.$$ If neither column is zero, then let $$\alpha = -w_1/w_2$$. We have $$P = x_1 \cdot \pmatrix{1 & \alpha & \alpha^2\\ \alpha & \alpha^2 & \alpha^3\\ \alpha^2 & \alpha^3 & \alpha^4} + \pmatrix{0&0&0\\0&0&0\\0&0&x_5-x_1\alpha^4}.$$ Because $$P$$ has rank $$2$$, the second matrix in this sum can't be zero. So, $$x_5 \neq \alpha x_4$$, since $$\alpha x_4 = x_1 \alpha^3$$. This means that $$(x_4,x_5)$$ is not a multiple of $$(1,\alpha)$$, which means that $$Pv = b_0$$ has no solution. This means that taking $$y = 0$$ gives us the desired outcome. (In fact, because the line is parallel to the column | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9759464485047916,
"lm_q1q2_score": 0.8024125704363921,
"lm_q2_score": 0.8221891392358015,
"openwebmath_perplexity": 46.36903564344159,
"openwebmath_score": 0.9857550263404846,
"tags": null,
"url": "https://math.stackexchange.com/questions/3904578/rank-preservation-of-hankel-matrix-by-adding-constrained-sample"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.