text stringlengths 1 1.11k | source dict |
|---|---|
quantum-mechanics, electrons, wavefunction
Title: Expectation value for the superposition of the two states (meaning of the imaginary part)
The wave function $\Psi$ of an electron that can exist in both states $n$ and $m$ is
$$
\Psi = a\Psi_n + b\Psi_m
\tag{6.28}
$$
where $a^*a$ is the probability that the electron is in state $n$ and $b^*b$ is the probability that it is in state $m$. Of course, it must always be true that $a^*a+b^*b=1$. Initially $a=1$ and $b=0$; when the electron is in the excited state, $a=0$ and $b=1$; and ultimately $a=1$ and $b=0$ once more. While the electron is in either state, there is no radiation, but when it is in the midst of the transition from $m$ to $n$ (that is, when both $a$ and $b$ have nonvanishing values), electromagnetic waves are produced.
The expectation value $\langle x \rangle$ that corresponds to the composite wave function of Eq. (6.28) is
\begin{align}
\langle x \rangle
& =
\int_{-\infty}^\infty x(a^* \Psi_n^*+b^*\Psi_m^*)(a\Psi_n + b\Psi_m)dx
\\ & = | {
"domain": "physics.stackexchange",
"id": 54515,
"lm_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, electrons, wavefunction",
"url": null
} |
ros, rviz, ros-melodic, odroid
I have seen solutions where Rviz is run on the local machine and all other nodes are run on remote computer. However my local machine is a Mac which does not have a ROS installation. Is there any way I can get Rviz to run on the remote computer?
Originally posted by Subodh Malgonde on ROS Answers with karma: 512 on 2018-07-26
Post score: 1
Hi,
yes the usual setup is to have rviz running locally because in this way one gets best responsiveness and no loss of data. I am successfully using ssh -X command. But to be honest it is not so responsive..... Other, platform independent, possibility is to use mplayer an nc. for server we are using (running on your computer):
while true
do
nc -l -p 9000 | mplayer -benchmark -cache 1000 -framedrop -fs -
done | {
"domain": "robotics.stackexchange",
"id": 31368,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, rviz, ros-melodic, odroid",
"url": null
} |
usb, camera
-- Configuring incomplete, errors occurred!
See also "/home/paulo/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/paulo/catkin_ws/build/CMakeFiles/CMakeError.log".
make: *** [cmake_check_build_system] Error 1
Invoking "make cmake_check_build_system" failed
Is this my fault or are there missing config files in this package?
Originally posted by End-Effector on ROS Answers with karma: 162 on 2015-03-12
Post score: 0
Have you run rosdep to check that you have all package dependencies installed?
Also: that package has been released for Hydro, so if you can, I'd install the binary version (ros-hydro-libuvc-camera).
Originally posted by gvdhoorn with karma: 86574 on 2015-03-12
This answer was ACCEPTED on the original site
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 21119,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "usb, camera",
"url": null
} |
optics, definition, polarization
I can't recall exact source from my memory... it would be my college chemistry classes.
Now a geology college-student is telling the above-thing is completely wrong. According to them,
The polarizing-crystal actually filters-out the magnetic-component and allows only the electric-component only, like this-
Fig 3.
Only electric-component coming-in. | {
"domain": "physics.stackexchange",
"id": 32851,
"lm_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, definition, polarization",
"url": null
} |
combustion, fuel, reaction-control
Wikipedia on gasoline
The bulk of a typical gasoline consists of hydrocarbons with between 4 and 12 carbon atoms per molecule (commonly referred to as C4-C12). It is a mixture of paraffins (alkanes), cycloalkanes (naphthenes), and olefins (alkenes).
Thus, diesel fuel contains mostly hydrocarbon molecules that have on average 12 or so carbon atoms, while gasoline contains hydrocarbons that contain on average 8 or so carbon atoms. The heavier, bigger molecules in diesel fuel means it evaporates more slowly at ambient conditions, requires more heating (i.e. more compression) before it spontaneously ignites. | {
"domain": "chemistry.stackexchange",
"id": 3756,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "combustion, fuel, reaction-control",
"url": null
} |
• what exactly is O? Also, in your attempt, why are you assuming your matrix is non-singular? Is that part of the statement? – user62748 Oct 31 '15 at 4:16
• Note: it is not possible for $M$ to be non-singular, because then $det(M)\neq 0$, but also $0=det(0)=det(M^3)=det(M)^3$. – vadim123 Oct 31 '15 at 4:23
• Do you know about the Jordan normal form? – Dylan Oct 31 '15 at 4:28
• BY $O$ do you mean $0$? – alex.jordan Oct 31 '15 at 5:42
• By $O$,question means null matrix. – Vinod Kumar Punia Oct 31 '15 at 7:55 | {
"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.8292122574022289,
"lm_q2_score": 0.8499711794579723,
"openwebmath_perplexity": 293.5820387997187,
"openwebmath_score": 0.9507633447647095,
"tags": null,
"url": "https://math.stackexchange.com/questions/1505897/let-m-be-a-non-zero-3-times-3-matrix-satisfying-m3-o/1505912"
} |
c#, unit-testing, linq, assertions
Check for null if a null can be returned. If your reviewer says you are checking for too many nulls, just indicate that the possibility is there so I have to check for it or it will cause an exception. So you should check for nulls in the following:
// Change this
var tooltipRows = Window.FindDataGrid("TooltipElementsDataGrid").GetAllRows();
// to this
var grid = Window.FindDataGrid("TooltipElementsDataGrid");
if (grid == null)
{
// Not found so either fail the test or return right away
// There is no need to do anything else
// Early returns make this really clear
}
Here you can also return right away:
if (tooltipRows.Count == 0)
{
Assert.Fail("No tooltip rows found");
return;
}
Early returns are great because it lets the reader know that if this case has been met, the rest of the code does not matter. More time is spent reading code than writing code, so make it easier for reading. | {
"domain": "codereview.stackexchange",
"id": 24653,
"lm_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, linq, assertions",
"url": null
} |
magnetic-fields, neutron-stars, superfluidity, pulsars
These "magnetars" are thought to have a strong magnetic field that powers the high energy radiation. Magnetic energy may be stored in the interior of the neutron star or in the magnetosphere by twisting the field into configurations with a lot of potential energy. This is then stochastically released as the field relaxes again, producing "flares". See for example Link (2014).
To some extent this process is a little bit like the magnetically powered flares on stars, but unlike stars, where the field is regenerated by an internal dynamo, it is thought that magnetar magnetic fields decay on timescales of 10,000 years. | {
"domain": "physics.stackexchange",
"id": 24916,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "magnetic-fields, neutron-stars, superfluidity, pulsars",
"url": null
} |
quantum-mechanics, schroedinger-equation
Title: Schrodinger equation in spherical coordinates I read a paper on solving Schrodinger equation with central potential, and I wonder how the author get the equation(2) below. Full text. | {
"domain": "physics.stackexchange",
"id": 1335,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, schroedinger-equation",
"url": null
} |
quantum-mechanics, heisenberg-uncertainty-principle, chaos-theory
Quantum mechanics is the best known description of reality, whenever gravity isn’t a major factor. For all practical applications (i.e., when we use it to model reality), it is not deterministic. However, there are some ways to interpret quantum mechanics in a way that would make the universe deterministic (hidden variables). This determinism has no bearing on reality though; it is hidden.
The indeterminism of quantum mechanics is related to the uncertainty principle: Properties of quantum objects (particles) are not fixed, but are drawn from distributions, i.e., they are uncertain. While some property of a particle can be certain (if you just measured it), there is always an uncertain property. The typical example for these properties are the position and velocity of a particle: If you know one, the other is maximally uncertain. | {
"domain": "physics.stackexchange",
"id": 27942,
"lm_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, chaos-theory",
"url": null
} |
• I've change the notation. It depends on the order of approximation for $u_x$. The first comes from $u(0,t)=u(1,t)$ and the second from $u_x(0,t)=u_x(1,t)$ – ilciavo Jul 9 '15 at 10:39
• u1=uN adds an additional restriction(equation u1−uN=0) to your system – ilciavo Jul 9 '15 at 12:33 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9648551566309688,
"lm_q1q2_score": 0.8239021212048709,
"lm_q2_score": 0.8539127510928476,
"openwebmath_perplexity": 413.6398636138754,
"openwebmath_score": 0.7531065344810486,
"tags": null,
"url": "https://scicomp.stackexchange.com/questions/20113/periodic-boundary-condition-for-the-heat-equation-in-0-1"
} |
MPI reduction algorithms 1. Generalized sparse matrix-matrix multiplication is a key primitive for many high performance graph algorithms as well as some linear solvers such as multigrid. Matrix Multiplication is a frequently used operation that takes two matrices A (m x q) Your assignment is to implement matrix multiplication using MPI in C/C++. And it's this. Each input matrix is split into a block matrix, with submatrices small enough to fit in fast memory. The multiplication of a vector by a matrix is the kernel operation in many algorithms used in scientific computation. First, augment your matmul program so that it prints out the wallclock time to perform the matrix multiplication, in seconds (Using MPI_Wtime is a good idea). inp ) MPI program to compute the Matrix and Vector Multiplication using self-scheduling algorithm. Introduction to Parallel Programming Matrix Multiplication Lab dimarifii1. It should be generally. 3 Block Multiplication Professor Karen Smith D. Can you help | {
"domain": "puntoopera.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9838471651778591,
"lm_q1q2_score": 0.8133580487147855,
"lm_q2_score": 0.8267117876664789,
"openwebmath_perplexity": 1441.1504902018999,
"openwebmath_score": 0.701557457447052,
"tags": null,
"url": "http://puntoopera.it/ruym/mpi-block-matrix-multiplication.html"
} |
ros, arduino, ros-kinetic, rosservices
Originally posted by Droter on ROS Answers with karma: 90 on 2018-07-30
Post score: 1
Followed the format on this post:
https://answers.ros.org/question/38719/ros-service-client-arduino-not-publishing/
It is working now.
Originally posted by Droter with karma: 90 on 2018-07-30
This answer was ACCEPTED on the original site
Post score: 1 | {
"domain": "robotics.stackexchange",
"id": 31413,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, arduino, ros-kinetic, rosservices",
"url": null
} |
human-biology, evolution, zoology, physiology, immunology
However, because there is a lot of homology across related species, it is feasible for a virus to infect more than one host. If a virus evolves in a context where it commonly infects multiple hosts, there can be selective pressures for it to maintain those abilities across all the hosts. Alternatively, selective pressures might cause the virus to evolve into separate lineages, one infecting ducks and another infecting sparrows, for example.
For a virus that is specific to a certain host (or range of hosts), it is likely that it will have difficulty in another host outside the context in which it evolved. However, there is also variability in viral genomes, and if many viral copies are exposed to a novel host, there is chance that some of them can survive in that host. This will select for those particular viral genes, and subsequent viral generations will be further selected for traits that help replicate in that host. | {
"domain": "biology.stackexchange",
"id": 9162,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "human-biology, evolution, zoology, physiology, immunology",
"url": null
} |
c#
//Resolving the registered dependencies
IPredictingFuture objPredictions = IoC.Resolve<IPredictingFuture>();
objPredictions.Writer = IoC.Resolve<IWriter>();
//Writing the message
objPredictions.Writer.WriteMessage(objPredictions.NewYearPrediction());
Console.ReadKey(true);
break;
default:
//Handing the invalid choice
Console.WriteLine("Invalid choice");
Console.ReadKey(true);
break;
}
}
}
} There are two issues I would like to emphasize in your question/code: | {
"domain": "codereview.stackexchange",
"id": 2876,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#",
"url": null
} |
java, security, cryptography, aes
Instead of inventing your own AEAD cipher, it is probably better and less error prone to use AES in GCM mode. There are reasons to prefer HMAC in some cases, but generally those are rather specific.
The number of iterations is an important security parameter, which should be clearly documented. It should definitely be higher than 60000 in most cases, more towards a million.
If there is a random salt for each encryption then you will get a different key for each encryption; using a different IV isn't really required (it can remain as an all-zero IV).
It may be a better idea to use public key encryption and signing instead of using secret keys. That would allow you to protect the plaintext with a real key instead of a password (a password can be used to protect the private keys).
There is no reason to call saltedSHA256 twice, it has no security consequences. | {
"domain": "codereview.stackexchange",
"id": 45337,
"lm_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, security, cryptography, aes",
"url": null
} |
javascript, object-oriented, html, dom, user-interface
</head>
<body>
<div class="container"><div>
</body>
</html>
JavaScript:
function Slider(sliderOpt) {
var inteval = 0;
var numSlide = 1;
this.fullCounter = sliderOpt.fullCounter;
(this.createSlider = function() {
if (sliderOpt.containerForSlider.charAt(0) == ".") {
var container = document.getElementsByClassName(sliderOpt.containerForSlider.substring(1, sliderOpt.containerForSlider.length))[0];
}
if (sliderOpt.containerForSlider.charAt(0) == "#") {
var container = document.getElementById(sliderOpt.containerForSlider.substring(1, sliderOpt.containerForSlider.length));
}
container.style.width = sliderOpt.widthSlider + "px";
container.style.height = sliderOpt.heightSlider + "px";
container.style.border = "2px solid #808080"; | {
"domain": "codereview.stackexchange",
"id": 6843,
"lm_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, object-oriented, html, dom, user-interface",
"url": null
} |
muscles, electrophysiology, neurotransmitter, protein-structure, electromuscular
However, the permeabilities aren't actually identical
There are many papers measuring relative permeabilities in nAChRs, I just chose one randomly as an example (happened to be the first Google Scholar result).
Nutter and Adams 1995 found the relative permeability of several monovalent and divalent cations, with Na as a reference: | {
"domain": "biology.stackexchange",
"id": 8716,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "muscles, electrophysiology, neurotransmitter, protein-structure, electromuscular",
"url": null
} |
javascript, finance, react.js, state
case "CAD":
this.setState({
MXN: value * CURRENCIES[4].value,
USD: value * CURRENCIES[4].value / CURRENCIES[1].value,
USDFix: value * CURRENCIES[4].value / CURRENCIES[2].value,
EUR: value * CURRENCIES[4].value / CURRENCIES[3].value,
CAD: value,
JPY: value * CURRENCIES[4].value / CURRENCIES[5].value,
GBP: value * CURRENCIES[4].value / CURRENCIES[6].value
});
break;
case "JPY":
this.setState({
MXN: value * CURRENCIES[5].value,
USD: value * CURRENCIES[5].value / CURRENCIES[1].value,
USDFix: value * CURRENCIES[5].value / CURRENCIES[2].value,
EUR: value * CURRENCIES[5].value / CURRENCIES[3].value,
CAD: value * CURRENCIES[5].value / CURRENCIES[4].value,
JPY: value,
GBP: value * CURRENCIES[5].value / CURRENCIES[6].value
});
break; | {
"domain": "codereview.stackexchange",
"id": 30387,
"lm_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, finance, react.js, state",
"url": null
} |
cosmology, temperature, dark-matter
Even neutrinos (with mass) as dark matter will be cold (now). That is because massless neutrinos would of course be relativistic and would have a similar temperature as the CMB, except that electron-positron annihilation after neutrino decoupling raises the photon temperature. However, neutrinos with mass decouple while still relativistic (for sensible neutrino masses), but become non-relativistic as the universe expands (when $p < m_\nu c$). As a result their temperature then declines more rapidly than the CMB.
The answer to your second question is that dark matter is called that because it does not have electromagnetic interactions. So it does not absorb or emit light of any wavelength. | {
"domain": "physics.stackexchange",
"id": 67591,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "cosmology, temperature, dark-matter",
"url": null
} |
c++, machine-learning, neural-network
class Neuron;
struct connection{
connection(int i){
weight=a_weight=0;
id=i;
}
void weight_val(double w){
weight=w;
}
void weight_acc(double a){
a_weight+=a;
}
void reset(){
a_weight=0.0;
};
void move(double m,double alpha,double lambda){
weight=weight-alpha*a_weight/m-lambda*weight;
}
double weight,a_weight;
int id=0;
};
typedef vector <Neuron> layer;
class Neuron{
public:
Neuron(int idx,int nxt_layer_size){
n_id=idx;
for(int i=0;i<nxt_layer_size;i++){
n_con.push_back(connection(i));
n_con[i].weight_val(rand()/double(RAND_MAX));
}
set_val(0.0);
is_output_neuron=false;
} | {
"domain": "codereview.stackexchange",
"id": 38881,
"lm_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++, machine-learning, neural-network",
"url": null
} |
ros
Title: Is there any cognitive architecture applications?
For example:
Is there any applications using cram-highlevel or other cognitive architecture available launch by roslaunch on simulations like gazebo?
I think applications will be great to start with understanding cognitive architectures.
Thank you~
Originally posted by sam on ROS Answers with karma: 2570 on 2012-03-26
Post score: 5
It appears there are not examples.
Originally posted by tfoote with karma: 58457 on 2014-03-26
This answer was ACCEPTED on the original site
Post score: 1 | {
"domain": "robotics.stackexchange",
"id": 8737,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros",
"url": null
} |
so even if you apply ax2 + bx + c = 0
you can say that x2 + 3x = 0
You know that b = 3, and the conclusion is 0, so no maths involved you just have to see that x2 = 0 and 3 (x) must be 3(0) = 0
I can't see how it could ever be proven using algebra?
Kind regards
Casio
#### Sudharaka
##### Well-known member
MHB Math Helper
Thanks for the above effort you have put in to explain that, but it's far too advanced for a quadratic that I was trying to understand, where my coursework advises the type to be simple quadratics.
So in my example,
x(x - 3) = 0 this is one solution, and
x = 3 is the second solution.
I think the whole point of my thread was to explain that no matter what anyone does to multiply out brackets as above, you just can't prove that x = 0 unless you are already told that?
so even if you apply ax2 + bx + c = 0
you can say that x2 + 3x = 0
You know that b = 3, and the conclusion is 0, so no maths involved you just have to see that x2 = 0 and 3 (x) must be 3(0) = 0 | {
"domain": "mathhelpboards.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9850429156022934,
"lm_q1q2_score": 0.8486521079697523,
"lm_q2_score": 0.8615382076534742,
"openwebmath_perplexity": 356.01625523466294,
"openwebmath_score": 0.7397609949111938,
"tags": null,
"url": "https://mathhelpboards.com/threads/quadratic-equations.1874/"
} |
ios, swift
NSURLConnection.sendSynchronousRequest(request, returningResponse: &response, error: &error)
println(response)
println(error)
})
} This:
var token = NSString(format: "%@", deviceToken)
token = token.stringByReplacingOccurrencesOfString("<", withString: "")
token = token.stringByReplacingOccurrencesOfString(">", withString: "")
token = token.stringByReplacingOccurrencesOfString(" ", withString: "")
is actually a bad method to convert an NSData object to an NSString
(containing the bytes in hexadecimal). It relies on description
having the format
<01020304 05060708 090a0b0c 0d0e0f10> | {
"domain": "codereview.stackexchange",
"id": 24112,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ios, swift",
"url": null
} |
volcanology, igneous
If lunar maria seem that large from Earth, it's only because the Moon is small!
But to know if lunar maria or LIPs would have looked like "glowing lava oceans shinning in the night", we need to look at emplacement rates rather than just areas and volumes. From the same chapter, one can calculate LIP emplacement rates of ~3-13 km3 per year. It may seem quite low (for comparison, ocean ridges quietly produce ~20 km3 per year), but it is an average output rate over a few million years. As noted on largeigneousprovinces.org, their might be pulses of magmatic activity, with peaks in production rate. This is exactly what's been inferred for lunar maria by Wilson and Head (2017): even if the average output rate has been calculated at a very low 0.01 km3 per year, they found that some flows could have been emplaced with rates up to 106 m3s-1!
As to whether this would have been visible from space: define "from space"! From low Earth orbit like the ISS? From the Moon itself? :) | {
"domain": "earthscience.stackexchange",
"id": 1913,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "volcanology, igneous",
"url": null
} |
electrostatics, energy-conservation, charge, batteries
Since energy conservation is a fundamental law, I think it is up to you to to disprove that the energy transferred to the two spheres is less than the energy stored in them at the end of the process.
Hope this helps. | {
"domain": "physics.stackexchange",
"id": 82981,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electrostatics, energy-conservation, charge, batteries",
"url": null
} |
navigation, gps, robot-localization
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.01, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.01, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.015] | {
"domain": "robotics.stackexchange",
"id": 29453,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "navigation, gps, robot-localization",
"url": null
} |
The force only force applied in this example is the spring force. The spring force is proportional to the displacement x, according to Hooke's Law. Therefore:
$$F_{spring} = -k\cdot x$$
Therefore, because $$\sum F=-k x$$, Newton's Law becomes $$-kx = m a$$, or (if you replace $$a = \ddot{x}$$) it more recognizable form for DE:
$$- kx = m \ddot{x}$$
or
$$m \ddot{x} + kx =0$$
# RLC circuit
you can find a nice derivation for the RLC electrical circuit here
Starting from Kirchoff's law, using Ohm law and other basic relationships to derive:
$$L \frac{d^2 q}{dt^2}+ R\frac{d q}{dt} + \frac{1}{C} q(t) = V_0\sin(\omega t)$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9783846628255124,
"lm_q1q2_score": 0.8153120032085605,
"lm_q2_score": 0.8333245953120233,
"openwebmath_perplexity": 868.5399635531236,
"openwebmath_score": 0.7677076458930969,
"tags": null,
"url": "https://engineering.stackexchange.com/questions/39701/obtaining-equation-from-real-life"
} |
newtonian-mechanics, forces, friction, free-body-diagram
Title: A conceptual doubt about friction acting on a car Suppose a car is at rest and you apply the accelerator, then the wheels are applying a horizontal force on the road so according to Newton's third law an opposite force (friction) pushes you forward. From what I understand no matter how much force you apply (hit the accelerator) the maximum force that can push you forward is the limiting friction. But then since the car is going with an acceleration forward friction should again act backward and there will be no net force, so the car doesn't move. How is this possible? The wheels of the car applies a force on the road. The horizontal component of the force applied by the road on the car is the friction.
Now let's see what actually friction is...
Friction is the force which opposes relative slipping between the two surfaces in contact. | {
"domain": "physics.stackexchange",
"id": 97243,
"lm_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, friction, free-body-diagram",
"url": null
} |
ros-indigo
Originally posted by Fei on ROS Answers with karma: 21 on 2016-02-13
Post score: 2
Original comments
Comment by ahendrix on 2016-02-14:
Have you looked in the .ros directory in your home folder?
Comment by Fei on 2016-03-02:
I looked at the .ros directory. It's not there. (There is a file called roscore-11311.pid. I believe it is not the core dump file. )
Comment by ahendrix on 2016-03-02:
You are correct; roscore-11311.pid is not the file you're looking for.
The coredump may be created in ~/.ros, or it may be created in the directory where you run rosrun, or it may not be generated at all if your system is not configured to generate core dumps (as noted in the tutorial).
If you can reproduce your problem easily and are having trouble obtaining core dumps, you may want to try following the directions in the tutorial for running your node in valgrind or gdb.
Originally posted by ahendrix with karma: 47576 on 2016-03-02
This answer was ACCEPTED on the original site
Post score: 2 | {
"domain": "robotics.stackexchange",
"id": 23755,
"lm_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-indigo",
"url": null
} |
html, css, sh, script, blog
That's where it's located on your system.
But for some folks it might be in /usr/bin or /usr/local/bin.
When publishing a portable script,
consider using this shebang:
#! /usr/bin/env bash
The env
utility is not exactly what you'd call feature rich.
It has been there since the dawn of time,
or at least the 70's.
It is soooo boring that even during the great Unix Wars
no one thought to mess with it or move it.
The big thing that it brings to this party
is it obeys ${PATH}, so it will find
the interpreter in whichever of the popular
locations it happened to land on this particular host.
BTW, I really like your
CSS reset.
It's reminiscent of the one offered by
Y!UI.
Putting all browsers on equal footing is really important
for being able to test once and have confidence the test
result translates to other browsers. | {
"domain": "codereview.stackexchange",
"id": 44787,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "html, css, sh, script, blog",
"url": null
} |
It was less clear to me whether continuity was sufficient. However, a counterexample is given (implicitly) in this answer; $f: x \mapsto \sqrt{|x|}$ has a unique global minimum at $x=0$, a unique local minimum at $x=0$, is continuous, but it is not convex. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9859363725435202,
"lm_q1q2_score": 0.8279242560567233,
"lm_q2_score": 0.8397339616560072,
"openwebmath_perplexity": 192.67594085380222,
"openwebmath_score": 0.7582205533981323,
"tags": null,
"url": "https://math.stackexchange.com/questions/2749428/does-a-unique-global-and-local-minimum-imply-strict-convexity"
} |
java, algorithm
Title: Group a list of objects by property and remove the first value from each group I have a list of Students and I want group this list by the property NAME, to sort each group ASC by the property GRADE, to remove the first entry from each Group and after thatto return the proccesed list.
Here is what I've done.
package com.example.demo;
import java.security.KeyStore.Entry;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class Test {
public static void main(String[] args) { | {
"domain": "codereview.stackexchange",
"id": 43047,
"lm_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",
"url": null
} |
newtonian-mechanics, forces
Perhaps such boats are designed such that steering alone makes them lean toward the turn (due to a specific shape of the underwater tail, some hydrodynamical trick).
During improper turn the vessel leans outward the turn, than it sinks a little, and in this new configuration there's an adequate momentum. So that the vessel doesn't turn around, it just passes the turn with a lower speed. | {
"domain": "physics.stackexchange",
"id": 75985,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "newtonian-mechanics, forces",
"url": null
} |
filters, infinite-impulse-response, impulse-response, digital-filters, filtering
Title: Question about ideal filters Following shows the discrete time Fourier transform of an ideal low pass filter with cutoff frequency $\omega_c$:
$$H\left(e^{j\omega}\right) =
\begin{cases}
1, & \text{if $|\omega| \le \omega_c$} \\
0, & \text{otherwise}
\end{cases}
$$
Taking inverse discrete time Fourier transform would result in following infinite support impulse response:
$$h[n] = \frac{\omega_c}{\pi} \operatorname{sinc}\left(\frac{\omega_c n}{\pi}\right)$$ | {
"domain": "dsp.stackexchange",
"id": 9228,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "filters, infinite-impulse-response, impulse-response, digital-filters, filtering",
"url": null
} |
image-segmentation, segmentation
Variations on the watershed algorithm: unfortunately does not seem well designed for boundaries. One can filter the image with a Gaussian whose width is high enough that the output image resembles a topographic image, but I don't know a good method for picking the positions from which to start pouring water, and the blurring may cause the smaller watersheds to disappear.
Performing random walks that cannot cross the black lines, starting from many random pixels, and keeping track of the number of times each pixel is visited by each random walker, then performing various clustering algorithms on the counts. This separates the closed regions (which can be done in other ways) but does not consistently separate the unclosed regions. | {
"domain": "dsp.stackexchange",
"id": 12206,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "image-segmentation, segmentation",
"url": null
} |
complexity-theory, asymptotics, runtime-analysis, recurrence-relation
Thanks to the substitution method in your try 2, you have found $c=b=1$ will enable the induction step for $T(n)\le cn-b$ to work. However, if the base case is $T(1)$, the inequality does not hold.
Instead of sticking to proving "$T(n)\le n-1$ for $n\ge0$", you can try proving "$T(n)\le n-1$ for $n\ge 3$" instead. Now the base case is "$T(n)\le n-1$ for $3\le n\lt 6$", which can be proved easily.
When we want to find some proposition that can be proven by mathematical induction, we can change the domain of the proposition so that the base case in a mathematical induction will be able to succeed. This useful freedom of choice can enable us to make progress. (We could also, of course, change the proposition so that the base case can succeed.) | {
"domain": "cs.stackexchange",
"id": 19983,
"lm_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, asymptotics, runtime-analysis, recurrence-relation",
"url": null
} |
electrochemistry, gas-laws, temperature, gas-phase-chemistry
read the data sheets carefully
Finally, read each sensor's data sheet carefully and note carefully the specific voltages that each sensor needs. The "Air quality" sensors need you to run for a certain amount of time (about a minute) at one voltage, then a different amount of time at another voltage because the surface chemistry is a bit more complex.
Sensors can also be found here: | {
"domain": "chemistry.stackexchange",
"id": 12276,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electrochemistry, gas-laws, temperature, gas-phase-chemistry",
"url": null
} |
time-limit-exceeded, swift, mathematics
func readInteger() -> Int {
while true {
guard let line = readLine() else {
fatalError("Unexpected end-of-file")
}
if let n = Int(line) {
return n
}
print("Please enter an integer")
}
} | {
"domain": "codereview.stackexchange",
"id": 24759,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "time-limit-exceeded, swift, mathematics",
"url": null
} |
python, lowpass-filter, butterworth, bilinear-transform
# Begin calculation
for idx in range(len(t)):
# One timestep of the calculation
xprev = x # move the old x_(n) value to x_(n-1)
x = x_storage[idx] # bring in the current datapoint to be the new x_(n)
yprev = y # move the old y_(n) value to y_(n-1)
y = (wc*Ts*(x-xprev)+(2-wc*Ts)*yprev)/(2+wc*Ts) # calculate the new y_(n) according to the filter equation
y_storage[idx] = y # store the y_(n) value for later plotting
plt.figure()
plt.plot(t,y_storage) | {
"domain": "dsp.stackexchange",
"id": 6751,
"lm_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, lowpass-filter, butterworth, bilinear-transform",
"url": null
} |
filters, analog-to-digital, digital-to-analog
char uartBuff[8];
float32_t iir_coeffs[5] = {0.00102, 0.002041, 0.00102, 1.908, -0.9116}; //B0, B1, B2, A1, A2
float32_t iir_mono_state[4];
float32_t Rx_Buff_f[4];
float32_t Rx_Buff_f_out[4];
arm_biquad_casd_df1_inst_f32 monoChannel;
void DMA1_Stream0_IRQHandler(void) {
if (((DMA1 -> LISR) & (DMA_LISR_TCIF0)) != 0){
DMA1 -> LIFCR |= DMA_LIFCR_CTCIF0;
TC_Callback = 1;
}
else if (((DMA1 -> LISR) & (DMA_LISR_HTIF0)) != 0){
DMA1 -> LIFCR |= DMA_LIFCR_CHTIF0;
HC_Callback = 1;
}
}
int main(void) {
init_Clock();
init_I2S();
//init_Debugging();
init_Interrupt();
//init_SpeedTest();
arm_biquad_cascade_df1_init_f32(&monoChannel, 1, iir_coeffs, iir_mono_state);
while (1)
{
if (HC_Callback == 1){
// GPIOA->BSRR |= GPIO_BSRR_BS3_HIGH;
for (int i = 0; i < 2; i++){
Rx_Buff_f[i] = (float32_t)RxBuff[i];
} | {
"domain": "dsp.stackexchange",
"id": 9432,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "filters, analog-to-digital, digital-to-analog",
"url": null
} |
coordinate x∈ R 6 of the frame configuration and then take derivative; (2) Geometric Jacobian: directly relate θ ˙to the spacial/body twist V. Revised - Nov. Similarly,. (14) by explicitly evaluating the Jacobian as the determinant of 3 £3 matrix. We use a fast algorithm to reduce area distortion resulting in an improved reparameterization of the cortical surface mesh (Yotter et al. Use a 3x3 matrix. The sides of the region in the x - y plane are formed by temporarily fixing either r or θ and letting the other variable range over a small interval. In theory, you can calculate CoM jacobian by doing partial derivative but this a very tedious task and impossible in practice. However, it's important to use the Jacobian matrix formulation once you switch to spherical terrain. This worksheet is intended as a brief introduction to dynamics in spherical coordinates. See Example 1, page 905, for use of the Jacobian to relate in-tegration in rectangular coordinates to integrals in polar | {
"domain": "ol3roma.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9915543738075945,
"lm_q1q2_score": 0.8174988355515703,
"lm_q2_score": 0.824461932846258,
"openwebmath_perplexity": 585.6846455806344,
"openwebmath_score": 0.8959506750106812,
"tags": null,
"url": "http://ol3roma.it/jacobian-of-spherical-coordinates-proof.html"
} |
lisp, common-lisp, graph
unless (or (visited-p tail)
(seen-p tail))
collect tail))
do (if fresh-tails
(progn
(mapcar #'mark-seen fresh-tails)
(setq stack (append fresh-tails stack)))
(progn
(pop stack)
(unless (visited-p head) (mark-visited head))))))))
(loop for node from 1 to num-nodes
unless (or (null node)
(visited-p node))
do (visit node)
finally (return results))))) | {
"domain": "codereview.stackexchange",
"id": 3568,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "lisp, common-lisp, graph",
"url": null
} |
java, strings
public static boolean isInvalidChar(char character) {
return invalidChars.contains(character);
}
public static void main(String args[]) {
char[] charArray = new char[]{'a', 'b', 'c', 'd', '?', 'f', 's', ':', 'w'};
System.out.println(reverseSkippingSpecialChars(charArray));
}
} Class fields
static HashSet<Character> invalidChars = new HashSet<Character>(Arrays.asList(',', '?', ':','!','$'));
You might as well go ahead and make this final as well.
public static final Set<Character> invalidChars = new HashSet<>(Arrays.asList(',', '?', ':', '!', '$')); | {
"domain": "codereview.stackexchange",
"id": 26078,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, strings",
"url": null
} |
# Thread: Some tough power series convergence vs divergence exercises
1. ## Some tough power series convergence vs divergence exercises
Any help/hints for any of these exercises would be much appreciated!
3. $\sum(-1)^n\binom{2n}{n}x^n$ has a radius of convergence of $\frac{1}{4}$. Determine whether or not each endpoint converges.
4. $\sum\frac{n^n}{n!}x^n$ has a radius of convergence of $\frac{1}{e}$. Determine whether or not each endpoint converges.
5. $\sum\frac{\alpha(\alpha+1)\cdots(\alpha+n-1)}{\beta(\beta+1)\cdots(\beta+n-1)}x^n$ (with $\alpha,\beta\neq$ negative integer) has a radius of convergence of $1$. Determine whether or not each endpoint converges.
Determining the radiuses of convergence for these series was easy, but I don't seem to have enough tools in my toolbox of math tricks to routinely solve the endpoints. I am therefore looking to learn new tricks! Please share them if you've got them.
Thanks!
EDIT: The following have been solved: | {
"domain": "mathhelpforum.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9566341987633822,
"lm_q1q2_score": 0.8053191997607246,
"lm_q2_score": 0.8418256432832333,
"openwebmath_perplexity": 238.15522072916454,
"openwebmath_score": 0.868871808052063,
"tags": null,
"url": "http://mathhelpforum.com/differential-geometry/107198-some-tough-power-series-convergence-vs-divergence-exercises.html"
} |
A thorough understanding of mechanics is essential to any successful engineer. Find the centroid ȳ of the unsymmetrical I-section with respect to its base. 4.3 Centroid of Composite Bodies - Theory - Example - Question 1 - Question 2 - Question 3. The shape is a combination of a triangle and a rectangle. Moving on, the video presents another comprehensive workout of composite shape example where the video asks to find the centroid position of a given exemplary I-beam. geometric; how to find centroid of irregular shapes; centroid of i beam calculator; engineering mechanics centroid solved problems; centroids of composite figures example problems Center of Mass and Centroids: Composite Bodies and Figures Integration vs Appx Summation: Irregular Volume Reduce the problem to one of locating the centroid of area Appx Summation may be used instead of integration Divide the area into several strips Volume of each strip = A∆x Plot all such A against x. x_c = \frac{b^2 +a^2 + a b + 2 a b_1 + b | {
"domain": "deoberoende.se",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9802808724687407,
"lm_q1q2_score": 0.8312465664753639,
"lm_q2_score": 0.8479677506936878,
"openwebmath_perplexity": 1010.5181514875655,
"openwebmath_score": 0.45475995540618896,
"tags": null,
"url": "http://deoberoende.se/pictures-of-gtdet/c30d91-centroid-of-composite-shapes"
} |
moveit
But this does not work, because target_pose1.position.y -= 0.05; refers to the world coordinates not to the end-effector coordinates.
Originally posted by Joska213 on ROS Answers with karma: 36 on 2016-03-04
Post score: 1
Solution was:
const Eigen::Affine3d &end_effector_state = kinematic_state->getGlobalLinkTransform("eef_link");
geometry_msgs::Pose pose;
tf::poseEigenToMsg(end_effector_state, pose);
pose.position.y -= 0.05;
group.setPoseTarget(pose);
Originally posted by Joska213 with karma: 36 on 2016-03-08
This answer was ACCEPTED on the original site
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 23990,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "moveit",
"url": null
} |
python, performance, programming-challenge, python-2.x
That is indeed what we would get if we would do the proposed algorithm. You would end up with something like this:
from __future__ import print_function
zero = ord('0')
doublezero = zero * 2
a, b = usr_input.split()
if len(a) < len(b):
a, b = b, a
carry = 0
for j in xrange(0, len(b)):
c = ord(a[j]) + ord(b[j]) - doublezero + carry
print(chr((c % 10) + zero), sep='', end='')
carry = c / 10
if carry and len(a) == len(b):
print('1')
elif carry:
print(chr(ord(a[j+1])+1), a[j+2:], sep='')
else:
print(a[j+1:]) | {
"domain": "codereview.stackexchange",
"id": 20909,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, performance, programming-challenge, python-2.x",
"url": null
} |
sequence-alignment
From this phrase, "The end goal is to identify every unique sequence", I am not 100% sure of what you mean by "every unique sequence". It sounds like maybe you want to group alignments of homologs and visualize them together?
If the proteins are similar enough, you might also benefit from trying BLAST to look at similar regions.
Otherwise MAFFT, Clustal, or MUSCLE are all appropriate tools to generate the alignments that you need. However I also do not know of any software aside from Geneious that has the option to align many proteins to a reference. If you were working with DNA I'm sure the stock suggestion would be to use a read aligner like bwa mem or minimap2 and to use a bam file.
Since I don't know of any software to do exactly what you would like, I wrote a small python script to run MAFFT many times for each sequence in a fasta after the first sequence, the reference.
Q2 - MAFFT/Python | {
"domain": "bioinformatics.stackexchange",
"id": 825,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "sequence-alignment",
"url": null
} |
python, algorithm, markov-chain
2. Enumerating states
Next we enumerate each possible state:
for seq, count in sequences.items():
for i in range(len(seq) - state_length + 1):
for j in range(int(count)):
states.append(seq[i:][:state_length])
counted_states = dict(Counter(states))
At this point, the counted_states dict goes like:
counted_states = {
' H': 542,
' HE': 542,
' HEL': 542,
'HELL': 662,
' C': 117,
' CE': 117,
' CEL': 117,
'CELL': 117,
'ELLO': 709,
...
} | {
"domain": "codereview.stackexchange",
"id": 23456,
"lm_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, markov-chain",
"url": null
} |
machine-learning
I know $poly(1/ε,1/δ,n,size(c))$ is a polynomial. But what is the explicit form of $poly(1/ε,1/δ,n,size(c))$? What are the variables? What is its degree? There are no constraints on $poly(\cdot,\cdot,\cdot,\cdot)$ other than its being a polynomial, or more generally, a polynomially bounded function (that is, a function bounded by a polynomial); the difference doesn't matter in this case. Without loss of generality, you can assume that for some $A,B > 0$, $poly(x,y,z,w) = A(xyzw)^B$. | {
"domain": "cs.stackexchange",
"id": 4458,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "machine-learning",
"url": null
} |
homework-and-exercises, newtonian-mechanics, newtonian-gravity, lagrangian-formalism, angular-momentum
which depends only on the length $|\mathbf r|$, but not on the direction of $\mathbf r$.
So, let's use the more general Lagrangian
$$ L ={\frac{1}{2}}M\dot{\mathbf R}^2 +\frac{1}{2}{\mu}\dot{\mathbf r}^2 - V(|\mathbf r|) $$
Then the Euler-Langrange equation for $\mathbf r$ gives
$$
\begin{align}
\frac{\text d}{\text d t} \frac{\partial L}{\partial \dot{\mathbf r}} &= \frac{\partial L}{\partial \mathbf r} \\
\frac{\text d}{\text d t} \mu \dot{\mathbf r} &= - \nabla V(|\mathbf r|) \\
\mu \ddot{\mathbf r} &= - \nabla V(|\mathbf r|) \tag{1}\label{1}
\end{align}
$$
Now let's calculate the time derivative of $\mu \mathbf r \times \dot{\mathbf r}$.
$$
\begin{align}
\frac{\text d}{\text d t} (\mu \mathbf r \times \dot{\mathbf r})
=& \mu \dot{\mathbf r} \times \dot{\mathbf r} + \mu \mathbf r \times \ddot{\mathbf r} \\
=& \mu \mathbf r \times \ddot{\mathbf r} \\
\stackrel{(1)}=& - \mathbf r \times \nabla V(|\mathbf r|) \\
=& - \mathbf r \times V'(|\mathbf r|) \frac{\mathbf r}{|\mathbf r|} \\ | {
"domain": "physics.stackexchange",
"id": 56333,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises, newtonian-mechanics, newtonian-gravity, lagrangian-formalism, angular-momentum",
"url": null
} |
python, programming-challenge
def numeric_value(num):
values = {
"T": 10,
"J": 11,
"Q": 12,
"K": 13,
"A": 14
}
return values[num] if num in values else int(num)
#sort according to descending numeric value
#useful for determining tiebreak for flushes and straights
def sort_by_numeric_value(hand, return_only_number=None):
result = sorted(hand, key=lambda x: numeric_value(x[0]), reverse=True)
if return_only_number:
return [numeric_value(n[0]) for n in result]
else:
return result
#sort and places pairs/3 of a kind/four of a kind in front
#note that this returns a list of the numeric part of a card (i.e. T, J, 8)
def sort_according_to_pairs(hand):
nums = [c[0] for c in hand]
counter = collections.Counter(nums)
temp = [c for c in counter.most_common(5)]
temp = sorted(temp, key=lambda x: numeric_value(x[0]), reverse=True)
temp = sorted(temp, key=lambda x: x[1], reverse=True) | {
"domain": "codereview.stackexchange",
"id": 19874,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, programming-challenge",
"url": null
} |
special-relativity, twin-paradox
$$\begin{array}{l}dt = dt'\\dx = \cos(t')dt'+dx'\\dy=dy'\\dz=dz'\end{array}$$
and thus:
$$\begin{array}{ll}ds^2 & = dt^2-dx^2-dy^2-dz^2 =\\ & =(1-\cos^2(t'))dt'^2-2\cos(t')dt'dx'-dx'^2-dy'^2-dz'^2\end{array}$$
By fixing a clock at constant $x',y',z'$ in KS' and looking at the proper time, we get:
$$d\tau = \sqrt{1-\cos^2(t')}dt' = \sqrt{1-\cos^2(t)}dt = \sin(t)dt$$
(where we used $t=t'$ and $dt=dt'$). Integrating from $t=0$ to $t=\pi$ (the time Bob takes to go away and come back) we get the time a clock in KS' will mark when Bob is back home (where the clock marked $0$ when he went away):
$$\int_0^\pi\sin(t)dt = 2$$
which looks weird... (Note: I expected this to give $\pi$, so that there would have been no paradox at all.) Can someone spot eventual mistakes I made? | {
"domain": "physics.stackexchange",
"id": 11165,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "special-relativity, twin-paradox",
"url": null
} |
python
row = [''] * 3
board = [row, row[:], row[:]]
moves = [(0, 0, 'A'), (0, 1, 'B'), (0, 2, 'C'), (1, 0, 'D'), (1, 1, 'E'),
(1, 2, 'F'), (2, 0, 'G'), (2, 1, 'H'), (2, 2, 'I')]
final_board = insertMoves(board, moves)
for row in final_board:
print row
And the final function definition:
def insertMoves(board, list_of_moves):
for move in list_of_moves:
for i in range(0, 3):
if move[0] == i:
for j in range(0, 3):
if move[1] == j:
(board[j])[i] = move[2]
return board I would write the loop like this:
for i, j, move in list_of_moves:
assert(0 <= i < 3 and 0 <= j < 3 and move in 'XO')
board[j][i] = move
or maybe:
VALID_MOVES = 'XO'
for i, j, move in list_of_moves:
assert(0 <= j < len(board) and 0 <= i < len(board[j]) and move in VALID_MOVES)
board[j][i] = move | {
"domain": "codereview.stackexchange",
"id": 4789,
"lm_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",
"url": null
} |
c#, object-oriented, snake-game
pictureBox1.Invalidate();
if (choice1.Checked)
{
playerTwo.UpdateMovement();
UpdateSnakeBoddy2();
}
pictureBox1.Invalidate();
}
Use instances
In your original solution you have a Player1setting class with static properties.
In case of OOP you should work on a particular instance not on a global one.
So, lets get rid of the static keywords:
class Player1setting
{
public int Width { get; set; }
public int Height { get; set; }
public int GameScore { get; set; }
public bool Gameover { get; set; }
public SnakeMovment Movment { get; set; }
public Player1setting()
{
Height = 16;
Width = 16;
Gameover = false;
Movment = SnakeMovment.Down;
GameScore = 0;
}
}
Then create instances:
//Class-wide private members
private readonly Player1setting playerOne;
private readonly Player2setting playerTwo; | {
"domain": "codereview.stackexchange",
"id": 41088,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, object-oriented, snake-game",
"url": null
} |
optics, laser, interference, interferometry, coherence
The calculation for multiple wavelengths and continuous spectra requires additional work, possibly within the framework of Fourier analysis. | {
"domain": "physics.stackexchange",
"id": 93255,
"lm_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, laser, interference, interferometry, coherence",
"url": null
} |
c#, asp.net, asp.net-mvc-4
Title: Displaying records from a MySQL database I've started learning .NET with MVC 4 in C# and I built a basic application to display records from a MySQL database. It's incredibly basic, but it's the best I could come up with being a complete beginner to C# and all.
Most of the programming I do is with Ruby on Rails and I tried to carry over some of the design patterns that I use there. I don't know the .NET conventions so if you see anything that should be changed please let me know.
Also, I don't fully understand how to find records with LINQ and pass them to the view. I ended up getting lucky and finding an article that somewhat explained it, but I don't have a firm grasp on the subject.
The naming conventions for my entities and models are wrong. It's a long story, basically it took me a while to connect to my MySQL database and when I generated them I didn't care how they were named.
RouteConfig.cs
routes.MapRoute(
name: "root",
url: "", | {
"domain": "codereview.stackexchange",
"id": 3154,
"lm_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#, asp.net, asp.net-mvc-4",
"url": null
} |
equilibrium, solubility
Title: Why does adding water to a saturated solution increase the number of ions present in the solution? In my book, it is stated that when some water is added to a test tube having a saturated $\ce{Ag2SO4}$ solution, with its solid at equilibrium, the number of $\ce{Ag}$ ions in the solution increases.
I don't understand it. If $\ce{Ag2SO4}$ solution is saturated, it means that no more solute can dissolve, and if we add water, the amount of dissolved solute should not change.
Also, if the amount of dissolved $\ce{Ag}$ increases, would the $K_\mathrm{sp}$ value also increase? Consider a saturated solution of $\ce{Ag2SO4}$. The following equilibrium is attained.
$$ \ce{Ag2SO4 <=> 2Ag+ + SO4^2-}$$ | {
"domain": "chemistry.stackexchange",
"id": 9780,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "equilibrium, solubility",
"url": null
} |
quantum-mechanics, quantum-entanglement, wavefunction-collapse, quantum-eraser
Title: When does quantum entanglement cease? On Wikipedia on Quantum entanglement:
“However, this behavior gives rise to seemingly paradoxical effects:
any measurement of a property of a particle performs an irreversible collapse on that particle and will change the original quantum state. In the case of entangled particles, such a measurement will be on the entangled system as a whole.”
This implies once the quantum entanglement is measured/set the entanglement ceases irreversibly.
Yet in the Quantum eraser experiment on Wikipedia: | {
"domain": "physics.stackexchange",
"id": 60401,
"lm_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-entanglement, wavefunction-collapse, quantum-eraser",
"url": null
} |
electrochemistry
Charging scheme is also a question of the cell static aging, that applies more to laptops than to short life cycle of mobile phones.
Another thing is that cells prefer rather more of shallow cycles than less of deep cycles. That may be unfortunately counteracted by durability of charging connectors.
Fully charged cell is aging several times faster than about half charged one. As at full charge, lithium ions may form a metallic lithium deposit instead of lithium graphite intercalate, which very slowly reacts with dialkylcarbonate solvent. | {
"domain": "chemistry.stackexchange",
"id": 12883,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electrochemistry",
"url": null
} |
molecular-biology, dna-sequencing, restriction-enzymes
Title: Cutting of DNA strand Would EcoRI cut the following sequence??
5'CTCGAGTTCGAG3'
3'GAGCTCAAGCTC5'
What is the logic of cutting? Please explain how restriction enzymes work. No, it will not cut it, because EcoRI recognizes the following palindromic sequence: GAATTC, and only if the whole sequence is present it will cut it at particular site. You can find these information for all restriction enzymes at sites of the providers, for example at New England Biolabs site https://www.neb.com , just enter the name of the enzyme you are interested in. | {
"domain": "biology.stackexchange",
"id": 8365,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "molecular-biology, dna-sequencing, restriction-enzymes",
"url": null
} |
ros, kinect, openni, ros-electric, pandaboard
I tried to rebuild te packages by rosmake tf && rosmake and now i get a different failure message.
started roslaunch server http://129.73.14.14:53859/
SUMMARY
PARAMETERS * /rosdistro * /camera/driver/rgb_frame_id * /camera/disparity_depth_registered/min_range * /camera/driver/rgb_camera_info_url * /camera/depth_registered/rectify_depth/interpolation * /camera/driver/depth_frame_id * /camera/depth/rectify_depth/interpolation * /camera/disparity_depth/max_range * /rosversion * /camera/driver/device_id
* /camera/driver/depth_camera_info_url
* /camera/disparity_depth/min_range
* /camera/disparity_depth_registered/max_range | {
"domain": "robotics.stackexchange",
"id": 9678,
"lm_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, kinect, openni, ros-electric, pandaboard",
"url": null
} |
c++, game, c++11, tic-tac-toe
private:
unsigned remaining = mesh * mesh;
std::array<Player, mesh * mesh> mGrid;
};
// utility functor to compute matching condition
template<int mesh>
struct Match
{
Match(Type t, int i) : mCategory(t), mNumber(i){}
bool operator() (int number) const
{
switch (mCategory)
{
case Type::row:
return (std::abs(number / mesh) == mNumber);
case Type::column:
return (number % mesh == mNumber);
case Type::diagonal:
if (mNumber == 0)
return ((std::abs(number / mesh) - number % mesh) == mNumber);
if (mNumber == 1)
return ((std::abs(number / mesh) + number % mesh) == mNumber + mesh - 2);
}
return false;
}
Type mCategory;
int mNumber;
};
template<int mesh>
TicTacToe<mesh>::TicTacToe()
{
mGrid.fill(Player::none);
} | {
"domain": "codereview.stackexchange",
"id": 10822,
"lm_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, c++11, tic-tac-toe",
"url": null
} |
elements, hydrogen-bond, hsab
$\ce{ClHCl^-}$
$\ce{BrHBr^-}$
$\ce{IHI^-}$
$\ce{BrHCl^-}$
as well as related neutral radicals.
Hydrogen bonds in $\ce{S-H}$ containing compounds are discussed. These are just examples, others that do not involve $\ce{F}$, $\ce{O}$ or $\ce{N}$ are also discussed.
The following is copied (footnotes omitted) from Definition of the Hydrogen Bond (IUPAC Recommendations 2011) Pure and Applied Chemistry Volume 83, Issue 8 (Aug 2011) | {
"domain": "chemistry.stackexchange",
"id": 9931,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "elements, hydrogen-bond, hsab",
"url": null
} |
topological-insulators, quantum-anomalies, topological-phase, symmetry-protected
to assign a Hall conductance $\sigma_{xy}$ to the time-reversal broken surface, then its conjugate must have Hall conductance $-\sigma_{xy}$ and then $\sigma_{xy} - (-\sigma_{xy}) = 1$ implies that $\sigma_{xy} = 1/2$. But as I have emphasized, one should not take this too seriously. | {
"domain": "physics.stackexchange",
"id": 59763,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "topological-insulators, quantum-anomalies, topological-phase, symmetry-protected",
"url": null
} |
algorithms, time-complexity, runtime-analysis, loops
In the worst case scenario, that of a complete graph, we'd get a time complexity of $\Theta(n^3)$ in order to find all the triangles. The reason being: You have a set of $n$ nodes. You consider an initial one out of $n$. Then for the next one you have $n-1$ possibilities to choose, and for the 3rd one you have $n-2$ possibilities to choose from. That means: $n*(n-1)*(n-2)$, which belongs to $\Theta(n^3)$.
Now a second pseudocode was given, as follows:
function count_triangles_2 (Adjacent Matrix)
1 function count_triangles_2 (Adjacent Matrix)
2 count:=0
3 for u in V do
4 for v in V do
5 if not G[u][v] then continue
6 for w in V do
7 if (G[v][w] and G[u][w]) then
8 counter = counter + 1
9 end
10 end
11 end
12 end
13 return count / 6
14 end | {
"domain": "cs.stackexchange",
"id": 20332,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "algorithms, time-complexity, runtime-analysis, loops",
"url": null
} |
complexity-theory, space-complexity
be easily done in polynomial space. What distinguishes NPSPACE from NEXP is that an NPSPACE machine cannot write down the certificate, and if it generates its parts nondeterministically on the fly, it has no way of ensuring that it generates the same bits if it "reads" the same chunk of the certificate twice. That is, it can only access the certificate in a read-once fashion: once it reads a particular part of the certificate, it is erased, and the verifier cannot ever read it again. | {
"domain": "cs.stackexchange",
"id": 18540,
"lm_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, space-complexity",
"url": null
} |
python, python-3.x, sorting
Quick Sort
def quicksort(items):
"""
>>> quicksort([])
[]
>>> quicksort([1])
[1]
>>> quicksort([1,2,3,4,5])
[1, 2, 3, 4, 5]
>>> quicksort([4,5,3,1,2])
[1, 2, 3, 4, 5]
"""
def partition(f, l, pivot):
while f < l:
while items[f] < pivot: f+=1
while items[l] > pivot: l-=1
items[l], items[f] = items[f], items[l]
l, f = l-1, f+1
f,l = l,f # swap because while switches it at the end.
return (f, l)
def qsort(fst, lst):
if fst >= lst: return
pivot = items[fst]
(f, l) = partition(fst, lst, pivot)
qsort(fst, f)
qsort(l, lst)
if not items: return items
qsort(0, len(items)-1)
return items | {
"domain": "codereview.stackexchange",
"id": 19053,
"lm_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, sorting",
"url": null
} |
php, ajax, database, sqlite
/* Firstly identify if we have 'All' as the manufacture -
* if we do, we don't need to add constraints to the query.
*/
if ( 'All' != $manufacturer ){
$mfg = sqlite_escape_string($manufacturer);
$whereSubclause[] = "`Manufacturer` = {$mfg}";
}
if ( 'Any' != $model ){
$model = sqlite_escape_string($model);
$whereSubclause[] = "`Model` = {$model}";
}
if ( 'Any' != $forsale ){
$forSale = sqlite_escape_string($forsale);
$whereSubclause[] = "`ForSale` = {$forSale}";
}
// We can now safely construct the SQL --
// I haven't provided the method for this, but you'd end up with:
$query = "SELECT * FROM `vehicles` WHERE (`Manufacturer` = 'AMG') AND (`Manufacturer` = 'AMG') AND (`ForSale` = '1')"
I would then personally output the data into an array, which can then be passed to a view. Using a foreach loop, I would construct the rows in the table. | {
"domain": "codereview.stackexchange",
"id": 4086,
"lm_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, ajax, database, sqlite",
"url": null
} |
ros, calibration, camera-info, camera-info-manager, camera-calibration
...
return 0;
}
When I ran rostopic list, this is what I get:
/camera/camera_info
/camera/image
/camera/image/compressed
/camera/image/compressed/parameter_descriptions
/camera/image/compressed/parameter_updates
/camera/image/compressedDepth
/camera/image/compressedDepth/parameter_descriptions
/camera/image/compressedDepth/parameter_updates
/camera/image/theora
/camera/image/theora/parameter_descriptions
/camera/image/theora/parameter_updates
/camera/image_raw
/rosout
/rosout_agg
/statistics
/svo/dense_input
/svo/image
/svo/image/compressed
/svo/image/compressed/parameter_descriptions
/svo/image/compressed/parameter_updates
/svo/image/compressedDepth
/svo/image/compressedDepth/parameter_descriptions
/svo/image/compressedDepth/parameter_updates
/svo/image/theora
/svo/image/theora/parameter_descriptions
/svo/image/theora/parameter_updates
/svo/info
/svo/keyframes
/svo/points
/svo/pose
/svo/remote_key
/tf | {
"domain": "robotics.stackexchange",
"id": 29646,
"lm_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, calibration, camera-info, camera-info-manager, camera-calibration",
"url": null
} |
c#, game, unity3d
UnityEngine: the namespace where all most Unity-specific APIs live.
[RequireComponent]: Requires a component to be attached to the GameObject that this script is attached to.
SpriteRenderer: Component that handles the rendering of a 2D sprite.
MonoBehaviour: Base class that all Unity scripts derive from.
[SerializeField]: Forces Unity to serialize the field. This means that a value will be loaded dynamically at run-time, as set in the Editor. (Public variables are automatically serialized.)
void Awake(): Part of the MonoBehaviour API. Invoked once, at object creation. Suggested use is as the constructor, as serialized fields' values are undefined at construction time, but all Objects in the scene are guaranteed to be fully de-serialized by the time Awake() is invoked on any of them. The access level of Awake() and the other MonoBehaviour methods do not matter, but are left as default protection by convention. | {
"domain": "codereview.stackexchange",
"id": 19776,
"lm_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, unity3d",
"url": null
} |
f#, hash-map
let wordCounts = Dictionary<string, int>()
let ProcessFile fileName =
let text = File.ReadAllText(fileName)
text.Split([|'.'; ' '; '\r'|], StringSplitOptions.RemoveEmptyEntries)
|> Array.map (fun w -> w.Trim())
|> Array.filter (fun w -> w.Length > 2)
|> Array.iter (fun w ->
let ok, count = wordCounts.TryGetValue(w)
if ok then
wordCounts.[w] <- count+1
else
wordCounts.[w] <- 1)
Directory.EnumerateFiles(dirPath, wildCard)
|> Seq.iter ProcessFile
wordCounts
// |> Seq.sumBy (fun kv -> kv.Value)
|> Seq.sortBy (fun kv -> -kv.Value)
// Naive concurrent version:
let WordCount2 dirPath wildCard =
let wordCounts = Dictionary<string, int>()
let ProcessFile fileName =
let text = File.ReadAllText(fileName) | {
"domain": "codereview.stackexchange",
"id": 7427,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "f#, hash-map",
"url": null
} |
classical-mechanics, thermodynamics, experimental-physics
The algorithms are created using a proprietary algorithm development process
that utilizes a data driven machinelearning approach.
So third parties who have tested it have only been able to test it as a black box. There is a little general information about how the algorithm works and what it can and can't do: | {
"domain": "physics.stackexchange",
"id": 10045,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "classical-mechanics, thermodynamics, experimental-physics",
"url": null
} |
gazebo
I don't know why I can't hear any sound after one object collide with another object, and I have tried to move the object around the plane, but it still has no sound. PS: the headset is no problem.
It would be grateful if someone can tell me how to play audio files in Gazebo by using OpenAL.
Thanks in advance.
Originally posted by Daniel.T on Gazebo Answers with karma: 3 on 2017-08-01
Post score: 0
OpenAL only works if you build Gazebo from source and have the required dependencies installed. See this.
Originally posted by chapulina with karma: 7504 on 2017-08-01
This answer was ACCEPTED on the original site
Post score: 1 | {
"domain": "robotics.stackexchange",
"id": 4152,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gazebo",
"url": null
} |
newtonian-mechanics, kinematics, energy-conservation, inertial-frames, relative-motion
So we have:
Frame One:
Change in KE = $\frac{1}{2}mv_s^2 + \frac{1}{2}m(-v_s)^2 - (0 + 0) = m v_s^2$
Frame Two:
Change in KE = $\frac{1}{2}m(v_t+v_s)^2 + \frac{1}{2}m(v_t-v_s)^2 - (\frac{1}{2}mv_t^2 + \frac{1}{2}mv_t^2) = m {v_s}^2$ | {
"domain": "physics.stackexchange",
"id": 86812,
"lm_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, kinematics, energy-conservation, inertial-frames, relative-motion",
"url": null
} |
bond, energy, enthalpy
I only know about Hess' law, bond enthalpies and enthalpies of combustion and have tried to use all concepts in order to somehow get an answer but none of them have worked. I first tried to write a balanced equation for what the reaction of 2 moles of reactants would look like but I don't believe it could be balanced. Then, I tried using bond enthalpies but I couldn't have done that either since the equation couldn't be balanced. Next, I tried using enthalpies of combustion, and the same thing happened. So, I'm wondering if there's anyway to answer this question, preferably with the concepts mentioned above. The N2O4 is going to define the maximum amount that will be used up in the reaction, since it has the higher stoichiometric number of the reagents. That is, the second term will always be less and the amount consumed will be defined by the N2O4 because that two moles will limit the N2O4 and in doing so reduce the amount of the second term consumed- there will be excess second | {
"domain": "chemistry.stackexchange",
"id": 5319,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "bond, energy, enthalpy",
"url": null
} |
ros, gazebo, camera, gazebo-plugins, sensor
Title: using camera sensor in Gazebo
where can i find documentation or examples about camera sensor?
I need to create a camera sensor and i need to move it around the robot.
thanks in advance. | {
"domain": "robotics.stackexchange",
"id": 7315,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, gazebo, camera, gazebo-plugins, sensor",
"url": null
} |
slam, navigation, rviz, gmapping
Original comments
Comment by gong on 2011-05-17:
Additional, I published odometry using the relative distance computed from odometry which provided by driver. The odmetry was like that : x = (current_odometry - last_odometry)*cos(theta), y = (current_odometry - last_odometry)*sin(theta), the theta was absolute value provided by gyro.
Comment by gong on 2011-05-17:
Further more, I got an error message. Error: m_distanceThesholdCheck overridden!!! ... the odometry has a big jump here. this is probably a bug in the odometry/laser input. This error has been happened someday ago, I rewrite the odomety program to fix it. At that time, the formula was wrong.
Comment by gong on 2011-05-17:
I set the fixed frames to "/odom" and set the laser scan's "delay time" to 10 seconds. It seems that I do not get the "mostly consistent map", because when the robot is running I cannot see the map in rviz until the robot is stoped.
Comment by Eric Perko on 2011-05-17: | {
"domain": "robotics.stackexchange",
"id": 5592,
"lm_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, rviz, gmapping",
"url": null
} |
$$\frac {(3^k - 1)} {2} \text{, not greater than}\ \lceil N/3 \rceil$$
This sequence begins at the largest increment less than $N/3$ and decreases to 1. This means that for a sequence of length $16$ the sequence is $13, 4, 1$.
The effect of shell sort is that it sorts elements that are $H$ elements apart with one swap instead of $H$. The granularity of the sorting operation increases as $H$ itself decreases such that every element is eventually sorted, but with the added benefit that as $H$ decreases, the distance of the longest-distance swap decreases.
template<typename T>
void sort(std::vector<T> &sequence) {
int size = sequence.size();
int h = 1;
while (h < N/3) {
h = 3 * h + 1;
}
while (h >= 1) {
for (int i = h; i < size; i++) {
for (int j = i; j >= h; j -= h) {
if (sequence[j] < sequence[j - h]) {
swap(seq[j], sequence[j - h]);
} else {
break;
}
}
}
h = h / 3;
}
}
## Merge Sort
Case Growth
Worst $O(n\log{n})$
Space $O(n)$ | {
"domain": "jip.dev",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9867771759145342,
"lm_q1q2_score": 0.8113174618351043,
"lm_q2_score": 0.8221891239865619,
"openwebmath_perplexity": 1229.7954954713152,
"openwebmath_score": 0.49524566531181335,
"tags": null,
"url": "https://jip.dev/notes/algorithms/"
} |
javascript, algorithm, sorting, graph
Or if it is known that the trip is the same length as the input array.
function tripFrom(trips, from) {
const res = [];
while (res.length < trips.length) {
from = (res[res.length] = trips.find(trip => trip.from === from)).to;
}
return res;
}
tripFrom(trips, "JFK");
It is unclear if you want the array sorted in place. If that is a requirement then the above version can be modified to do that by simply copying the results array res to the trips array. You can empty an array by setting its length to zero. The spread ... operator in this case spreads the array items over the functions arguments trips.push(...res) thus pushing all the items to the array.
function tripFrom(trips, from) {
const res = [];
while (res.length < trips.length) {
from = (res[res.length] = trips.find(trip => trip.from === from)).to;
}
trips.length = 0;
trips.push(...res);
return trips;
}
tripFrom(trips, "JFK"); | {
"domain": "codereview.stackexchange",
"id": 34167,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, algorithm, sorting, graph",
"url": null
} |
python, flask, crud
def pword(lat,lng,word,definition):
try:
c, conn = connection()
c.execute("INSERT INTO wordlocation (word,longitude,latitude,definition,lang) VALUES(%s,%s,%s,%s,%s)",
(thwart(word),lat,lng,thwart(definition),'english'))
conn.commit()
c.close()
conn.close()
return "success!"
except Exception as e:
logging.info(str(e))
def cword(word, username):
try:
c, conn = connection()
blank_word = " " + word
c.execute("UPDATE userstat SET completed=CONCAT(IFNULL(completed,''), %s) , score=score+1 WHERE username=%s;",(blank_word, username))
conn.commit()
c.close()
conn.close()
return "successful collect"
except Exception as e:
logging.info(str(e)) | {
"domain": "codereview.stackexchange",
"id": 24598,
"lm_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, flask, crud",
"url": null
} |
cc.complexity-theory, complexity-classes, lower-bounds, derandomization, polynomial-hierarchy
Title: On $\Delta_i^P$ We know $P\subseteq NP\cap coNP\subseteq\Delta_i^P=P^{\Sigma_{i-1}^P}\subseteq \Sigma_i^P\cap\Pi_i^P=NP^{\Sigma_{i-1}^P}\cap coNP^{\Sigma_{i-1}^P}$.
If $P=BPP$ is there a 'higher' randomized class analog (call $BP\Delta_i^P$) that will be equal to $\Delta_i^P$ at every $i\in\Bbb N$ and vice versa?
Does $P=NP\cap coNP\implies\Delta_i^P=\Sigma_i^P\cap\Pi_i^P$ at every $i\in\Bbb N$ (note vice versa need not be true as we have collapse results without $P=NP$)?
Does $BPP\subseteq\Delta_2^P$ (or hypothetical $BP\Delta_i^P\subseteq\Delta_i^P$) imply any circuit lower bounds?
Yes, one can define $BP\Delta_i^P$. Indeed, for any class $\mathcal{C}$ one can define $\mathsf{BP} \cdot \mathcal{C}$ as $L \in \mathsf{BP} \cdot \mathcal{C}$ iff there is a language $L' \in \mathcal{C}$ such that | {
"domain": "cstheory.stackexchange",
"id": 4036,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "cc.complexity-theory, complexity-classes, lower-bounds, derandomization, polynomial-hierarchy",
"url": null
} |
electrical-resistance, stress-strain
Title: Does resistivity of material change under strain As I am reading the document on physics of strain gauge, I encounter the following paragraph that I do not understand. How could resistivity change (delta rho) under strain/elongation? I always thought resistivity is a constant.
I always thought resistivity is a constant. | {
"domain": "physics.stackexchange",
"id": 35007,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electrical-resistance, stress-strain",
"url": null
} |
bioinformatics, proteins, amino-acids, influenza
You might find the Influenza Research Database's Identify Sequence Features in Segments tool useful, particularly its annotation of hemagglutinin H3.
Be aware that numbering of amino acids can be confusing, since different groups may be using different starting points. There's a vague agreement on the "correct" numbering, but quite a few groups pay it lip service and then number their version however they like. | {
"domain": "biology.stackexchange",
"id": 9385,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "bioinformatics, proteins, amino-acids, influenza",
"url": null
} |
• Do you mean that in the case at hand, it would be more efficient to express $x(b)$ as linear combination of Chebychev polynomials rather than the classical Taylor expansion? – handelskai Aug 29 '16 at 12:24
• You can find the integral in Brigo & Mercurio pp.158 equation 4.31. Nevertheless you will find that for the sake of tractability I considered the utmost simplest case here. – handelskai Aug 29 '16 at 12:32
• @handelskai Yes, truncated Chebyshev series typically converge faster than Taylor series. And minimax polynomial, by definition, minimize $||f(x)-p(x)||_\infty$ over an interval, so they are optimal in a different sense. – Federico Poloni Aug 29 '16 at 19:02 | {
"domain": "mathoverflow.net",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9822877033706601,
"lm_q1q2_score": 0.8227837940617725,
"lm_q2_score": 0.8376199673867852,
"openwebmath_perplexity": 353.08691185021104,
"openwebmath_score": 0.8373925685882568,
"tags": null,
"url": "https://mathoverflow.net/questions/248529/compute-inverse-series-for-implicit-equation-b-log1-e-x-x"
} |
r, rna-seq, scrnaseq, seurat, visualization
Am I mistaken? Do I need to add a metadata column containing expression of the gene? How can I access individual cells gene expression data in seurat so I can create a metadata label based on binned expression levels? Also how would I tell seurat to use a color gradient to label them?
References
https://satijalab.org/seurat/reference/dimplot As @swbarnes2 has suggested, you can plot gene expression over the top of a dimensional reduction using the FeaturePlot function, using the features parameter for gene names:
p <- FeaturePlot(DG.combined, reduction = "umap", features = c("Fos", "Inhba"))
See the 3k tutorial here:
https://satijalab.org/seurat/articles/pbmc3k_tutorial.html#cb49 | {
"domain": "bioinformatics.stackexchange",
"id": 2086,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "r, rna-seq, scrnaseq, seurat, visualization",
"url": null
} |
The problem with these highly specialized formulas is the burden of remembering the specific formula and keeping track of what each term stands for. Personally, I prefer to stick to the general formula that I listed earlier and then adapt it to a specific situation. This helps reduce the memorization burden on my brain. But I can see others who might prefer to memorize formulas for specific situations. Take your pick.
Cheers,
Dabral
Math Expert
Joined: 02 Sep 2009
Posts: 53771
Re: Sum of n positive integers formula for consecutive integers? [#permalink]
### Show Tags
20 Feb 2019, 03:34
RustyR wrote:
Is the sum of n positive integers formula, $$\frac{n(n+1)}{2}$$, applicable to sets of consecutive integers as well?
For instance, if I wanted to calculate sum of first 20 multiples of 3, could I use: 3 x $$\frac{20(21)}{2}$$
In OG PS Q172, a similar approach has been used for even numbers.
For more check Formulas for Consecutive, Even, Odd Integers | {
"domain": "gmatclub.com",
"id": null,
"lm_label": "1. Yes\n2. Yes\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9465966702001757,
"lm_q1q2_score": 0.8826572003938182,
"lm_q2_score": 0.9324533121452495,
"openwebmath_perplexity": 1141.4389797102813,
"openwebmath_score": 0.8596053719520569,
"tags": null,
"url": "https://gmatclub.com/forum/sum-of-n-positive-integers-formula-for-consecutive-integers-163301.html"
} |
classical-mechanics, lagrangian-formalism, coordinate-systems, differentiation, calculus
\approx f(a_1,\dots a_N) + f_{(1)}(a_1,\dots a_N)~\delta a_1 + \dots + f_{(N)}(a_1,\dots a_N)~\delta a_N.$$
How might I write this nicer?
In a more compact notation we would combine the derivatives into a "vector field" $\nabla f(\mathbf a) = \big(f_{(1)}(\mathbf a),~\dots f_{(N)}(\mathbf a)\big)$ and then write this as $$f(\mathbf a + \delta \mathbf a) \approx f(\mathbf a) + \nabla f(\mathbf a)\cdot \delta\mathbf a$$However you write it the point is the same: this fundamental assumption, when it holds, allows you to look at little differences as falling on the tangent hyperplane, just like in calculus little differences fell on the tangent line: and hyperplanes would just add up all of the little differences, multiplied by the slopes in those directions. | {
"domain": "physics.stackexchange",
"id": 51148,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "classical-mechanics, lagrangian-formalism, coordinate-systems, differentiation, calculus",
"url": null
} |
java, game, xml
public String getId() {
if (duplicateId) {
throw new UncheckedCardLoadingException("Element id has duplicate entries");
}
if (id == null) {
throw new UncheckedCardLoadingException("Required element id has not been set");
}
return id;
}
@JsonAnyGetter
public Map<String, Object> getElements() {
if (duplicateElements) {
throw new UncheckedCardLoadingException("Elements " + duplicateElementTags + " have duplicate entries where card id = " + id);
}
return new HashMap<>(elements);
}
}
} | {
"domain": "codereview.stackexchange",
"id": 10470,
"lm_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, game, xml",
"url": null
} |
electricity
n-type: Think of a pure material lattice where one atom is suddenly replaced with an atom of one higher atomic number. This atom has an electron too many in the outer shell. To fit into the lattice, it must give up this electron. So it "pushed" it away. Now this excess electron is more free to move around. Therefore electrons will be charge carriers in this material.
p-type: If you instead replace an atom with another atom of one smaller atomic number, then it is missing one electron. It has a hole. To fit in, it must take an electron from a neighbour. The neighbour will then take an electron from another neighbour etc. The hole seems to "move around freely", and corresponds to a missing electron, that is a positive charge. We call it a positice charge carrier. | {
"domain": "physics.stackexchange",
"id": 23609,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electricity",
"url": null
} |
python, performance, python-3.x, pygame, raycasting
On my computer I find that the game runs at about 18 fps.
The first step in speeding this up is to understand where all the time is going. In comments, Caridorc suggested that you might use the profiler to figure this out. But the structure of the code makes it clear that the biggest fraction of the runtime is going to be spent in this loop (over the pixels in a column in a texture):
for y in range(texHeight):
So instead of looping over the pixels in the column and drawing each pixel using pygame.draw.line, let's extract the column from the texture as a surface, colour-multiply it to apply the lighting effects, scale it, and blit it onto the screen.
This involves a couple of changes elsewhere in the code:
Convert the texture to RGB after loading it:
texture = pygame.image.load(os.path.join(path, 'Blood Wall Dark.bmp'))
texture = texture.convert()
Don't create the PixelArray (this locks the texture, and we won't be needing it any more).
Then, for each column: | {
"domain": "codereview.stackexchange",
"id": 25083,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, performance, python-3.x, pygame, raycasting",
"url": null
} |
java, optimization, calculator
System.out.println("Would you like to start over? (yes,no)");
String startOver = scan1.nextLine();
if("no".equals(startOver))
{
go = false;
System.out.println("Bye");
}
}
}
}
Would it be possible to make this more compact?
Does this code contain dead code? You do "the same" for all four choices - time to abstract!
import java.util.Scanner; //imports scanners
public class Calc {
enum Op {
ADD("a", "add", "added to"),
SUB("s", "subtract", "subtracted by"),
MUL("m", "multiply", "multiplied by"),
DIV("d", "divide", "divided by");
public String key;
public String command;
public String result;
Op(String key, String command, String result) {
this.key = key;
this.command = command;
this.result = result;
} | {
"domain": "codereview.stackexchange",
"id": 950,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, optimization, calculator",
"url": null
} |
astronomy, stars, distance, parallax
The work by astrophysics on energy produced in stars and their size versus mass versus spectra has been outstanding and I'm over my head here, but I think those results are of primary use today in determining size. Basically you can give someone the spectra and they can tell you the mass and size of a star.
When we get arrays of optical telescopes in space, direct measurement will be possible on much more distant objects than have been measured so far and this will all get refined by an order of magnitude (or several orders of magnitudes since even planets around stars can be imaged). Note that by "direct measurement" with arrays I really mean optical measurements of something that after a great deal of computation produces an image. | {
"domain": "physics.stackexchange",
"id": 88198,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "astronomy, stars, distance, parallax",
"url": null
} |
ros
Original comments
Comment by gvdhoorn on 2018-01-23:
re: your edit: take a look at the source_list parameter of the wiki/joint_state_publisher.
Comment by gvdhoorn on 2018-01-23:
It would also be nice if you could post your approach as an answer, and then accept your own answer.
That way it's a bit more obvious where the question ends and the answer starts.
Comment by EdwinvanEmmerik on 2018-01-29:
@gvdhoorn Thank you for reminding me of the source_list param. I gave an answer to my own question like you asked. Altough I can't accept my own answer as correct because I don't have enough 'karma'. Would be nice if you could do that, if you agree.
I was able to find the problem and solve it: I found out that the error I was having came from line 1188 from this header,
http://docs.ros.org/jade/api/moveit_ros_planning/html/planning__scene__monitor_8cpp_source.html | {
"domain": "robotics.stackexchange",
"id": 29817,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros",
"url": null
} |
c++, c++11, overloading
Title: Polynomial class C++11 Initial stage of implementation of the polynomial class. Essentially I need to implement the basic mathematical operations. Right now I have implemented just addition. Was wondering if this is a good way to proceed. I also want to be sure if the move constructor would be called during the addition operation.
poly.h
/* Class for polynomials*/
/* Constant term is the first coefficient*/
/*To Do:
1. Establish invariants
*/
#ifndef POLY_H
#define POLY_H
#include <vector>
#include <iostream>
#include <cstdlib>
#include <stdexcept>
template< typename T>
class Poly
{
public:
Poly() = default; // default constructor
Poly(size_t s):sz{s}, coeff{}{}; // constructor assumes positive size
Poly(std::initializer_list<T> lst):sz{lst.size()}, coeff{lst}{}; // constructor with initializer list
Poly(Poly && ) = default; // Move
Poly & operator = (Poly && ) = default;
Poly (Poly const & ) = default; // Copy
Poly & operator = (Poly const & ) = default; | {
"domain": "codereview.stackexchange",
"id": 19205,
"lm_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, overloading",
"url": null
} |
javascript, jquery, html, css
$(this).addClass('activedot');
$('.dot').not('#dot2').removeClass('activedot');
$slideContainer.css('margin-left','-720px');
stopSlider();
currentSlide = 2;
});
This could be simplified to one event handler that either got the margin based on image width and the index of the image at the index of the clicked dot dot(4) -> image(4):
$dots.on('click', function() {
var $this = $(this);
$dots.removeClass('activedot');
$this.addClass('activedot');
stopSlider();
currentSlide = $this.index();
});
I didn't add the part setting the margin because I'm out of time at the moment, but you can get $('.slide').eq(currentSlide).find('img') and parse the image width (multipled by currentSlide) to get the pixel offset. | {
"domain": "codereview.stackexchange",
"id": 13696,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, jquery, html, css",
"url": null
} |
$$\large \Vert \vec{A} \Vert_F = \sqrt{\sum_{i=1}^m \sum_{j=1}^n \vert a_{ij} \vert^2}$$
A demonstrative implementation of the Frobenius norm in Python is as follows.
In [3]:
f = 0
for i in np.arange(n):
for j in np.arange(m):
f = f + np.sum(np.power(np.abs(a[i, j]), 2))
np.sqrt(f)
Out[3]:
14.560219778561036
As with vector norms, we can take advantage of numpy's vectorization support to calculate the Frobenius norm with a one-liner.
In [4]:
np.sqrt(np.sum(np.abs(a) ** 2))
Out[4]:
14.560219778561036
We can confirm our result by comparing it to the output of numpy's norm function. The ord parameter is specified as 'fro' to output the Frobenius norm, but this is the default behavior when a matrix is passed to the norm function.
In [5]:
np.linalg.norm(a, 'fro')
Out[5]:
14.560219778561036
### $1$-Norm¶
The matrix 1-norm is defined as the maximum absolute column sum of a matrix. | {
"domain": "aaronschlegel.me",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9937100980493822,
"lm_q1q2_score": 0.8005648345482591,
"lm_q2_score": 0.805632181981183,
"openwebmath_perplexity": 1106.3518009608702,
"openwebmath_score": 0.7317309975624084,
"tags": null,
"url": "https://aaronschlegel.me/matrix-norms-inequalities-python.html"
} |
and Neumann Boundary Conditions. Two-Dimensional Space (a) Half-Space Defined by. So far, we have supplied 2 equations for the n+2 unknowns, the remaining n equations are obtained by writing the discretized ODE for nodes. This way I should be able to define a neumann condition at the boundary. Boundary conditions can be set the usual way. It also provides a natural way to specify boundary conditions in terms of the fluxes or forces (the first derivatives of the variables being solved), the so-called natural boundary condition or the Neumann boundary condition. In fact, all stable ex-plicit differencing schemes for solving the advection equation (2. 3 1) 1-d homogeneous equation and boundary conditions (Neumann-Neumann) 4. 8) The partial differential equation along with the boundary conditions and initial conditions completely specify the system. Specified Flux: In this case the flux per area, (q/A) n, across (normal to) the boundary is specified. 1) with the. The mathematical model of | {
"domain": "ionoale.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9833429599907709,
"lm_q1q2_score": 0.8062363333225964,
"lm_q2_score": 0.8198933293122506,
"openwebmath_perplexity": 605.967414960971,
"openwebmath_score": 0.8164872527122498,
"tags": null,
"url": "http://fxhr.ionoale.it/2d-heat-equation-neumann-boundary-conditions.html"
} |
My deal with the question:-
As can be seen in the "standard approach" solution, there was no need to use the relation $a+b+c=0$, so I thought that there must be a reason why the relation $a+b+c=0$ is given and hence tried finding an intuitive solution rather than a brute force one. I strongly feel that there must be a reason why the relation was given and hence attempted with a "not so standard approach".
I know my "not so standard approach solution" seems like a forced solution so please can you point out some mistakes or provide me with a "fluid solution".
We consider $f(x) = (b-x)^2 -4(a-x)(c-x)$
On taking derivative, we get $$f'(x) = -2(b-x) + 4(a-x) + 4(c-x)$$, which evaluates to $$f'(x) = -6x-6b = -6(x+b)$$
Hence, maximum value of $f(x)$ occurs at $x=-b$ ,which is
$$f(-b) = 4b^2 - 4(a+b)(c+b) = 4b^2 - 4ac = 4(b^2-ac)$$
Now, for $a+b+c = 0$ $$a^2-bc = b^2-ac = c^2-ab = k$$
$$\frac{1}{2}((a-b)^2 + (b-c)^2 + (c-a)^2)) = 3k \ge 0$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9825575188391108,
"lm_q1q2_score": 0.8033139509787024,
"lm_q2_score": 0.817574478416099,
"openwebmath_perplexity": 142.50115992074126,
"openwebmath_score": 0.9011803269386292,
"tags": null,
"url": "https://math.stackexchange.com/questions/2001578/relating-the-two-quadratic-equations"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.