text stringlengths 49 10.4k | source dict |
|---|---|
java, tree, console, library, ascii-art
for (int x = 0; x < arrowLength; ++x) {
subtreeTextSprite.setChar(arrowStartX + x, arrowY, '-');
}
subtreeTextSprite.setChar(arrowStartX + arrowLength, arrowY, '+');
subtreeTextSprite.setChar(arrowStartX + arrowLength, arrowY + 1, '|');
subtreeTextSprite.setChar(arrowStartX + arrowLength, arrowY + 2, '|');
subtreeDescriptor.rootNodeOffset = 0;
subtreeDescriptor.rootNodeWidth = nodeTextSprite.getWidth();
subtreeDescriptor.textSprite = subtreeTextSprite;
return subtreeDescriptor;
}
private int checkSiblingSpace(int siblingSpace) {
if (siblingSpace < 0) {
throw new IllegalArgumentException("Sibling space is negative: " +
siblingSpace);
}
return siblingSpace;
}
}
You can find the entire project containing a funky demo program here: https://github.com/coderodde/BinaryTreePrinter
Using it, you may get something like: | {
"domain": "codereview.stackexchange",
"id": 29313,
"lm_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, tree, console, library, ascii-art",
"url": null
} |
javascript, jquery
setInterval(function(){
if(obj.hasFocus){
type();
};
}, 10000);
}; Performance Considerations
As the code stands now, every time the type function is invoked (that is, every 80 milliseconds) the code will parse the DOM looking for any elements with the searchBox class.
You can improve the code's efficiency by moving that expensive operation outside the function.
var i = 0, ct = 0, searchBox = $(".searchBox"); obj.typeIt;
function type(){
// ...
searchBox.attr("placeholder", obj.typeIt);
// ...
};
If you know there'll only be one element with the searchBox class, you could improve its efficiency a step further by using the native document.querySelector method.
var i = 0, ct = 0, searchBox = document.querySelector(".searchBox"); obj.typeIt;
function type(){
// ...
searchBox.setAttribute("placeholder", obj.typeIt);
// ...
}; | {
"domain": "codereview.stackexchange",
"id": 22704,
"lm_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",
"url": null
} |
structural-engineering
Title: twisting at shear center / centroid In the notes , the author stated that when the force is applied through the centorid of cross section , the channel will bend and twist.
but , on the second page , the author stated that the shear center lies on an axis of symmetry of member's cross sectional area...
So, i am confused whether the member will twist or not when the force P is applied thru the centroid or shear center ....
Why the shear center is located at O , which is located outside of the C channel ?
Is there anything wrong with the notes ? Nothing wrong with the book or notes. This is just a little unintuitive at first until you take some time to internalize it.
The shear center lies on an axis of symmetry. If two axis of symmetry exist, it will lie on both of them at the centroid. Otherwise, it is only constrained to lie on one of them. The location of the shear center on the unsymmetric axis is determined by the equation for e.
If the centroid is located at the shear center, then it will not twist. However, if they are in different locations, twisting will happen at the centroid if a force is applied there.
According to McGraw Hill Companies inc,
Shear Center: Of any cross section of a beam, that point in the plane of the cross section through which a transverse load must be applied in order that there will be only bending of the section and no twisting.
This picture shows how this works:
If the downwards force is applied along the screw at any point other than the shear center, twisting will occur. | {
"domain": "engineering.stackexchange",
"id": 1175,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "structural-engineering",
"url": null
} |
human-biology, respiration
Title: Why does inert gas asphyxiation trigger unconsciousness almost immediately? According to an official safety bulletin from the U.S. Chemical Safety and Hazard Investigation Board:
"Breathing an oxygen deficient atmosphere can have serious and immediate effects, including unconsciousness after only one or two breaths."
Most people can hold their breath for at least 30 seconds and sometimes up to several minutes; clearly, breathing an oxygen-deficient inert gas will affect a person far sooner than simply holding one's breath.
An inert gas like nitrogen is not inherently toxic, so why does breathing a concentrated inert gas cause unconsciousness almost immediately? Does it replace the oxygen that would otherwise remain in the body while holding one's breath? One reason you can hold your breath for 30 or more seconds is that you are not denying your body oxygen during that time. Wikipedia says:
After exhaling, adult human lungs still contain 2.5–3 L of air, their functional residual capacity or FRC. On inhalation, only about 350 mL of new, warm, moistened atmospheric air is brought in and is well mixed with the FRC. Consequently, the gas composition of the FRC changes very little during the breathing cycle. | {
"domain": "biology.stackexchange",
"id": 11506,
"lm_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, respiration",
"url": null
} |
We got that for each vertex $$u\in V$$ it holds that $$\deg_H(u)\ge \deg_G(u)$$, so $$E(H)=\frac{\sum_{u\in V} {\deg_H(u)}}{2}\ge \frac{\sum_{u\in V} {\deg_G(u)}}{2} = E(G)$$
As we got that every triangle-free graph has a bipartite graph with at least as many edges, it is sufficient to take the bipartite graph with $$n$$ vertices with the highest number of edges.
So the biggest graph is obviously of the form $$K_{k,l}$$ where $$k+l=n$$. Let $$\alpha$$ be the unique number such that $$k=\frac{n}{2} +\alpha, l=\frac{n}{2}-\alpha$$ and we got that the number of edges is $$\frac{n^2}{2}-\alpha^2$$ so to maximize it we must choose $$\alpha = 0$$ when $$n$$ is even and $$\alpha = \frac{1}{2}$$ when $$n$$ is odd, and the number of edegs is $$\lfloor \frac{n^2}{4} \rfloor$$.
If we let $$n=7$$, we get that the maximal graph is indeed $$K_{\frac{7}{2} + \frac{1}{2}, \frac{7}{2}-\frac{1}{2}}=K_{4,3}$$ with $$12$$ edges. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.976310532836284,
"lm_q1q2_score": 0.8198411154609073,
"lm_q2_score": 0.8397339656668287,
"openwebmath_perplexity": 194.38743531375448,
"openwebmath_score": 0.7971346378326416,
"tags": null,
"url": "https://math.stackexchange.com/questions/3443076/what-graph-with-7-vertices-that-doesnt-contain-k-3-as-subgraph-has-the-maxima"
} |
java, programming-challenge, playing-cards
Hand
@Getter @EqualsAndHashCode(of="cards") static class Hand implements Comparable<Hand> {
Hand(Iterable<Card> cards) {
assert Iterables.size(cards) == CARDS_IN_HAND;
this.cards = ImmutableSortedSet.copyOf(cards);
checkArgument(this.cards.size() == 5, cards);
final Multiset<Rank> ranks = EnumMultiset.create(Rank.class);
final Multiset<Suit> suits = EnumMultiset.create(Suit.class);
int min = Integer.MAX_VALUE;
int max = Integer.MIN_VALUE;
for (final Card c : this.cards) {
final Rank rank = c.rank();
min = Math.min(min, rank.value());
max = Math.max(max, rank.value());
ranks.add(rank);
suits.add(c.suit());
}
rankHistogram = histogram(ranks);
suitHistogram = histogram(suits);
isStraight = max - min == CARDS_IN_HAND - 1 && rankHistogram.equals(ImmutableMultiset.of(1, 1, 1, 1, 1));
}
/**
* The inverse method to {@link #toString().}
*
* <p>The input must be exactly of the form "vs vs vs vs vs",
* where {@code v} is a {@code Value.symbol()} and {@code s} is {@code Rank.symbol()},
* for example {@code "5H 5C 6S 7S KD"}
*/
static Hand forString(String cards) {
checkArgument(cards.length() == TO_STRING_LENGTH);
final List<Card> list = Lists.newArrayList();
for (final String s : Splitter.on(' ').splitToList(cards)) list.add(Card.forString(s));
return new Hand(list);
} | {
"domain": "codereview.stackexchange",
"id": 13362,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, programming-challenge, playing-cards",
"url": null
} |
java, interview-questions, json, csv
NOTE: for each of the extra questions, you can create different command-line arguments that changes the mode of the application.
However, this is only a suggestion, and are you free to take any
alternative approach you may wish.
Requirements
Unless explicitly requested otherwise, we expect the following to be
used:
Java 8
Gradle as the build system
Any necessary libraries (e.g., Jackson for JSON)
Code:
CSVData.Java
package org.challenge.csv;
import java.util.Arrays;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnore;
/*
* Base class for CSV data
*
*/
public class CSVData {
private transient final String[] fieldsInCSVHeader;
protected CSVData(String[] fieldsInCSVHeader) {
this.fieldsInCSVHeader = fieldsInCSVHeader;
}
@JsonIgnore
public List<String> getHeaderFields() {
return Arrays.asList(fieldsInCSVHeader);
}
public enum SortDirection {
ASCENDING,
DESCENDING
}
}
CSVParser.java
package org.challenge.csv;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.util.List;
import java.util.Objects;
import static java.util.stream.Collectors.*;
import org.challenge.csv.survey.SurveyCSVParser;
import org.challenge.csv.survey.SurveyCSVParser.SurveyCSVData;
/**
* Base class for CSV parsers
*
*/
public class CSVParser {
private final File csvFile;
private final short minimumFieldsPerLine;
private final String seperatorOfFields;
private List<String> linesOfCSVFile;
protected CSVParser(File csvFile, short minimumFieldsPerLine, String seperatorOfFields) {
this.csvFile = csvFile;
this.minimumFieldsPerLine = minimumFieldsPerLine;
this.seperatorOfFields = seperatorOfFields;
} | {
"domain": "codereview.stackexchange",
"id": 32296,
"lm_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, interview-questions, json, csv",
"url": null
} |
ros, roscore, rosversion, groovy-beta
Title: cannot run roscore due to error in rosversion
When running roscore with a new groovy install, i get this error:
... logging to /u/bhaskara/.ros/log/2674d9d4-0ccb-11e2-9426-f46d0429e87d/roslaunch-spf-11815.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
WARNING: disk usage in log directory [/u/bhaskara/.ros/log] is over 1GB.
It's recommended that you use the 'rosclean' command.
WARNING: disk usage in log directory [/u/bhaskara/.ros/log] is over 1GB.
It's recommended that you use the 'rosclean' command.
2;roscore
Cannot locate [ros]Invalid <param> tag: Cannot load command parameter [rosversion]: command [rosversion ros] returned with code [1].
Param xml is <param command="rosversion ros" name="rosversion"/>
Invalid <param> tag: Cannot load command parameter [rosversion]: command [rosversion ros] returned with code [1].
Param xml is <param command="rosversion ros" name="rosversion"/> | {
"domain": "robotics.stackexchange",
"id": 11208,
"lm_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, roscore, rosversion, groovy-beta",
"url": null
} |
quantum-mechanics, quantum-information, quantum-optics, information, metrology
which only involves $\rho_\theta$ and its derivatives. Assuming knowledge of $u_\theta$, is there a simple way to express the QFI for a channel such as $\Phi_\theta$, in terms of any initial state $\rho$? Imagine you have access to the auxiliary mode $\tau_E$ and want to find the quantum Fisher information of that scenario. The true QFI will be upper bounded by that, because the information in $\rho_\theta$ is strictly less than the information in the joint system.
Since $U_\theta(\rho_S\otimes\tau_E)U_\theta^\dagger\equiv |\Psi_\theta\rangle\langle\Psi_\theta|$ is pure by construction ($\rho_S=|\psi\rangle\langle \psi|$ and $\tau_E=|0\rangle\langle 0|$ and $|\Psi_\theta\rangle\equiv U_\theta|\psi\rangle\otimes |0\rangle\equiv U_\theta |\Psi_0\rangle$), its QFI is found to be | {
"domain": "physics.stackexchange",
"id": 99069,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, quantum-information, quantum-optics, information, metrology",
"url": null
} |
electromagnetism, electrostatics, potential, gauge
Title: Vector potential of a solenoid in the Coulomb gauge I understand the usual argument for calculating the vector potential outside of a solenoid of radius $R$ with $n$ turns per unit length carrying current $I_0$ using
$$
\oint \mathbf{A} \cdot d \mathbf{l} = \iint \nabla \times \mathbf{A} \cdot d\mathbf{a} = \iint \mathbf{B} \cdot d\mathbf{a}
$$
which gives (in Gaussian units)
$$
A_{\varphi} = \frac{2\pi}{c} \frac{nI_0 R^2}{r}
$$
However, I am asked explicitly to find the vector potential in the Coulomb gauge. I have two main questions:
1) Is showing that this vector potential satisfies $\nabla \cdot \mathbf{A} = 0$ and $\mathbf{B} = \nabla \times \mathbf{A}$ sufficient? That seems a bit too much like a 'physicist proof' to me.
2) How can I compute the vector potential explicitly from the form
$$
\mathbf{A} = \frac{1}{c} \int \frac{\mathbf{J}(\mathbf{r}',t)}{|\mathbf{r}-\mathbf{r}'|} d^3 r
$$
I have written
$$
\mathbf{J}(\mathbf{r}',t) = n I_0 \frac{\delta(r'-R)}{R} \ \hat{\varphi}
$$
which gives after some algebra and one integration
$$ | {
"domain": "physics.stackexchange",
"id": 59014,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electromagnetism, electrostatics, potential, gauge",
"url": null
} |
c#, asp.net, layout
if (command != null)
{
// Display the result however it needs to be displayed
DisplayResult(String.Format("Last Command Called (Using {0}) : {1}", WebServiceRadio.SelectedItem.ToString(), command.Command));
string userName = GetUsername(); // We don't care how we get the username, just get it
SubmitData(username, command); // We don't care how we submit the data, just submit it
}
else
{
DisplayResult("No Commands Available");
}
}
protected void GetCommandButton_Click(object sender, EventArgs e)
{
ReturnValue();
} | {
"domain": "codereview.stackexchange",
"id": 7687,
"lm_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, layout",
"url": null
} |
ecology, biodiversity
One of the advantages of bamboo over wood is that bamboo contains some silicon in both inner surface (pith-ring) and outer surface (rind) of the bamboo culm.
--Calcium phosphate formation induced on silica in bamboo
As I say I remain very skeptical. There's no evidence shown that this has actually happened. Is it telling that all these claims come from the same general region (India and Burma)? My guess is that this is an old wives' tale that's been written down and uncritically accepted, but if someone has actually seen this happen I'd be happy to be proven wrong, because the idea of plants sparking out flames in the wind is a pretty cool one.
Edit to add a link claiming that bamboo-on-bamboo generates sparks due to the silicates:
The method consists of striking sparks out of the culm of Schizostachyum bamboo with flint, broken pottery, china or even another piece of bamboo. The sparks that occur by striking the Schizostachyum bamboo are presumably generated by the high silica content in this genus of bamboo.
--Bamboo Strike-A-Light, by Tom Lourens, Ash Kivilaakso and Ed Read (My emphasis)
Edit to add that the overall concept of plants starting their own fires has been seriously looked at; the author is skeptical:
Individual plant traits (such as leaf moisture content, retention of dead branches and foliage, oil rich foliage) are known to affect the flammability of plants but there is no evidence these characters evolved specifically to self-immolate, although some of these traits may have been secondarily modified to increase the propensity to burn. ... It is more parsimonious to conclude plants have evolved mechanisms to tolerate, but not promote, landscape fire.
--Have plants evolved to self-immolate?
Notably, in his list of factors potentially allowing self-immolation, he does not list silica, and horsetail isn't mentioned at all. | {
"domain": "biology.stackexchange",
"id": 8236,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ecology, biodiversity",
"url": null
} |
electromagnetism, magnetic-fields, frequency, resonance
so I'm wondering how the poster could have figured this out? There's an interesting question in here if you look hard enough.
First of all, there's nothing special about the resonant frequency of something made of little magnets. It might as well be a piece of ordinary string, a metal bar, or whatever. In fact I think the fact that it's made of separate little magnets stuck together would give it a much lower Q factor than, for example, a metal bell, which would make the resonant frequency less clear and harder to measure.
But anyway, let's assume we have some object with a mechanical resonance around 15 Hz. How do we measure this frequency with no other equipment?
As a human, there are basically two ways you can observe something's vibration frequency. If the vibration is slow enough - below about 5 or maybe 10 Hz - you can just count the individual cycles. If I'm wiggling a jump rope at the resonance frequency and count 300 wiggles per minute, then the frequency is 300/(60 s) = 5 Hz.
The other way - which works well between about 50 Hz and 10,000 Hz - is to listen to the pitch of the vibrations and figure out the frequency of that musical pitch. If I listen to a bell and hear the pitch A above middle C, that means the frequency is 440 Hz (A 440). If, like me, you don't have perfect pitch, you'll need some reference pitch to compare it too, such as a piano, but once you figure out the closest note of the musical scale, you know the frequency to within 3%.
The interesting thing in this case is that 15 Hz is right in the middle of that awkward frequency range which is too fast to count, but too low to hear. | {
"domain": "physics.stackexchange",
"id": 608,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electromagnetism, magnetic-fields, frequency, resonance",
"url": null
} |
ros, docker, nvidia
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
+-----------------------------------------------------------------------------+ | {
"domain": "robotics.stackexchange",
"id": 35475,
"lm_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, docker, nvidia",
"url": null
} |
classical-mechanics, lagrangian-formalism, history, variational-principle, action
Title: How Hamilton's Principle was found? Hamilton's principle states that the actual path a particle follows from points $p_1$ and $p_2$ in the configuration space between times $t_1$ and $t_2$ is such that the integral
$$S = \int_{t_1}^{t_2}L(q(t),\dot{q}(t),t)dt$$
is stationary. And then we have that $L = T - U$ is the lagrangian. Now, how this was found? I mean, how could someone find that picking the quantity $T-U$, considering the integral and extremizing it would give us the actual path on the configuration space?
I know that it works, and the books show this very well. But historically how physicists found that this would give the path? How they found the quantity $L$ and thought on studying it's integral? Hamilton was guided by a hunch that since a minimum principle worked for optics, then perhaps a similar principle worked for mechanics. From his principle of least action he was then able to derive the Euler-Lagrange equations from his paper:
W.R. Hamilton, "On a General Method in Dynamics.", Philosophical Transaction of the Royal Society, 1834 | {
"domain": "physics.stackexchange",
"id": 11752,
"lm_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, history, variational-principle, action",
"url": null
} |
java, algorithm, game, recursion, tower-of-hanoi
public static void main(String[] args) {
for (PlatePair getHanoi : solve(3)) {
System.out.println(getHanoi.getSource() + " : " + getHanoi.getDestination());
}
}
} While your solution appears to work, and I cannot see any bugs, there are a number of best-practices that you are not employing in your solution. It is alsmost as if your code works by coincidence, rather than by design. There are a number of things that look like desperate attempts to make it work... and, like duct-tape, they work, but they are not pretty.
General
You have not described your algorithm in any detail. You have two recursive calls in your recursive method, and you have no documentation as to why. Recursion, in general, is relatively complex to understand, and can be unintuitive. You should help the person reading your code to understand.... and you do nothing. I had to debug the code to watch it happen to understand why you do things the way you do. This is not fair.
Naming conventions
Your Set<PlatePair> is called platePair. At minimum the variable name should be a plural, because, as it stands, it makes sense that platePair is a single PlatePair, and not a Set<PlatePair>. My preference would be 'moves' which indicates what the data represents
Oh, your class is called ToweOfHanoi, but should contain an 'r' as in TowerOfHanoi
Collections
Speaking of Set<PlatePair> ... really? Your actual implementation of the Set<PlatePair> is a LinkedHashSet. The LinkedHashSet will iterate the results in the same order they were inserted, which is why this solution actually works, but, you do not expose that property of the LinkedHashSet to the calling functions. There is nothing stopping a user from calling:
Set<PlatePair> result = new HashSet<>();
moveTowers(4, "A", "B", "C", result); | {
"domain": "codereview.stackexchange",
"id": 6034,
"lm_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, game, recursion, tower-of-hanoi",
"url": null
} |
combustion, fuel
Title: Is liquid hydrogen rocket propeller pollution free? If one searches for the different fuel types used in rockets, one can find that over the years, NASA and other space agencies have used both solid fuels and liquid fuels. I can see that more and more rockets are propelled by using a combination of Liquid Hydrogen (LH) - Liquid Oxygen (LOX). Then, I assumed that the reaction would be:
$$\ce{2H2(l) + O2(l) ->[heat] 2H_2O(v)}\tag{1}$$
By looking at this reaction, one can see that the product of this reaction is water (which most probably will be in a vapor state). Now, I have three questions:
Is this reaction correct?
If the product is water, does that mean that such a combustion reaction is pollution free?
I assume that I am wrong thinking that is pollution free. What would be the polluting agent in this situation and how bad is it, compared to let's say the burning of the same amount of Kerosene? | {
"domain": "chemistry.stackexchange",
"id": 7511,
"lm_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",
"url": null
} |
nextflow
Title: How to include only the trimmed fastq files into a nextflow channel and exclude any secondary log files created? I have the following simple nextflow script, that takes fastq paired reads and runs them through the atria adapter trimming.
// Declare syntax version
nextflow.enable.dsl=2
/*
* pipeline input parameters
*/
params.reads = "$projectDir/data/*_{1,2}.fastq"
params.transcriptome_file = "$projectDir/data/Glycine_max.cdna.all.fasta"
params.gtf_file = "$projectDir/data/Glycine_max.gtf"
params.outdir = "results"
/*
* define the `TRIM` process that creates trimmed.reads.fastq files
* given the reads.fastq file.
*/
process TRIM {
tag "$pair_id"
input:
tuple val(pair_id), path(reads)
output:
path(pair_id)
script:
"""
atria -r ${reads[0]} -R ${reads[1]} -t 1 -l 12 -q 30 -o $pair_id
"""
}
workflow {
read_pairs_ch = Channel.fromFilePairs( params.reads, checkIfExists:true )
trim_ch=TRIM(read_pairs_ch)
} | {
"domain": "bioinformatics.stackexchange",
"id": 2332,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "nextflow",
"url": null
} |
quantum-field-theory, renormalization
The diagrams you ask about exist, but have $D < 0$, and do not need to be renormalized, since they are not diverging when we take the cutoff to infinity. | {
"domain": "physics.stackexchange",
"id": 25024,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-field-theory, renormalization",
"url": null
} |
quantum-field-theory, particle-physics, statistical-mechanics, condensed-matter
Some of these examples are admittedly more contrived than others, but I hope they work together to help convince you that higher orders in perturbation theory are not merely a textbook exercise. | {
"domain": "physics.stackexchange",
"id": 46250,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-field-theory, particle-physics, statistical-mechanics, condensed-matter",
"url": null
} |
turing-machines, complexity-classes
Proof. We start simulating $M'$ on input $x$ by $M_f$ ($M_f$ is same as M, it is TM with proper function $f$ on input $x$). After $M_f$'s computation has halted, $M$ uses the output string of $M_f$ as a "yardstick" of length $f(|x|)$, to guide its further computation. Now, we have two cases depending on the resources: $f(n)$ is time bound or space bound.
For if $f(n)$ is time bound, then $M'$ simulates $M$ on a different set of strings ($x_1, x_2, ...$ where for such i, $x_i$ is an arbitrary string), using the yardstick as an "alarm clock". i.e., it moves its cursor forward on the yardstick after the simulation of each step of M, and halts iff a true blank is encountered in $O(f(n))$ steps. For if $f(n)$ is space bound, then $M'$ simulates M on the quasiblanks of $M_f$'s output string. In either case, the machine is precise.
If M is NDTM, then precisely the same amount of time/space is used over all possible computations of $M'$ (the simulation of $M_f$). In both cases, the time/space is the time/space consumed by $M_f$ plus that consumed by M, and it therefore $O(f(n))$.
What is "yardstick" or 'alarm clock'? Are they the same? It is not clear what is it. Is it indicator to such i, where i is cell in tape in the Turing machine. It seems for me 'alarm clock' looks like a step in $M_f$ of simulation with $M$. So, every step is counted and stop when we simulate $M_f$ by $M$ in $O(f(|x|))$ steps. | {
"domain": "cs.stackexchange",
"id": 13202,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "turing-machines, complexity-classes",
"url": null
} |
The justification for line 7 was given as "∨E 2, 3–5, 6–6". That can be understood as using disjunction elimination (∨E) on the disjunction on line 2 noted as "2" in the justification. One side of the disjunction started with an assumption on line 3 and derived the goal, $$Q$$, on line 5. That subproof was noted as "3-5". The other side of the disjunction started with an assumption on line 6 and since it already was what I wanted to derive I ended the subproof on line 6 as well. This was noted as "6-6".
Kevin Klement's JavaScript/PHP Fitch-style natural deduction proof editor and checker http://proofs.openlogicproject.org/ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9591542805873231,
"lm_q1q2_score": 0.8013576070439645,
"lm_q2_score": 0.8354835330070839,
"openwebmath_perplexity": 432.1254887442047,
"openwebmath_score": 0.8670178055763245,
"tags": null,
"url": "https://math.stackexchange.com/questions/3337855/proof-disjunctive-syllogism-using-natural-deduction"
} |
statistical-mechanics, statistics, probability
Title: Average Neighbouring Impurity Separation in a Random 1D chain
I have a finite and discrete 1D chain (edit: linear chain, i.e. a straight line) of atoms, with unit separation, with a set number of impurities randomly distributed in the place of these atoms in the system. What I would like to do is describe the separation between neighbouring impurities (call it "D" which will always be an integer) statistically, and also to work out the average separation .
For example, the plot below was calculated from several thousand simulations of a chain of length 200 atoms and 10 impurities where the y-axis is the probability $P(D)$ of finding an impurity at distance D, and the x-axis is nearest impurity distance $D$. It kind of looks like a Poisson distributon, which one would expect since the system is discrete and random and a kind of counting exercise, but it doesn't work to well as a fit to the data points. It has been a long time since I did any statistics so I'm not sure how to start expressing what I found mathematically. Since I know the system length ($L = 200$) and the number of impurities ($N_i$) is a fair starting point the impurity density $\rho = N_i/L$ ?
EDIT: The chain isn't allowed to self-intersect, it's a straight line in each case. The system I'm using above is a straight line of 200 evenly spaced atoms, and I'm distributing 10 impurities in the place of random atoms (e.g. at sites 4, 11, 54,...so there are still discrete steps between sites). The graph above is the result of finding the spacings between these impurity sites.
EDIT 2: Attached a picture at the top
EDIT 3: Okay so it seems it could be my PRNG code causing problems. I'm using Fortran 95, here is the code:
`CALL RANDOM_SEED(size = n)
ALLOCATE(seed(n))
CALL SYSTEM_CLOCK(COUNT=clock) !!! intentionally slows it down to prevent succesive calls from returning the same number
do i = 1 , 1000000 | {
"domain": "physics.stackexchange",
"id": 4139,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "statistical-mechanics, statistics, probability",
"url": null
} |
general-relativity, black-holes, tensor-calculus
Title: Schwarzschild Solution I'm able to derive the Schwarzschild solution under the assumptions that the metric is (1) static (2) spherically symmetric and that the space is the vacuum. However, I have read that the Schwarzschild solution can be found assuming only that the metric is a spherically symmetric vacuum. How would the Schwarzschild solution be derived under these weaker conditions? There is a theorem which states that any spherically symmetric solution to the vacuum equations is also necessarily static and asymptotically flat. It is known as Birkhoff's theorem. Chapter 4 of Straumann (2013) contains a full proof. | {
"domain": "physics.stackexchange",
"id": 18956,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "general-relativity, black-holes, tensor-calculus",
"url": null
} |
ros, navigation, ros-kinetic, global-planner, teb-local-planner
base_local_planner: "teb_local_planner/TebLocalPlannerROS"
controller_frequency: 10.0
controller_patience: 15.0
shutdown_costmaps: true
clearing_rotation_allowed: false
recovery_behaviours: [{name: potential_field_recovery, type: potential_field_recovery/PotentialFieldRecovery},{name: aggressive_reset, type: clear_costmap_recovery/ClearCostmapRecovery}]
aggressive_reset:
reset_distance: 0.5
layer_names: ["obstacle_layer"]
--> global_costmap_params : set for Case1
global_costmap:
global_frame: /map
robot_base_frame: base_footprint
update_frequency: 4.0
publish_frequency: 2.0
static_map: true
resolution: 0.05
inflation_radius: 0.38
cost_scaling_factor: 10.0
transform_tolerance: 3.0
plugins:
- {name: static_layer, type: "costmap_2d::StaticLayer"}
- {name: obstacle_layer, type: "costmap_2d::ObstacleLayer"}
- {name: inflation_layer, type: "costmap_2d::InflationLayer"}
--> local_costmap_params
local_costmap:
global_frame: /map
robot_base_frame: base_footprint
update_frequency: 2.5
publish_frequency: 2.0
static_map: false
rolling_window: true
width: 4.0
height: 4.0
resolution: 0.1
transform_tolerance: 3.0
plugins:
- {name: static_layer, type: "costmap_2d::StaticLayer"}
- {name: obstacle_layer, type: "costmap_2d::ObstacleLayer"}
--> costmap_common_params
footprint: [ [-0.3,-0.225], [0.3,-0.225], [0.3,0.225], [-0.3,0.225] ]
transform_tolerance: 0.2
map_type: costmap | {
"domain": "robotics.stackexchange",
"id": 30205,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, navigation, ros-kinetic, global-planner, teb-local-planner",
"url": null
} |
c++, recursion, template, c++20
recursive_depth function:
// recursive_depth function implementation
template<typename T>
constexpr std::size_t recursive_depth()
{
return 0;
}
template<std::ranges::input_range Range>
constexpr std::size_t recursive_depth()
{
return recursive_depth<std::ranges::range_value_t<Range>>() + 1;
}
The testing code
void recursive_count_test()
{
std::vector<int> test_vector{ 5, 7, 4, 2, 8, 6, 1, 9, 0, 3 };
std::cout << recursive_count<1>(test_vector, 5) << '\n';
// std::vector<std::vector<int>>
std::vector<decltype(test_vector)> test_vector2{ test_vector , test_vector , test_vector };
std::cout << recursive_count<2>(test_vector2, 5) << '\n';
// std::vector<std::string>
std::vector<std::string> test_string_vector{ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20" };
std::cout << recursive_count<1>(test_string_vector, "0") << '\n'; | {
"domain": "codereview.stackexchange",
"id": 42293,
"lm_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++, recursion, template, c++20",
"url": null
} |
Is quadrilateral ABCD a rhombus? [#permalink] ### Show Tags 06 Nov 2014, 07:22 Expert's post TARGET730 wrote: Bunuel, For (1), can you consider the case of a kite? Yes. In the special case where all 4 sides are the same length, the kite satisfies the definition of a rhombus. _________________ Senior Manager Joined: 10 Mar 2013 Posts: 290 GMAT 1: 620 Q44 V31 GMAT 2: 690 Q47 V37 GMAT 3: 610 Q47 V28 GMAT 4: 700 Q50 V34 GMAT 5: 700 Q49 V36 GMAT 6: 690 Q48 V35 GMAT 7: 750 Q49 V42 GMAT 8: 730 Q50 V39 Followers: 5 Kudos [?]: 80 [0], given: 2404 Re: Is quadrilateral ABCD a rhombus? [#permalink] ### Show Tags 10 Mar 2015, 20:32 This question is poor, because (1) could be right kite, which is not necessarily a rhombus or a rhombus, but (2) will always satisfy a rhombus. Veritas Prep GMAT Instructor Joined: 16 Oct 2010 Posts: 6742 Location: Pune, India Followers: 1873 Kudos [?]: 11525 [2] , given: 219 Re: Is quadrilateral ABCD a rhombus? [#permalink] ### Show Tags 10 Mar 2015, 22:58 2 This post received KUDOS Expert's post TooLong150 wrote: This question is poor, because (1) could be right kite, which is not necessarily a rhombus or a rhombus, but (2) will always satisfy a rhombus. Actually, the question is fine. A rhombus is a quadrilateral all of whose sides are of the same length - that's all. You could have a rhombus which also has all angles 90 which makes it a square or a rhombus in the shape of a kite. But nevertheless, if it is a quadrilateral and has all sides equal, it IS A RHOMBUS. (1) Line segments AC and BD are perpendicular bisectors | {
"domain": "gmatclub.com",
"id": null,
"lm_label": "1. Yes\n2. Yes\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 1,
"lm_q1q2_score": 0.8723473713594992,
"lm_q2_score": 0.8723473713594992,
"openwebmath_perplexity": 3338.523511084,
"openwebmath_score": 0.5108898282051086,
"tags": null,
"url": "http://gmatclub.com/forum/is-quadrilateral-abcd-a-rhombus-85336.html"
} |
c, bitwise
r = delta_swap(r, 3, 0x5050505050505050);
r = delta_swap(r, 8, 0xff00ff00ff00ff00);
r = delta_swap(r, 4, 0xf0f0f0f0f0f0f0f0);
return r;
} | {
"domain": "codereview.stackexchange",
"id": 28485,
"lm_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, bitwise",
"url": null
} |
optics, air
Title: What's the name for taking pictures of air flow in a normal room? There is a way to photograph air in a room. It makes convection, breathing and movement visible. The result looks a bit like a soap bubble.
This is some kind of optical effect. No special gases or fogs or powders are used.
What's this special form of photography called? You think of Schlieren method?
Google for Schlieren or Schlieren-photography.
[EDIT]: Wikipedia article Schlieren photography | {
"domain": "physics.stackexchange",
"id": 864,
"lm_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, air",
"url": null
} |
It is fun to note that a set of coin flips like this is basically a random walk, and it can be shown that on average, in a set of $n$ flips the distribution will be skewed by about $\sqrt{n}$ in one direction or another. for 10 this is about 3 (we'll round to the nearest whole number) and for 500 this is about 22, however, 3/10 = .3 whereas 22/500 = .044 and as $n \to \infty$, $\sqrt{n}/n \to 0$. This is why small sets tend to be skewed more than larger sets. This is essentially because small sets of flips that make up the larger set tend to be skewed, but in opposite directions (more towards heads or more towards tails) so they have a tendency to cancel each other out.
That was kind of a long answer with a lot of words, I hope it helps. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9591542852576265,
"lm_q1q2_score": 0.8013576168394778,
"lm_q2_score": 0.8354835391516133,
"openwebmath_perplexity": 428.99041664785585,
"openwebmath_score": 0.8071885108947754,
"tags": null,
"url": "https://math.stackexchange.com/questions/452980/the-effect-of-perspective-on-probability"
} |
quantum-metrology, quantum-fisher-information
Title: Paris 2009 paper on Quantum Estimation. From eq. 12 to eq. 16 In the paper "Quantum estimation for quantum technology", by Matteo Paris (2009), one is concerned with estimating a parameter $\lambda$ encoded in a quantum state $\rho_\lambda = \sum_n \rho_n |\psi_n\rangle \langle \psi_n|$ - where both eigenvalue $\rho_n$ and eigenstate $|\psi_n\rangle$ may depend on $\lambda$.
In eq. $(12)$ of the paper, the Symmetric Logarithmic Derivative $L_\lambda$ is written as:
$$ L_\lambda = 2\sum_{nm} \frac{\langle \psi_m| \partial_\lambda \rho_\lambda |\psi_n\rangle}{\rho_n + \rho_m} |\psi_m\rangle \langle \psi_n| \tag{12}\label{12}$$
Some paragraphs ahead the paper reads: | {
"domain": "quantumcomputing.stackexchange",
"id": 4336,
"lm_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-metrology, quantum-fisher-information",
"url": null
} |
php, object-oriented, security, mysqli
Index 0 is X
Index 1 is Y
Index 2 is Z
No! Really, after a bit of time you will need to read the source to remember what was 0, 1 and 2.
You can use a custom class like:
class UpdateField {
private $fieldName;
private $newValue;
private $userName;
}
I have the feeling like it could be a great system if:
UpdateField was an interface, which RankUpdate, DisplayNameUpdate implement so inside the class you have the logic of the validate and the ValidatorSystem just execute the method UpdateField->update() which returns an array of errors or true in case of success.
With this you could reuse UpdateField to update everything not just a userfield.
but instead of use an array, you can improve it:
You can check if fieldName is valid in the constructor of UpdateField and throw an exception if it's not a valid field.
The method validate could be inside this class too, no?
This block of code
if(count($errors > 0)) {
return $errors;
} else {
return true;
}
ignoring the fact that i hate when a function first return an array or a boolean (i know, it's in the default PHP functions BUT IT'S STUPID! It let me feel like: You will never know what this function will return!) It could be improved in one line with:
return count($errors) > 0 ? $errors : true;
but wait, is if(count($errors > 0)) correct? It count the value of a boolean? It's what you want?
@Vogel612 already said about problems inside update functions.
About point 3, take for the moment only the fact that you should use a class instead of an array, about the system i'm thinking it's just an idea in my mind maybe it cannot be done in PHP. | {
"domain": "codereview.stackexchange",
"id": 8233,
"lm_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, object-oriented, security, mysqli",
"url": null
} |
There is an indigenous group of people in South America, the Aimaras. When they mention something that happened in the past, they do not signal to their back, but to their front. To their perception, the past is in front of them, because they can see it. And the future is behind just for the opposite reason. At least in western countries, our perceptions is just the reverse. What do I mean with this? That you just took a diferent frame of reference. Your reference was the final point, instead of the initial one. But the result should be independent of the origin of reference. In your case, in your frame of reference a quantity appeared that you forgot to erase: Matematically, $dm<<M$ actually infinitesimally. The sum of one regular number and an infinitesimal is the regular number. Thus, M-dm=M+(-)dm=M. Now both results agree, as expected. In the same vein, when you are calculating something and get terms of the form $dx=Mdc+Rdcdz$ the term with $dc*dz$ is erased because it is infinitely small relative to $dc$
• +1 . Sir, why does the LHS of the eqn. contain $M$ , the initial mass?? The thrust doesn't act on the initial mass, but on the final changed mass after ejection of gas ie. $M - \Delta M$ . Please explain. – user36790 Dec 7 '14 at 8:32
• I would need to see the derivation of the original book, both assumtions will give rise to the same result (because $(M - dM)=M$). Could you scan the page of the book, or tell me the name author and page, I might find it online and tell you how the author reasoned about it. – Wolphram jonny Dec 7 '14 at 18:34
• Principles Of Physics by Walker,Resnick,Halliday; page no. 226 – user36790 Dec 7 '14 at 18:55 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9693241956308277,
"lm_q1q2_score": 0.8199924782412719,
"lm_q2_score": 0.8459424431344437,
"openwebmath_perplexity": 420.1274052301952,
"openwebmath_score": 0.8009976148605347,
"tags": null,
"url": "https://physics.stackexchange.com/questions/150780/why-is-m-fracdvdt-v-rel-fracdmdt-correct-and-m-dm-fracdv"
} |
filters, audio, software-implementation, group-delay, audio-processing
This, I believe, is supposed to generate an image like in Fig. 3 in the paper, which looks like this (after either truncating or padding to the length of 256 along the time axis)
The problem is that when I try to compute this GD-gram from the equation above, the matrices multiplication cannot be done since both $X$ and $Y$ are non-symmetric. This is the original paper, that is referenced in both this paper and [10], where the authors are deriving the equation (3).
As I understood, the matrices multiplication is a standard one, not element-wise (element-wise multiplication doesn't produce the result that is in the paper). In my implementation below I'm using a window of length 800 samples since the authors of the paper use 50 ms window, which corresponds to 800 samples for 16 kHz sampling rate audio file. I tried to implement that in python as follows:
from scipy.io import wavfile
from scipy.signal import stft, get_window
import numpy as np
import matplotlib.pyplot as plt
rate, data = wavfile.read("test.wav")
n_data = np.multiply(data, np.arange(len(data)))
f, t, X = stft(data, rate, window="hamming", nperseg=800, return_onesided=False)
f_n, t_n, Y = stft(n_data, rate, window="hamming", nperseg=800, return_onesided=False)
group_delay = (np.dot(X.real, Y.real) + np.dot(Y.imag, X.imag)) / np.power(np.abs(X), 2) | {
"domain": "dsp.stackexchange",
"id": 7061,
"lm_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, audio, software-implementation, group-delay, audio-processing",
"url": null
} |
friction, everyday-life
Reference: Personal. The tires on my car are 295/35ZR18 99Y (rear), 275/40ZR17 98Y (front). That means if I was foolish enough to desire to do so, I could drive in excess of 300 kph on dry pavement without worrying that the tires might melt (and my car supposedly can do that and more). Wet pavement is a different beast. My car has a desire to go sideways on wet roads -- and I don't have slicks. | {
"domain": "physics.stackexchange",
"id": 37128,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "friction, everyday-life",
"url": null
} |
cc.complexity-theory, complexity-classes, oracles, relativization, pspace
Title: Does there exist an oracle $A$ such that $(P^{\#P})^{A} \neq PSPACE^{A}$? Background
We know that $P^{\#P} \subseteq PSPACE$.
In addition, we known from
Toda's theorem that $PH \subseteq P^{\#P}$.
For more background on $\#P$, see here:
https://en.wikipedia.org/wiki/Sharp-P
Question
Does there exist an oracle $A$ such that $(P^{\#P})^{A} \neq PSPACE^{A}$? On popular request, here is my comment as an answer:
There is an oracle separating $\mathrm{PP}$ from $\mathrm{PSPACE}$: Jacobo Toran, A combinatorial technique for separating counting complexity classes, ICALP 1989. The best result for $\mathrm{P}^\mathrm{PP}$ that I know is a conditional result by Heribert Vollmer: Relating polynomial time to constant depth. TCS, 207: 159-170, 1998. | {
"domain": "cstheory.stackexchange",
"id": 3964,
"lm_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, oracles, relativization, pspace",
"url": null
} |
homework-and-exercises, dirac-delta-distributions, density-functional-theory
Title: Expected value of the current density operator In Ullrich's TD-DFT book, the paramagnetic current-density operator is defined as
$$\hat{\mathbf{j}}(\mathbf{r})=\frac{1}{2i}\sum_{a=1}^{N}\left[\nabla_a\delta(\mathbf{r}-\mathbf{r}_a)+\delta(\mathbf{r}-\mathbf{r}_a)\nabla_a\right]$$
The expectation value of this operator is $\langle\hat{\mathbf{j}}(\mathbf{r})\rangle=\mathbf{j}(\mathbf{r},t)$. I know that the current density is
$$\mathbf{j}(\mathbf{r},t)=\frac{1}{2i}\left(\Psi^*\nabla\Psi-\Psi\nabla\Psi^*\right),$$
and this is the result I think I have to try to get with $\langle\hat{\mathbf{j}}(\mathbf{r})\rangle$.
At first sight, I have to find some property of the delta function that makes negative one of the terms in the integral of $\hat{\mathbf{j}}(\mathbf{r})$. So, I have
$$ | {
"domain": "physics.stackexchange",
"id": 65890,
"lm_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, dirac-delta-distributions, density-functional-theory",
"url": null
} |
python, python-3.x
5340.256477921415, 5345.893494393828, 5351.970103477654, 5357.690029940076, 5364.220349741838, 5369.634845812043, 5375.477822872349, 5381.490639264271, 5386.277538502685, 5392.417317263559, 5399.20925927504, 5405.590457932012, 5412.311231774181, 5417.972548964183, 5423.344885032394, 5430.27055698847, 5436.008863441382, 5443.815293344428, 5451.217706941529, 5457.671600923901, 5464.928454957941, 5472.2745816133975, 5480.148346030518, 5487.396036154331, 5494.551965246234, 5501.390816415622, 5506.796476959458, 5510.124536753893, 5515.263696990602, 5521.286125710302, 5527.610238972517, 5534.391278452856, 5539.903061852088, 5545.182511439602, 5552.768077256673, 5559.479916545232, 5565.565448921571, 5573.140165230809, 5579.78869601286, 5586.435990822559, 5593.1570912356065, 5600.489681311339, 5607.4914154859935, 5615.085220963556, | {
"domain": "codereview.stackexchange",
"id": 36947,
"lm_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",
"url": null
} |
python, embedded, websocket, cherrypy, raspberry-pi
if args.ssl:
cherrypy.config.update({'server.ssl_certificate': './server.crt',
'server.ssl_private_key': './server.key'})
WebSocketPlugin(cherrypy.engine).subscribe()
cherrypy.tools.websocket = WebSocketTool()
cherrypy.quickstart(Root(args.host, args.port, args.ssl), '', config={
'/ws': {
'tools.websocket.on': True,
'tools.websocket.handler_cls': ChatWebSocketHandler
},
'/js': {
'tools.staticdir.on': True,
'tools.staticdir.dir': 'js'
}
}
)
thread.join() Your code is nice, but it could use a few changes:
% {}: rather than using that formatting method, you should use the string.format() method, involving {0} {1} instead of % as it is recommended by PEP8, Python's official style guide.
print "exitting therad": both exiting and thread are spelt incorrectly
global pollStatus: you shouldn't be naming your variables like camelCase, rather snake_case instead, as also expressed by PEP8
tm=time.localtime(): you should have whitespace between your binary operators, and also you shouldn't abbreviate your variables like tm: local_time would be much better.
Other than that, your code looks nice, well done! | {
"domain": "codereview.stackexchange",
"id": 14569,
"lm_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, embedded, websocket, cherrypy, raspberry-pi",
"url": null
} |
fluid-dynamics, conservation-laws, flow, continuum-mechanics
& = \beta D_t P + \nabla \cdot \mathbf{u}
\end{aligned}
\end{equation} | {
"domain": "physics.stackexchange",
"id": 97370,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fluid-dynamics, conservation-laws, flow, continuum-mechanics",
"url": null
} |
c++, multithreading, random, c++14, numerical-methods
void seed(
const result_type& s01 = 0x0,const result_type& s02 = 0x0,const result_type& s03 = 0x0,const result_type& s04 = 0x0,
const result_type& s05 = 0x0,const result_type& s06 = 0x0,const result_type& s07 = 0x0,const result_type& s08 = 0x0,
const result_type& s09 = 0x0,const result_type& s10 = 0x0,const result_type& s11 = 0x0,const result_type& s12 = 0x0,
const result_type& s13 = 0x0,const result_type& s14 = 0x0,const result_type& s15 = 0x0,const result_type& s16 = 0x0)
{
counter = 0;
p1 = (counter+ 0)%4096; p2 = (counter+ 8)%4096;
p3 = (counter+ 18)%4096; p4 = (counter+ 30)%4096;
p5 = (counter+ 44)%4096; p6 = (counter+ 60)%4096;
p7 = (counter+ 78)%4096; p8 = (counter+ 98)%4096;
p9 = (counter+120)%4096; | {
"domain": "codereview.stackexchange",
"id": 23530,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, multithreading, random, c++14, numerical-methods",
"url": null
} |
microbiology, virology
If you use gloves, or don't touch your face and just wash your hands after opening, you don't have to wait at all. If you don't use gloves or want to pick your nose, rub your eyes, or fiddle with your beard while opening the package, wait 24 hours if the package is nonporous, and 2 hours if it is not. Generally, whether contaminated or not, don't lick, eat, inhale, or rub your eyes with the package :)
Influenza and similar respiratory viruses are transmitted by large droplets, aerosols, and fomites. Your package is a fomite, an object that can be contaminated and transmit disease. There is some debate about what mode of transmission is most significant for influenza, but fomites definitely do transmit influenza and similar viruses. In a study of homes and daycare centers with children who had an active influenza infection, 59% of home objects that were tested were positive for influenza. It's reasonably likely that your package was, at least at some point, contaminated.
@LDiago's answer is useful here, but deserves some clarification. The UK National Health Services information cited in that answer comes from this seminal study. I'm not entirely happy with the wording on the NHS website, though. Virus survives on nonporous surfaces for 24-48 hours. Virus is transferred from nonporous surfaces to hands in detectable amounts for 24 hours. If your package is paper, the relevant test is transfer from cloth or paper. Virus survives for 8-12 hours, and is measurably transferred to hands after 15 minutes to 2 hours. In any case, virus transferred to hands from a fomite survives for only 5 minutes.
Infection from fomites, however, requires virus to be transferred from the fomite to (typically) the hand, and then from the hand to respiratory tract epithelium. Inoculation of nasal passageways is sufficient for infection in laboratory conditions. Conjunctival and oral inoculation may also play a role. You can read more about this in Cecil Medicine Ch. 372 and Murray Medical Microbiology Ch 59. | {
"domain": "biology.stackexchange",
"id": 9177,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "microbiology, virology",
"url": null
} |
lg.learning, vc-dimension
\le
\mathcal{H}_1[x_1,\ldots,x_n]
\cdot
\mathcal{H}_2[y_1,\ldots,y_n]
\le
\left(
\frac{e n}{d_1}
\right)^{d_1}
\cdot
\left(
\frac{e n}{d_2}
\right)^{d_2}
\le
\left(
\frac{2 e n}{d_1+d_2}
\right)^{d_1+d_2}
,
$$
where the last inequality is contained in the proof of
Lemma 16 in
https://www.jmlr.org/papers/v23/20-1353.html
It further follows from that lemma (taking $k=2$)
that
$$
\mathrm{VCdim}(\mathcal{H}_3)
\le
2\log(6)(d_1+d_2).
$$
The only remaining piece is the trivial observation that
$
\mathrm{Pdim}(\mathcal{F})=
\mathrm{Pdim}(-\mathcal{F})
$.
It follows that
$$
\mathrm{Pdim}(\mathcal{F}_3)
\le
2\log(6)(
\mathrm{Pdim}(\mathcal{F}_1)
+
\mathrm{Pdim}(\mathcal{F}_2)
).
$$ | {
"domain": "cstheory.stackexchange",
"id": 5726,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "lg.learning, vc-dimension",
"url": null
} |
neural-network, nlp, naive-bayes-classifier
Solution 1: Take the dataset and handcraft a set of features that you think are relevant to the process of classifying the output. To do this effectively, you should know certain core features that you think relate the input features to the final label (here I use input features to represent the features that you think represent your features well. For example, some features that may be relevant is information about the person or entity posting the title (in stage 2), if they are a well known company in the domain (this can be accesses through some intelligent web scraping and text retrieval methods). Then, it is possibly more likely for it to be a posting, right? Let us assume now that you have constructed this set of features. Now, for each of the set of features, you have a corresponding label to whether there is a vacancy or not. To turn this approach into a ranking problem is very simple. All you have to do is observe the confidence (the softmax probability is good enough) and the one which has a higher probability is ranked higher). This solution is an easy one to accomplish using even simple feed forward neural networks. You would also benefit from testing out simple classifiers like SVMs or Random Forests. It must also be remembered that the actual sentence must be embedded into some numeric space, like a sequence of vectors in $R^n$. This solution does not detail all of the explicit steps but provides a general framework with which you should be able to attack the problem.
Drawbacks The above method requires a lot of time spent in handcrafting the feature set and there is going to be a lot of iteration because the feature set is never going to be perfect. There is always going to be something that you possibly missed out. Secondly training a good word embedding is not a very easy task. You may have to spend a lot of time getting that running, especially if you want the embedding to be somehow related to your words. | {
"domain": "datascience.stackexchange",
"id": 3171,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "neural-network, nlp, naive-bayes-classifier",
"url": null
} |
javascript, html, animation
Title: JavaScript change image every three seconds I have a function that changes the image on a webpage every three seconds. I would like feedback on efficiency, good code practices, and anything else that can improve the quality of this code. It works, I just want any insight if it can work any better. Any and all feedback is welcomed and considered.
Slideshow Script
<!-- Script for Slide Show: Change picture every three seconds -->
<script type="text/javascript">
var index = 0;
change();
function change() {
//Collect all images with class 'slides'
var x = document.getElementsByClassName('slides');
//Set all the images display to 'none' (invisible)
for(var i = 0; i < x.length; i++) {
x[i].style.display = "none";
}
//Increment index variable
index++;
//Set index to 1 if it's greater than the amount of images
if(index > x.length) {
index = 1;
}
//set image display to 'block' (visible)
x[index - 1].style.display = "block";
//set loop to change image every 3000 milliseconds (3 seconds)
setTimeout(change, 3000);
}
</script> | {
"domain": "codereview.stackexchange",
"id": 33915,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, html, animation",
"url": null
} |
electromagnetism, charge, units, si-units, unit-conversion
Title: What is the difference between emu and esu? My textbook contains the following two statements:
In the CGS system the unit of charge is electrostatic unit of charge (E.S.U). It is also called Stat Coulomb (StatC).
In the CGS system, the unit of charge is electromagnetic unit (E.M.U).
How can e.m.u and e.s.u both be the units of charge in the same system? Quoting from the Wikipedia page on the CGS system:
The e.s.u of charge, also called the franklin or statcoulomb, is the charge such that two equal $q=1\:\mathrm{statC}$ charges at a distance of $1\:\mathrm{cm}$ from each other exert an electrostatic force of $1\:\mathrm{dyn}$ on each other.
The e.m.u. of current, also called the biot or abampere, is the current such that two infinitely-long straight, parallel conductors carrying $1\:\mathrm{abA}$ of current and separated by $1\:\mathrm{cm}$ exert a magnetostatic force of $2\:\mathrm{dyn}$ on each other.
The relations between these units are such that
$$\frac{1\:\mathrm{statC}}{1\:\mathrm{abA\times 1\:s}}=\frac{1\:\mathrm{statC}}{1\:\mathrm{abC}}=\frac{1}{c}=\frac{1\:\mathrm{statA}}{1\:\mathrm{abA}}=\frac{1\:\mathrm{statC/s}}{1\:\mathrm{abA}},$$
where $c$ is the speed of light. | {
"domain": "physics.stackexchange",
"id": 32371,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electromagnetism, charge, units, si-units, unit-conversion",
"url": null
} |
c#, winforms, fixed-point
Title: Divide decimal by range of fractions, and then convert the fraction that is closest to a whole number to a mixed fraction My program will divide the decimal (\$30.0575\$) by a range of fractions (\$\frac{1}{1}, \frac{1}{2}, \frac{1}{4}, \dots, \frac{1}{48})\$ leaving me with list of improper fractions that look like this:
\$\frac{1}{1} * 30.0575\$
\$\frac{1}{2} * 60.115\$
\$\frac{1}{3} * 90.1725\$
\$\dots\$
\$\frac{1}{48} * 1442.76\$
My program will then "pick out" the improper fraction that contains the decimal that is closest to a whole number. It will finally convert the improper fraction that is closest to a whole number into a mixed fraction.
How can I make my program more readable?
Are there any "shortcuts" I could implement that would reduce the lines of code used?
How can I overall optimize my code so it completes the same task in a more efficient way, while still keeping readability?
private void FractionsForm_Load(object sender, EventArgs e)
{
var myDecimal = 30.0575;
var results = new List<double>();
for (double i = 1; i < 49; i++)
{
var fraction = 1 / i;
var result = myDecimal / fraction;
results.Add(result);
Console.WriteLine("1/{0} * {1}", i, result);
}
WriteLineSeparator();
var remainders = new List<double>();
foreach (var result in results)
{
var roundedResult = Math.Round(result);
var remainder = roundedResult - result;
remainders.Add(Math.Abs(remainder));
} | {
"domain": "codereview.stackexchange",
"id": 20880,
"lm_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#, winforms, fixed-point",
"url": null
} |
c++, beginner, c++11, hash-map, homework
int progress_interval = total_lines / 10; // Update progress every 10% of the total lines
int current_line = 0;
// Progress bar variables
int progress_bar_width = 40;
while (std::getline(file, line)) {
std::stringstream ss(line);
std::string country, date_str, cases_str, deaths_str;
std::getline(ss, date_str, ',');
std::getline(ss, country, ',');
std::getline(ss, cases_str, ',');
std::getline(ss, deaths_str, ',');
int cases = std::stoi(cases_str);
int deaths = std::stoi(deaths_str);
std::tm entry_date = {};
std::istringstream iss2(date_str);
iss2 >> std::get_time(&entry_date, "%m/%d/%y");
if (mktime(&entry_date) > mktime(&latest_date)) {
latest_date_str = date_str;
latest_date = entry_date;
}
DataEntry* entry = new DataEntry();
entry->set_country(country);
entry->set_date(latest_date_str);
entry->set_c_cases(cases);
entry->set_c_deaths(deaths);
add(entry);
current_line++;
// Update progress bar
if (current_line % progress_interval == 0 || current_line == total_lines) {
int progress = static_cast<int>((static_cast<double>(current_line) / total_lines) * 100); | {
"domain": "codereview.stackexchange",
"id": 44705,
"lm_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++, beginner, c++11, hash-map, homework",
"url": null
} |
ros, ros-control, ros-kinetic, joint-state-publisher, robot-state-publisher
No, it's not. JointState messages are consumed by RSP. So something that publishes those is needed. JSP is only one possible 'something'. But Gazebo, with the right plugins, can also publish JointState messages. Having them both -- for the complete URDF (ie: all joints) -- is going to lead to conflicts.
re: gazebo vs other publishers: think of Gazebo as a stand-in for the hardware (or really: just the dynamic behaviour of your hw). Think of Gazebo plugins as drivers.
Would you run an instance of JSP next to your hw drivers? Would that lead to conflicting messages? If you wouldn't run it, then don't run it when you use Gazebo.
If you need to run JSP, because of missing joints in the msgs from Gazebo, then you might want to update your Gazebo model to include the missing joints.
I will gather what we said in a short answer.
First of all, you should not have multiple nodes publishing on the same /joint_states topic, since this will likely lead to weird behaviors, like the one you were getting. In general, you firstly want to have a joint_state_publisher (JSP) running so that you can debug your URDF. When you are ok with that, you can then switch to simulating the robot in Gazebo. Since you use ROS control, I assume that a JointStateController or similar will be publishing the wheel angles on the /joint_states topic. From that point on, you want in general not to run the JSP node as well. This is because it will provide values which do not match with the simulation: the JSP node keeps an internal fake state and since it is not updated elsewhere, Gazebo will say, e.g., that the joint front_right_wheel_steer_joint has an angle of 1.4 radians while JSP might publish for the same joint the value -5.8. This can lead to different issues later on. Long story short, again: do not use a JSP when someone else is publishing the correct joint values, in general. | {
"domain": "robotics.stackexchange",
"id": 33758,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, ros-control, ros-kinetic, joint-state-publisher, robot-state-publisher",
"url": null
} |
python, performance, beginner, hash-map, pyqt
@pyqtSlot(QObject, dict, QStandardItemModel)
def load_stat_cat_tree(self, data, model):
start=time.clock()
res = dict()
ch_y = 2015
tree = self.expences_cat_tree_stat
exp_cat_tree_header = list(["Year / Category", "Total"])
month_perc_item_list = list()
overall_spent = float()
prev_month_perc =float()
one_month_sum_list = list()
cat_dict = dict()
initial_dict_creation_time_start = time.clock()
for yy in sorted(data):
year_item = QStandardItem(yy)
one_year_sum = float()
for mm in sorted(data[yy]):
date = QDate.fromString(mm, "M")
chosenMonth = date.toString("MMMM")
month_item = QStandardItem(chosenMonth)
one_month_sum = float()
for dd in sorted(data[yy][mm]):
one_day_sum = float()
day_str = QDate.fromString(dd +" " + mm +" " + yy, "dd MM yyyy")
day_str_out = day_str.toString("d, dddd")
day_item = QStandardItem(day_str_out)
day_item.setToolTip(day_str.toString("d.MM.yy, dddd"))
for ii in sorted(data[yy][mm][dd]):
item_pr = float(data[yy][mm][dd][ii]["price"])
item_name=data[yy][mm][dd][ii]["name"]
#item_descr=data[yy][mm][dd][ii]["descr"] | {
"domain": "codereview.stackexchange",
"id": 16887,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, performance, beginner, hash-map, pyqt",
"url": null
} |
game, functional-programming, homework, clojure
(defn move-star [star]
(update-in star [:y] #(+ % (:speed star))))
(defn move-stars [state]
(if-not (or
(= (:dir (:rocket state)) 0)
(= (:dir (:rocket state)) -1))
{:rocket (:rocket state)
:background (q/load-image "images/stars.jpg")
:fires (:fires state)
:score (:score state)
:highscore (:highscore state)
:gameOver true
:smoke (:smoke state)
:stars (doall (map move-star (:stars state)))
:meteors (:meteors state)
:bonus (:bonus state)}
state))
(defn move-bonus [state]
(if (empty? (:bonus state))
state
(update-in (:bonus state) [:y] + 4)))
(defn move-rocket [rocket]
(case (:dir rocket)
(1) (update-in rocket [:y] - 10)
(2) (update-in rocket [:y] + 10)
(3) (update-in rocket [:x] - 10)
(4) (update-in rocket [:x] + 10)
(0) (update-in rocket [:x] + 0)
(-1) (update-in rocket [:x] + 0)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | {
"domain": "codereview.stackexchange",
"id": 31122,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "game, functional-programming, homework, clojure",
"url": null
} |
neural-network
Title: In Neural network, if one node is deleted, where should other nodes be connected? If it's a fully connected neural network, should we just remove those lines that were originally connected to the deleted node, and hence no actual changes on the remaining nodes? Except there weights and bias will be updated? Whether you are actually removing the nodes or simply deactivating them, more or less the same concept would apply. The idea is called Dropout and is employed to inhibit the tendency to overfit. Suppose you're removing a node from the $i^{th}$ layer which has $n_i$ nodes. Removing it will not only involve removing the connections from the previous layers (${n_{i-1}}$ connections) but also removing the connections from the removed node to the next layer ($n_{i+1}$ connections) which would essentially remove $n_{i-1}+n_{i+1}$ connections.
It would be much better to simply set the weights and biases to $0$. Here's the math behind the idea and you can find one possible implementation here. | {
"domain": "datascience.stackexchange",
"id": 9282,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "neural-network",
"url": null
} |
time-complexity, sat
Title: What are those deterministic algorithms for k-SAT that are not derandomization of random algorithms like PPSZ and Schöning's local search? I am doing a survey on k-SAT where time complexity is in terms of n, i.e. the number of variables in a formula.
As for the fast algorithms for k-SAT, we see
biased-PPSZ, PPSZ, Schöning's local search, algorithms which combine PPSZ and Schöning's local search, algorithms which derandomize PPSZ or Schöning's local search.
There are many papers which are discussing improvement and property of PPSZ.
However, where are other deterministic algorithms going? Is there no future for every deterministic algorithm which is not a derandomization of PPSZ or Schöning's local search or their improvement,combination?
There exists deterministic fast branching algorithms which are not derandomization from some randomized algorthms for k-SAT where time complexity is in terms of m and l, i.e. the number of clauses in a formula and the length of a formula. And there is a branching algorithm, and in the early papers which discuss k-SAT in terms of n, there is also algorithm using branching algorithm to obtain a speed which is from Burkhard Monien and Ewald Speckenmeyer. For 2-SAT, there is linear time deterministic algorithm based on strongly connected components of a contructed graph.
After Hertli reveals that unique-SAT bounds for PPSZ hold in general, work turns from derandomizing and improving Schöning's local search to derandomize PPSZ and improve that. Are there any possibilities for those deterministic algorithms without derandomization like some branching algorithms? What if some techniques like measure and conquer are contributed to k-SAT? No matter how, it must be admitted that PPSZ and Schöning's local search are both simple and efficient.
Papers I mention are as follows. | {
"domain": "cstheory.stackexchange",
"id": 4914,
"lm_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-complexity, sat",
"url": null
} |
php, security, pdo, authentication, session
if (!Isset($_SESSION['crecketgaming_usergroup'])){
$_SESSION['crecketgaming_usergroup'] = "Guest";
}
if (Isset($_SESSION['crecketgaming_username'])){
$usernametest = $_SESSION['crecketgaming_username'];
$sql2 = "SELECT Usergroup, user_ID FROM users WHERE Username = :username";
$sth = $conn->prepare($sql2);
$sth->bindParam(':username', $usernametest, PDO::PARAM_STR);
$sth->execute();
$rowcount = $sth->rowCount();
$row = $sth->fetch(); | {
"domain": "codereview.stackexchange",
"id": 12846,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "php, security, pdo, authentication, session",
"url": null
} |
ros, talker
Originally posted by jarvisschultz with karma: 9031 on 2016-01-22
This answer was ACCEPTED on the original site
Post score: 4
Original comments
Comment by RosUser on 2016-01-22:
I have changed my .bashrc file to:
source /opt/ros/indigo/setup.bash
export ROS_ROOT=/opt/ros/indigo/share/ros
export PATH=$ROS_ROOT/bin:$PATH
export ROS_MASTER_URI=http://mypc:11311/
export ROS_PACKAGE_PATH=/home/hjt/catkin_ws/src:/opt/ros/indigo/share:/opt/ros/indigo/stacks
Comment by RosUser on 2016-01-22:
Okay now it is working, by running each time: source ./devel/setup.bash in a new terminal.
Can I avoid this or do I have to run: source ./devel/setup.bash every time I have new terminal ?
Ps. And I have already included: source /opt/ros/indigo/setup.bash in my .bashrc file !
Comment by jarvisschultz on 2016-01-22:
I edited my answer to provide some more information about when and where to source the setup.bash files.
Comment by RosUser on 2016-01-25:
Thanks it is working | {
"domain": "robotics.stackexchange",
"id": 23521,
"lm_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, talker",
"url": null
} |
c#, asp.net, video, reference
Title: Displaying a video player to eligible users I posted this on Stack Overflow, but it was suggested that I move it over to Code Review.
I would like some feedback on the way I decided to clean up code from the in a .NET project that had Page_Load functions that had been added to over many years to the point that they were a complete mess.
While the code cleanup is the context of the question, this is really a question about if I should or should not be passing by reference to "underscore functions". Underscore functions are functions that are not meant to be used for encapsulation (although I made all the underscore functions protected) nor "reusability", but instead to wrap code in a human friendly way. The "clean up" version below is not the final product, but was instead a first stab a cleaning up the code. The cleaned up code is functioning correctly.
Just to be clear (the code below is a bad example for this), in general I have needed to do mass mutation in the "underscore" functions on other pages. Meaning I have had to change/set the value for multiple variables that are being passed in and then used outside the "underscore" function's scope.
ORIGINAL PAGE_LOAD
public void Page_Load() {
// Set player to have been initialized
this.initialized = true;
if(!this.playerOverride) {
String vendorValue = Resolver.Resolve("PlayerVender");
if(vendorValue.Equals("jwplayer")) {
this.UseVideoRxPlayer = false;
} else {
this.UseVideoRxPlayer = true;
}
}
// Get instances for use
VideoAccess videoAccess = VideoAccess.getInstance();
LearnerAccess learnerAccess = LearnerAccess.getInstance(); | {
"domain": "codereview.stackexchange",
"id": 11030,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, asp.net, video, reference",
"url": null
} |
ruby, iterator, serialization
#jp row strings by en consonants:
jrsbec = syllabary_data.select{|con,row|con =~ /^[KSTNHMYRWkstnhmyrwN]$/}
#jp row arrays by en consonants:
jrabec = Hash[*jrsbec.map{|con,row|[con,row.split]}.flatten(1)]
#en vowels with jp row arrays by en consonants:
evwjrabec = Hash[jrabec.map{|con,row|[con,Hash[veng.zip(row)]]}] #array of hashes => no splat
#jp syllables by en syllables:
#outer map provides en consonant to inner map
#inner map creates the dictionary we want in array form, e.g. [#K#[['Ka','カ'],..], #S..]
#flatten(1) removes outer array created by outer map [['Ka','カ'],..] => no splat
jp_by_en = Hash[evwjrabec.map{|con,row|row.map{|vowel,jp_syl| [con+vowel,jp_syl] }}.flatten(1)]
#remove forgotten syllables:
jp_by_en.select{|en_syl,jp_syl|jp_syl != '_'}
}
Hash[*syllabary_names.zip(a).flatten(1)]
}.call
end | {
"domain": "codereview.stackexchange",
"id": 5905,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ruby, iterator, serialization",
"url": null
} |
is annihilated when sandwiched on both sides by $b$. By symmetry (same argument applied to $[b,a]=-[a,b]$), left and right multiplying by $a$ also sends the commutator to zero. Hence the second and third terms of the expansion are also zero, and we have $(ab-ba)^3=0$. By the stipulation of the problem, this implies that $ab-ba=0$ for arbitrary $a,b\in R$, so that $R$ is commutative. ### Herstein 3.26: Let $R$ be a ring with no non-zero nilpotent elements such that $(ab)^2=(ba)^2$ for all $a,b\in R$. Prove that $R$ is commutative. I don't have a good solution to this problem. It is treated as theorem 5 in the above-mentioned [paper by John Wavrik](http://math.ucsd.edu/~jwavrik/web00/ISSAC_99.pdf). As in 3.25, the assumption of no nilpotents is stronger than necessary — apparently, it can be shown that $(ab-ba)^5=0$ for all $a,b\in R$. I would be interested to hear of an elegant way of showing it. ### Herstein 3.27: Let $p_1,\ldots,p_k\in\mathbb{Z}$ be distinct primes, $n=p_1\cdots p_k$, and $R=\mathbb{Z}/n\mathbb{Z}$. Prove there exist exactly $2^k$ elements $x\in R$ with $x^2=x$. First, observe that $x^2-x=0$ modulo $n$ means that $$n=p_1\cdots p_k\mid x(x-1).$$ Every prime in the list must individually divide either $x$ or $x-1$ (these scenarios are mutually exclusive, or else we would have a prime dividing $x-(x-1)=1$). Hence we have | {
"domain": "bergknoff.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9796676496254957,
"lm_q1q2_score": 0.82874244498397,
"lm_q2_score": 0.8459424431344437,
"openwebmath_perplexity": 101.62482708021156,
"openwebmath_score": 0.9218316078186035,
"tags": null,
"url": "http://jonathan.bergknoff.com/journal/topics-in-algebra-chapter-3-supplementary-d"
} |
evolution, natural-selection, mutations, sexual-reproduction
The testis seems to be the Oven in which genetic variation is baked. The rapid turnover of spermatogenesis, whereby each primary spermatocyte finally results in 4 sperms (Compared to One Ovum resulting from each primary Oogonia), that's beside the very large number of sperms produced daily, that continues for years and year. While with the Oogenesis everything really finishes at the foetal life, the remaining is just maturation steps, nothing is new as far as change of genetic material inside the Oocytes is concerned, this is the state throughout most of the female's life.
When I look at the seminiferous tubules, and see all those layers of spermatocytes leading to sperms, I tend to think that there is even some small scale natural selection, that bad mutated germline cells would die off, and only the ones with good genomes would survive all the stages of spermatogensis, and possibly the ones with beneficial mutation might have an advantage in survival in that milieu and even might have better chances of fertilizing the ovum?
Not only that, the testis seems to be more exposed to stressors inside the body and even to direct external environmental stressors, while the Ovaries lying deep inside, seem to be more protected. The Oocyte actually "selects" one sperm, so it's rule is selective rather than productive of change.
All of that makes one think that it is the male germline cells that could mediate high mutation rate in response to stressors, or even without stressors by virtue of the very high production rate of germline cells for very long periods of time. It seems that this is the real source of beneficial mutations that would ultimately drive evolution. | {
"domain": "biology.stackexchange",
"id": 9629,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "evolution, natural-selection, mutations, sexual-reproduction",
"url": null
} |
You might notice that if instead of:
$\lim_{n\to\infty}(1/2)(x-x_n)(ky)^n = C_{a,k}^+\tag{8}$
You don't divide by 2:
$\lim_{n\to\infty}(x-x_n)(ky)^n = C_{a,k}^+\tag { }$
The known closed form constant is then $C_{2,2}^+=\frac{pi^2}{4}$, while the other version (below) with $a=x^k+x$ has a closed form constant of $C_{2,2}^{-}=\frac{pi}{2\sqrt{3}}$.
other version: $x_n=\sqrt[k]{a-\sqrt[k]{a-\sqrt[k]{a-\sqrt[k]{a_n-\dots}}}}\tag { }$
C+ approaches 1 from above: $\lim_{k\to \infty} C_{1,k}^+ = 2 \ln 2\tag{}$
$\lim_{k\to \infty} C_{2,k}^+ = 3 \ln \tfrac{3}{2}\tag{}$
$\lim_{k\to \infty} C_{3,k}^+ = 4 \ln \tfrac{4}{3}\tag{}$
C- approaches 1 from below:
$\lim_{k\to \infty} C_{2,k}^- = \ln 2 \tag{}$
$\lim_{k\to \infty} C_{3,k}^- = 2 \ln \frac{3}{2}\tag{}$
$\lim_{k\to \infty} C_{4,k}^- = 3 \ln \frac{4}{3} \tag{}$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9838471637570105,
"lm_q1q2_score": 0.8362417229678963,
"lm_q2_score": 0.84997116805678,
"openwebmath_perplexity": 425.64481926582175,
"openwebmath_score": 0.9718883037567139,
"tags": null,
"url": "https://math.stackexchange.com/questions/579541/on-the-paris-constant-and-sqrtk1-sqrtk1-sqrtk1-sqrtk1-dots"
} |
ros, ros2, ros-bouncy, ardent
Title: ROS Answers SE migration: ROS2 version
How can I know which version of ROS2 have i installed ? Ardent or Bouncy Bolson ?
Originally posted by aks on ROS Answers with karma: 667 on 2018-07-27
Post score: 1
The ROS_DISTRO envrionment variable will tell you which release you have. You can run:
printenv ROS_DISTRO
on the command line and it will tell you.
Originally posted by PeteBlackerThe3rd with karma: 9529 on 2018-07-27
This answer was ACCEPTED on the original site
Post score: 2
Original comments
Comment by aks on 2018-07-27:
And how do we know which version are we installing ? Coz i guess it is not mentioned in the installation instructions.
Comment by pokitoz on 2018-07-27:
I think you need to export this variable (export ROS_DISTRO=bouncy # or ardent : https://github.com/ros2/ros2/wiki/Linux-Install-Debians#install-ros-2-packages)
Comment by PeteBlackerThe3rd on 2018-07-27:
If you already have a distro of ROS2 installed then it will already be set
Comment by PeteBlackerThe3rd on 2018-07-27:
@aakash_sehgal It's cleared mentioned in these instructions: https://github.com/ros2/ros2/wiki/Linux-Install-Debians#install-ros-2-packages
Comment by aks on 2018-07-27:
Yes, now I see it, I guess the documentation is updated within the last month.
Comment by PeteBlackerThe3rd on 2018-07-27:
Yes probably, this is all moving quite fast at the moment!
Comment by Harsh2308 on 2020-08-10:
How to know the patch release I am using? | {
"domain": "robotics.stackexchange",
"id": 31383,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, ros2, ros-bouncy, ardent",
"url": null
} |
performance, sql, sql-server, t-sql
Title: SQL Server - Iterate, aggregate, and insert I'm trying to find an efficient way to aggregate data for reporting. Let's say I need to aggregate the following data in 5-second intervals:
CREATE TABLE RawData
(
Result FLOAT,
CaptureTime DATETIME
);
INSERT INTO RawData VALUES
(2.3, '2018-04-01 00:00:00'),
(2.5, '2018-04-01 00:00:01'),
(2.8, '2018-04-01 00:00:02'),
(2.8, '2018-04-01 00:00:03'),
(3.4, '2018-04-01 00:00:04'),
(5.1, '2018-04-01 00:00:05'),
(2.2, '2018-04-01 00:00:06'),
(4.1, '2018-04-01 00:00:07'),
(4.3, '2018-04-01 00:00:08'),
(5.9, '2018-04-01 00:00:09'),
...
The aggregated data will be stored in another table:
CREATE TABLE AggregateData
(
Result FLOAT,
StartCaptureTime DATETIME,
EndCaptureTime DATETIME
); | {
"domain": "codereview.stackexchange",
"id": 30377,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "performance, sql, sql-server, t-sql",
"url": null
} |
machine-learning, python, tensorflow, lstm
Title: Value Error: Operands could not be broadcast together with shapes - LSTM I am trying an LSTM model using tensorflow following this tutorial .
I am having trouble understanding why am I getting an error in my test set when I try to invert scaling for forecast (line 86 in the tutorial).
After loading the dataset and created featured, following is what I did for reframed dataset,
# split into train and test sets
values = reframed.values
split_point = len(reframed)- 168
train = values[ : split_point, :]
test = values[split_point: , :]
# split into input and outputs
train_X, train_y = train[:, :-1], train[:, -1]
test_X, test_y = test[:, :-1], test[:, -1]
# reshape input to be 3D [samples, timesteps, features]
train_X = train_X.reshape((train_X.shape[0], 1, train_X.shape[1]))
test_X = test_X.reshape((test_X.shape[0], 1, test_X.shape[1]))
print(train_X.shape, train_y.shape, test_X.shape, test_y.shape)
>> (2399, 1, 39) (2399,) (168, 1, 39) (168,)
# design network
model = Sequential()
model.add(LSTM(50, input_shape=(train_X.shape[1], train_X.shape[2])))
model.add(Dense(1))
model.compile(loss='mae', optimizer='adam')
# fit network
history = model.fit(train_X, train_y, epochs=50, batch_size=72, validation_data=(test_X, test_y), verbose=2, shuffle=False)
# make a prediction
yhat = model.predict(test_X)
test_X = test_X.reshape((test_X.shape[0], test_X.shape[2])) | {
"domain": "datascience.stackexchange",
"id": 3094,
"lm_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, python, tensorflow, lstm",
"url": null
} |
observational-astronomy, amateur-observing, eyepiece
Title: Next eyepiece for my telescope; how do decide which one to get? I have an Astronomers Without Borders telescope with 650 mm focal length and 130 mm aperture. To go with them, I have a 10 mm and wide eye relief 25 mm eyepiece.
I tried to view Jupiter with the 10 mm, but all it appears to be is a small white dot, as if it is a star; its moons are even smaller pinpricks. Answers to Choosing an eyepiece for planet viewing seems to suggest that the telescope I have is good enough to see quite a bit of detail--including Jupiter's bands and colors--and that something is wrong with my stargazing (collimation, viewing conditions, or problems with the telescope/eyepiece itself).
I'm considering getting a 4 and 6 mm eyepiece as well.
What should I consider in order to decide which eyepiece focal length and type/design to get next? TL;DR: get a 2x Barlow first - it's cheaper than an eyepiece and can be used with both of your 1.25" eyepieces.
If it works well and fiddling about with eyepieces and the Barlow in the dark gets a bit annoying, then look at buying a dedicated eyepiece.
A common wish when first looking at planets is to want to push the magnification as high as possible.
Many people, after getting their first telescope, have gone and bought an eyepiece which gives the maximum possible magnification, given the aperture of their telescope. Then, having tried it, they've come away disappointed with the blurry result they get.
This is because there are several factors conspiring against them:
The "resolving power" of the telescope. There are two formulae which give similar results: the Dawes Limit and the Rayleigh Limit.
The former can be calculated by dividing 116 by the aperture of the telescope in mm, and the latter by dividing 138 by the aperture in mm.
The result is the maximum resolution in arc seconds. | {
"domain": "astronomy.stackexchange",
"id": 6119,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "observational-astronomy, amateur-observing, eyepiece",
"url": null
} |
python, database
There's a method enclose_str but it does not seem to be called.
Many more problems which I have not the will to type up ... basically this is far from ready for anyone to use. | {
"domain": "codereview.stackexchange",
"id": 3565,
"lm_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, database",
"url": null
} |
thermodynamics, elasticity
If we next substitute EOS Eqn. 2 for $epsilon$ into Eqn. 8, we obtain:
$$du=C_vdT+v_0(K\alpha^2TdT+\frac{\sigma d\sigma}{K}+\alpha d(\sigma T))\tag{9}$$Eqn. 9 is an exact differential for du, and integrates immediately to:
$$u=u_0+C_v(T-T_0)+v_0\left[K\alpha^2\frac{(T^2-T_0^2)}{2}+\frac{\sigma^2}{2K}+\alpha T\sigma\right]\tag{10}$$
If we apply similar procedures to the entropy s, we obtain:
$$s=s_0+C_v\ln{(T/T_0)}+v_0\left[K\alpha^2(T-T_0)+\alpha T\right]\tag{11}$$
Eqns. 10 and 11 can be combined to obtain the Helmholtz free energy (to quadratic terms in $(T-T_0)$ as follows: $$a=u-Ts=a_0-s_0(T-T_0)-\frac{C_v(T-T_0)^2}{2T_0}-\frac{v_0K\alpha^2}{2}(T-T_0)^2+\frac{v_0\sigma^2}{2K}\tag{12}$$
This analysis can be continued one more step to provide an explicit relationship for the specific Gibbs free energy g (aka the chemical potential $\mu$) by subtracting $v_0\sigma \epsilon $, and illustrating how the chemical potential is related to the stress $\sigma$ and the temperature T. | {
"domain": "physics.stackexchange",
"id": 50441,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "thermodynamics, elasticity",
"url": null
} |
thermodynamics, home-experiment
$^\dagger$This is assuming no additional conduction to the table. If the table was made of metal you might see the effect you were expecting, since the heat would be able to conduct quickly through the pewter mug into the table. | {
"domain": "physics.stackexchange",
"id": 19612,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "thermodynamics, home-experiment",
"url": null
} |
pharmacology
Title: Why is Paracetamol so great? Every time I get ill (cold, flu etc) I take a couple of these wonderful tablets for up to 4 times a day and I, eventually, get better. What exactly is paracetamol? Why is it so effective and is it really not harmful as my doctor would have me believe? Paracetamol is a pain killer, it does not treat the cause of your illness, it only alleviates the symptoms. From its wikipedia page:
Paracetamol [...], chemically named
N-acetyl-p-aminophenol, is a widely used over-the-counter analgesic
(pain reliever) and antipyretic (fever reducer).
So, paracetamol does not make you better. Your immune system makes you better. Paracetamol just makes you feel better while you are waiting for your immune system to get an infection under control.
You should be aware that it is only safe in small doses and a toxic dose is not that much more than the recommended one (source):
Risk of severe liver damage (ie a peak ALT more than 1000 IU/L)
Based on the dose of paracetamol ingested (mg/kg body weight):
Less than 150 mg/kg - unlikely
More than 250 mg/kg - likely
More than 12 g total - potentially fatal
Again from wikipedia:
While generally safe for use at recommended doses (1,000 mg per single
dose and up to 4,000 mg per day for adults),[6] acute overdoses of
paracetamol can cause potentially fatal liver damage and, in rare
individuals, a normal dose can do the same; the risk may be heightened
by chronic alcohol abuse, though it is lessened by contemporary
alcohol consumption. Paracetamol toxicity is the foremost cause of
acute liver failure in the Western world, and accounts for most drug
overdoses in the United States, the United Kingdom, Australia and New
Zealand.
I am sure someone else can explain the pharmacokinetics and details of action of paracetamol. I just wanted to point out that paracetamol can be dangerous and should be treated with respect. | {
"domain": "biology.stackexchange",
"id": 722,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "pharmacology",
"url": null
} |
image-processing
Since punch holes and margins will be larger in black area than two words, I'd previously try to just exclude them with a simple static mask, if your raw material permits (i.e. if you're scanning shelves of filed documents, then all will have the punch holes in the same place), or by trying to "smartly" detect them (for example, look for circles in potential punch-hole places, diagonal lines in potential staple places and so on). | {
"domain": "dsp.stackexchange",
"id": 6252,
"lm_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-processing",
"url": null
} |
rosbag
this is what runs.
leeredden@ubuntu:/media/Ubuntu/RosBagFiles/TestFolder$ roslaunch export.launch
... logging to /home/leeredden/.ros/log/dae934d2-7113-11e0-9fd4-00216a65216e/roslaunch-ubuntu-2516.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server http://ubuntu:41180/
SUMMARY
========
NODES
/
rosbag (rosbag/rosbag)
extract (image_view/extract_images)
starting new master (master configured for auto start)
process[master]: started with pid [2530]
ROS_MASTER_URI=http://ubuntu:11311/ | {
"domain": "robotics.stackexchange",
"id": 5452,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "rosbag",
"url": null
} |
newtonian-mechanics, classical-mechanics, momentum, reference-frames
Title: Particle disintegration (Landau & Lifshitz) In the particle disintegration problem in the book by Landau and Lifshit(z), it is considered a particle with velocity $\vec{V}$ in the lab frame, which disintegrates into two particles with masses $m_1$ and $m_2$. It is said that $\vec{v}$ and $\vec{v}_0$ are the velocities of one of the particles in the lab frame and the center of mass (c.m.) frame, respectively, hence being "evident" that $\vec{v}=\vec{V}+\vec{v}_0$. How is this evident? Shouldn't $\vec{V}$ be the velocity of the c.m. in the lab frame?
If the latter was already the case, from the conservation of momentum in the lab frame, we would have:
$$m_0\,\vec{V} = m_1\,\vec{v_1}+m_2\,\vec{v_2}$$
(where either $\vec{v_1}$ or $\vec{v_2}$ are equal to $\vec{v}$; each number corresponds to a particle).
This can be written as
$$\frac{m_0}{M} \vec{V}=\vec{v}_{cm}$$
with $M=m_1+m_2$ and $\vec{v}_{cm}$ being the velocity of the c.m. in the lab frame. Thus, $\vec{V}=\vec{v}_{cm}$ would require conservation of mass (which is not mentioned). Center of mass before the disintegration is in the initial particle. This means that the center of mass moves with velocity $\vec V$ in lab frame. Thus, to switch from center of mass frame to lab frame you just use the Galilean transformation
$$\vec v=\vec v_0+\vec V.$$ | {
"domain": "physics.stackexchange",
"id": 41972,
"lm_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, classical-mechanics, momentum, reference-frames",
"url": null
} |
bash, installer
echo "- Creating launcher... "
sudo wget $icon -qO /tmp/popcorntime.png && sudo cp /tmp/popcorntime.png /usr/share/pixmaps/
echo "[Desktop Entry]
Comment=Watch movies in streaming with P2P.
Comment[fr]=Regarder des films en streaming.
Name=Popcorn Time
Exec=/usr/bin/popcorn-time
StartupNotify=false
Type=Application
Icon=popcorntime
Actions=ForceClose;ReportIssue;FlushDB;FixNode;BuildUpdate;
Keywords=P2P;streaming;movies;tv;series;shows;
Keywords[fr]=P2P;streaming;films;séries;télévision;tv;
[Desktop Action ForceClose]
Name=Force close
Name[fr]=Forcer la fermeture
Exec=killall Popcorn-Time
OnlyShowIn=Unity;
[Desktop Action ReportIssue]
Name=Report Issue
Name[fr]=Rapporter un problème
Exec=sh -c \"popcorn-time --issue\"
OnlyShowIn=Unity;
[Desktop Action FlushDB]
Name=Flush databases
Name[fr]=Vider les bases de données
Exec=sh -c \"killall Popcorn-Time ; rm -rf $HOME/.config/Popcorn-Time ; /usr/bin/popcorn-time\"
OnlyShowIn=Unity;
[Desktop Action FixNode]
Name=Fix Node-Webkit
Name[fr]=Réparer Node-Webkit
Exec=sh -c \"rm -rf $HOME/.config/node-webkit ; killall Popcorn-Time ; /usr/bin/popcorn-time\"
OnlyShowIn=Unity; | {
"domain": "codereview.stackexchange",
"id": 7843,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "bash, installer",
"url": null
} |
quantum-mechanics, hilbert-space, schroedinger-equation, time-evolution, quantum-states
Title: Why do wavefunctions for stationary states include $e^{-iEt/\hbar}$? Stationary states are separable solutions with $\Psi(x, t)=\psi(x)e^{-iEt/\hbar}$. But why is that there? Griffiths (Section 2.1 Stationary states, equation 2.8) says that observables for these states are constant in time, so the time-dependent factor can be left out. So why do we include that factor?
Unlike the duplicate, I want to ask "Can we safely assume $\Psi(x,t)=\psi(x)$ and simply abandon that whole $\exp$ altogether?" It does not affect observables if the system is in an eigenstate. However, as soon as you have a superposition of states with different energies, the amplitudes will oscillate depending on the energy difference because of this factor. | {
"domain": "physics.stackexchange",
"id": 55942,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, hilbert-space, schroedinger-equation, time-evolution, quantum-states",
"url": null
} |
# Mechanical Vibrations
#### alane1994
##### Active member
Here is my problem verbatim.
A mass weighing 100g stretches a spring 5cm. If the mass is set in motion from its equilibrium position with a downward velocity of 10cm/s, and if there is no damping, determine the position
$$u$$ of the mass at any time $$t$$. When does the mass first return to its equilibrium position?
For this, these are the things that I have been able to determine:
$$m=100~\text{grams}$$
$$\gamma=0$$
And I believe that we would use Newton's Law?
$$mu^{\prime\prime}(t)+\gamma u^{\prime}(t)+ku(t)=F(t)$$
And we would need initial conditions right?
$$u(0)=~?\\ u^{\prime}(0)=-10cm/s$$
I am rather stumped...
EDIT:
Would $$u(0)=5$$?
Last edited:
#### MarkFL
Staff member
I would orient my coordinate axis such that equilibrium is at:
$$\displaystyle u(0)=0$$
and take the positive direction to be up.
Now, you need to consider the forces acting on the mass:
Gravity:
$$\displaystyle F_1=-mg$$
Restoring force (Hooke's Law):
$$\displaystyle F_2=-ku+mg$$
Notice that when the mass is at equilibrium then the spring exerts a restoring force on the mass equal in magnitude but opposite in direction to the weight of the mass.
Now apply Newton's second law:
$$\displaystyle \sum F=ma$$
$$\displaystyle -ku=m\frac{d^2u}{dt^2}$$
$$\displaystyle \frac{d^2u}{dt^2}+\frac{k}{m}u=0$$
Can you proceed?
#### alane1994
##### Active member
I would orient my coordinate axis such that equilibrium is at:
$$\displaystyle u(0)=0$$ | {
"domain": "mathhelpboards.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9898303422461274,
"lm_q1q2_score": 0.8115553034706653,
"lm_q2_score": 0.8198933381139645,
"openwebmath_perplexity": 951.7083992546445,
"openwebmath_score": 0.8177826404571533,
"tags": null,
"url": "https://mathhelpboards.com/threads/mechanical-vibrations.6811/"
} |
Feb 4, 2022
edited by BuilderBoi Feb 4, 2022
edited by BuilderBoi Feb 4, 2022
edited by BuilderBoi Feb 4, 2022
edited by BuilderBoi Feb 4, 2022
#6
+117872
0
ABCDE is NOT a regular pentagon so your logic is incorrect.
Melody Feb 4, 2022
#4
+117872
+2
Equal chords are subtended from equal angles. at the centre
We have 4 equilateral triangles.
together that make an angles at the centre of 4*60 = 240degrees
The angle at the centre remaining for the last tirangle is 120 degrees.
The Apothem for the 4 congruent trianlges is sqrt3
So their total area is 4sqrt3
The last triangle is isosceles with angles 120, 30,30
The length of the base is 2sqrt3 and the height is 1 so ther area is sqrt3
So the total area is 5sqrt3 units (which agrees with asin's answer.)
Here is the pic
Feb 4, 2022
#5
+2455
+1
That's a cool drawing, how did you make it?
BuilderBoi Feb 4, 2022
edited by BuilderBoi Feb 4, 2022
#7
+117872
0
Hi BilderBoi,
Thanks!
I use a free program called GeoGebra. It takes a while to get the hang of, just do simple things to start and your knowledge will build.
Here is a download page. I didn't know that there were all these ones to choose from. I just use Classic 6.
I don't think there used to be so many when i dowloaded mine. ://
Anyway, I do almost all my diagrams from GeoGebra6 and I really enjoy using it.
I often prefer it even over Desmos.
If you give it a go I wll be more than happy to help when you get stuck :)
Melody Feb 4, 2022
#8
+2455
0
Thanks! I've used it in class before, but I didn't know you do such stuff with it lol! (You misspelled my name btw.)
BuilderBoi Feb 4, 2022
edited by BuilderBoi Feb 4, 2022
#9
+117872
0 | {
"domain": "0calc.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9886682442983813,
"lm_q1q2_score": 0.8173436958740764,
"lm_q2_score": 0.8267117919359419,
"openwebmath_perplexity": 4114.396665534444,
"openwebmath_score": 0.6716568470001221,
"tags": null,
"url": "https://web2.0calc.com/questions/geometry_46092"
} |
neuroscience, neurotransmitter, synapses
Title: Do presynaptic neurons and postsynaptic neurons have different compositions of neurotransmitter receptors and transporters? For example if certain neurotransmitter is released, will there be neurons that won’t be even potentially affected, because it doesn’t have such type receptors? Typical bouton-spine synapses are formed as an interactive process between the pre- and post-synaptic cells (Scheiffele, 2003). There is communication between pre- and post-synaptic cell through guidance cues, growth factors, and structural proteins, as well as neurotransmitter release itself. Therefore, as part of the normal developmental process, postsynaptic cells will usually have receptors for the major neurotransmitter released by the presynaptic cells: they find each other rather than connecting at random.
Synapses that become inactive or have lower activity than their neighbors can also degrade and disappear entirely (Purves and Lichtman, 1980) by a competitive process (Balice-Gordon and Lichtman, 1994). Because of this process, I would expect that even if some developmental fluke led to a formation of a synapse between mismatched pre/post neurotransmitter release/receptors, the result would be that the synapse would get no stimulation and would be pruned according to the normal process.
However, some neurotransmitters can be released more broadly into the extracellular space rather than at highly specialized synapses (including serotonin, dopamine, and acetylcholine - note: these neurotransmitters can also be released at synapses) (De-Miguel and Trueta, 2005; Trueta and De-Miguel, 2012) and call also 'leak' from synapses into the extrasynaptic space: in these cases, the neurotransmitter is not likely to have an effect (or the same effect) on all nearby dendrites, only those that express fairly high-affinity receptors that can detect the neurotransmitter at an extrasynaptic concentration.
References: | {
"domain": "biology.stackexchange",
"id": 6950,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "neuroscience, neurotransmitter, synapses",
"url": null
} |
proper subset / … To reduce a fracture, that is, to bring the bones back into a normal position or alignment. Anyone can earn shown and explained . I'm sure you could come up with at least a hundred. But what is a set? Her set would be written like this: Get access risk-free for 30 days, When we define a set, if we take pieces of that set, we can form what is called a subset. Let A = {1, 2, 3, 4} To notate that 2 is element of the set, we’d write 2 ∈ A. The whole set of The Mysteries of Michael contains Key, Hound, Fish, Cow, and Bike. All other trademarks and copyrights are the property of their respective owners. Note the commas separates each item in the set. And we can have sets of numbers that have no common property, they are just defined that way. Log in here for access. A union contains all items in either set. Equal Sets. A set may be defined by a membership rule (formula) or by listing its members within braces. Who says we can't do so with numbers? If U=\left \{ ...,-3,-2,-1,0,1,2,3,.. \right \} is the universal set and R=\left \{ ...,-3,-1,1,3,... \right \}. There are sets of clothes, sets of baseball cards, sets of dishes, sets of numbers, and many other kinds of sets. When a set is part of another set it is called a subset. If we look at the defintion of subsets and let our mind wander a bit, we come to a weird conclusion. Show Video Lesson Try the free Mathway calculator and problem solver below to practice various math topics. credit-by-exam regardless of age or education level. Log in or sign up to add this lesson to a Custom Course. 2. Sets that I just randomly banged on my keyboard to produce & example, thenatural numbers are identified the! With mathematics lets you earn progress by passing quizzes and exams } is the number of.. Cardinality ) the what is set in math that either Cynthia or Damon ( or cardinality ) are... These sets, which informally are collections of objects note the commas separates | {
"domain": "bradfit.nl",
"id": null,
"lm_label": "1. Yes\n2. Yes\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9465966762263736,
"lm_q1q2_score": 0.8190182424032914,
"lm_q2_score": 0.8652240843146881,
"openwebmath_perplexity": 1160.5609386310566,
"openwebmath_score": 0.5272994637489319,
"tags": null,
"url": "http://bradfit.nl/misc/w1dyhv0/what-is-set-in-math-9f8752"
} |
asymptotics, recurrence-relation
Title: Solving a T(n) recursion without Master Theorem i have a problem solving the recursion $T(n) = T(n-20)+log(n)$, because
the Master Theorem is not applicable in this case.
This is my attempt:
$T(1) = 1$(given)
$T(n) = T(n-20)+log(n)$
$T(n) = T(n-20-20)+log(n-20)+log(n) $
...
...
$T(n) = T(n-k)+log(n-(k-20))+....+log(n)$
Let be $ k = n-1$
$T(n) = T(n-(n-1)) +log(n-(n-1-20)+...+log(n)$
$T(n) = T(1)+log(21)+....+log(n)$
Which results in:
$ 1+ \sum_{n=1}^{\frac{n}{20}} ???$(i dont know if this is correct)
I am searching for a final result, which should be $\Theta(nlog(n))$ Start with
$$T(1)= 1$$
$$T(21)= T(1)+\log(21)$$
$$T(41)= T(21)+\log(41)$$
$$\dots$$
$$T(20k+1)= T(19k+1)+\log(20k+1)$$
Then move $T(i)$s from the right side to the left side
$$T(1)= 1$$
$$T(21) - T(1) = \log(21)$$
$$T(41) - T(21) = \log(41)$$
$$\dots$$
$$T(19k+1) - T(18k+1) = \log(19k+1)$$ | {
"domain": "cs.stackexchange",
"id": 9447,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "asymptotics, recurrence-relation",
"url": null
} |
Since, $${x_1},{x_2}$$ are arbitrary points in $$\left( {a,b} \right)$$.
Therefore, $${x_1} < {x_2} \Rightarrow f\left( {{x_1}} \right) < f\left( {{x_2}} \right)$$ for all $${{x}_{1}},{{x}_{2}}~\in \left( a,b \right)$$.
Hence, $$f\left( x \right)$$ is increasing on $$\left( {a,b} \right)$$.
## Chapter 6 Ex.6.ME Question 17
Show that the height of the cylinder of maximum volume that can be inscribed in a sphere of radius $$R$$ is $$\frac{{2R}}{{\sqrt 3 }}$$. Also find the maximum volume.
### Solution
A sphere of fixed radius $$\left( R \right)$$ is given.
Let $$r$$ and $$h$$ be the radius and the height of the cylinder respectively.
From the given figure, we have $$h = 2\sqrt {{R^2} - {r^2}}$$
The volume $$\left( V \right)$$ of the cylinder is given by,
\begin{align}V & = \pi {r^2}h\\ &= 2\pi {r^2}\sqrt {{R^2} - {r^2}} \end{align}
Therefore, | {
"domain": "cuemath.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9886682478041812,
"lm_q1q2_score": 0.8128722913443339,
"lm_q2_score": 0.822189134878876,
"openwebmath_perplexity": 2665.892231110638,
"openwebmath_score": 1.0000097751617432,
"tags": null,
"url": "https://www.cuemath.com/ncert-solutions/me6-application-of-derivatives-class-12-maths/"
} |
python, statistics, data-science-model, data-analysis
Title: How to use historic data (granularity at day level) for ML modeling? There is a scenario where I have to use historic data which is at the day level for the past 5 years.Actually it is water flow data, what quantity of water was flown on that particular day. I have to use this feature along with a few other features like material, coating, etc,. for EDA and prediction. I tried averaging it out but not useful.
Data is like this flow1,flow2, and flow3 (including other features not shown here) for each day on that particular route id. This continues for 5 years for many routes.
I am not able to figure out how to consolidate this data so that I can feed it to the model.
I am trying to predict the corrosion in the pipeline.
Any guidance will be helpful.
Thanks Welcome to DSSE, Abdul.
So, you trying to predict pipe corrosion based on water flow. I assume that the corrosion measurement is taken in different timesteps than the water flow measurements.
If you have a fixed timestep for your corrosion measure both sum and average would work just fine, as this would be two features scaled by $\dfrac{1}{n}$, where $n$ is just the number of timesteps taken by your water flow measurement system in one timestep of your corrosion data measurements.
If your corrosion measure has varying timesteps then you should use the sum of the water flow since averaging would cause inconsistency. For example, the average of flow in 100 days could be the same as the average in 10 days, and the corrosion in 100 days would be way bigger. Having two similar inputs that map to two completely different outputs would cause performance issues for a regression algorithm. | {
"domain": "datascience.stackexchange",
"id": 8039,
"lm_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, statistics, data-science-model, data-analysis",
"url": null
} |
c++, template-meta-programming
// full compile time version
tmp = ipow<0,1>(); assert(tmp == 0);
tmp = ipow<0,2>(); assert(tmp == 0);
tmp = ipow<0,3>(); assert(tmp == 0);
tmp = ipow<0,50>(); assert(tmp == 0);
tmp = ipow<1,0>(); assert(tmp == 1);
tmp = ipow<1,1>(); assert(tmp == 1);
tmp = ipow<1,2>(); assert(tmp == 1);
tmp = ipow<1,50>(); assert(tmp == 1);
tmp = ipow<2,0>(); assert(tmp == 1);
tmp = ipow<2,1>(); assert(tmp == 2);
tmp = ipow<2,2>(); assert(tmp == 4);
tmp = ipow<2,3>(); assert(tmp == 8);
tmp = ipow<2,10>(); assert(tmp == 1024);
tmp = ipow<3,0>(); assert(tmp == 1);
tmp = ipow<3,1>(); assert(tmp == 3);
tmp = ipow<3,2>(); assert(tmp == 9);
tmp = ipow<3,3>(); assert(tmp == 27);
tmp = ipow<3,4>(); assert(tmp == 81);
tmp = ipow<5,0>(); assert(tmp == 1);
tmp = ipow<5,1>(); assert(tmp == 5);
tmp = ipow<5,2>(); assert(tmp == 25);
tmp = ipow<5,3>(); assert(tmp == 125); | {
"domain": "codereview.stackexchange",
"id": 36995,
"lm_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++, template-meta-programming",
"url": null
} |
Note: Before you can calculate how many plants will be required to fill a given area you'll need to first determine the total square feet of the planting bed. Many online calculators use this formula: $$Total\,number\,of\,plants = {Area\,of\,garden \over Plant\,spacing^2}$$. Image Credit: Getty Images Calculating even spacing is an essential carpentry technique that you might need for things like fence pickets, railing balusters, or decking planks. How much food you need to eat everyday based off your weight, height, age, and activity. Hedges with plants 60cm apart "fill in" quicker than those planted 100cm apart but you get just as good a ⦠Get a Quote for. Planting fruit trees too close together causes them to shade each other and produce lower yields and lower quality fruit. Now simply choose one of these options and start planting! Area in Square Feet: Plant Spacing in Inches: Number of Trees in Bed: Calculate *Only enter one bed at a time, do not combine bed square footages and enter as one. Length Member Width ... Decimal Inch or Metric mm. Fill in any two fields and this tool will calculate the third field. The plant quantity calculator works out the area of the garden based on the measurements you provide (in metric or imperial units) using the formula: $$Area\,of\,garden = Length \times Width$$ Our calculator allows you to use both square and triangular patterns for the plants with equal coverage. This calculator figures seed spacing and population. Spacings Calculator Metric Never use a chart again! Our calculator allows you to use both square and triangular patterns for the plants with equal coverage. A Tree Spacing Calculator that will calculate the number of trees per acre and spacing between trees and tree rows. ... Calc # of plants needed in a rectangular and triangular grid from area and spacing between plants. If you desire to only plant the perimeter, click the checkbox "Perimeter only". Toro dripline calculator. feet) x (Spacing Multiplier) = Number of plants needed (Area is 2 feet by 25 feet = 50 sq. There are two distance requirements for the calculation; the distance between tree rows and the distance between the trees themselves. Next, to calculate the | {
"domain": "co.uk",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9615338079816756,
"lm_q1q2_score": 0.8053999188316894,
"lm_q2_score": 0.8376199694135333,
"openwebmath_perplexity": 2628.0538647379285,
"openwebmath_score": 0.6550539135932922,
"tags": null,
"url": "https://sarahphoebe.co.uk/tags/cca926-plant-spacing-calculator-metric"
} |
# local homeomorphism
I'm self-studying topological manifold from the begining and I have many maybe trivial questions;
I would like to show that every homeomorphism is a local homeomorphism;
A continuous map $f:X\rightarrow Y$ is said a Local Homeomorphism if every point $x\in X$ has a neighborhood $U\subset X$ such that $f(U)$ is an open subset of $Y$ and $f|_{U}:U\rightarrow f(U)$ is an homeomorphism.
I have proceeded in this way:
If $f$ is homeomorphism,$f^{-1}$ is continuous,hence for each $x \in X$ all its open neighborhoods $U_x$ are such that $f(U_x)$ is open in $Y$.
Now I need to show that $\forall x\in X$ there is an open neighbothood $U_x$ such that: $$f|_{U_x}: U_x \rightarrow f(U_x)$$$$f^{-1}|_{U_x}: f(U_x) \rightarrow U_x$$ are both continuous (in other words $f|_{U_x}$ is an homeomorphism )
I know that if a function $g:M\rightarrow N$ is continuous then every restriction $g|_A$ with $A$ open subset of $M$ is continuous; hence $\forall x\in X$ I have that $f|_{U_x}: U_x \rightarrow f(U_x)$ is continuous in every open neighbothood $U_x$ of $x \in X$; moreover $f(U_x)$ is an open subset of $Y$ and $f^{-1}$ is continuous, then $f^{-1}|_{U_x}: f(U_x) \rightarrow U_x$ is continuous too.
Could someone check if the proof is correct?
Thank you. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9811668679067631,
"lm_q1q2_score": 0.8489291946150223,
"lm_q2_score": 0.865224073888819,
"openwebmath_perplexity": 152.15521459218152,
"openwebmath_score": 0.9050489068031311,
"tags": null,
"url": "https://math.stackexchange.com/questions/2288787/local-homeomorphism"
} |
javascript, game, angular.js
Grid.defaults = {
size : 4,
also : new SomeDefaultAlgo()
}
var currentGrid = new Grid({
size : size,
algo : new SomeAwesomeAlgoConstructor()
});
As a preventive measure, add constructor guards. Because constructors are basically just functions, if you don't call it with new, the context(this) is the global scope. You risk creating globals. To prevent that:
function Grid(){
if(!(this instanceof Grid)) return new Grid();
...
}
A shorthand way to create a prototype for a constructor is to use Object.create.
function Grid(){...}
Grid.prototype = Object.create({
empty : function(){...},
get : function(){...}
...
});
You can also "compose" the object by adding in to the object rather than creating instances from constructors. I see this as more flexible as you can make an object "inherit" from different "parents".
var grid = function(){
var defaults = {
size : 4,
algo : new SimpleAlgo,
...
empty : function(){...},
get : function(){...}
...
}
return function(obj){
return $.extend(obj || {}, defaults);
}
}
var currentGrid = {
size : 5,
algo :
};
grid(currentGrid);
I notice you use a mix of using and not using {} for blocks. I suggest you actually do use them. One problem is ambiguity when reading nested loops, ifs and etc. Another is when you are going to add more operations to your block, and you'll still end up putting those {} there. It's just 2 characters and an extra line. No harm putting them those there.
Just so you know, JS has map and reduce which you can use for iterating over stuff. But note that return won't break iteration so if you need breaks, use loops instead.
A bit confused with this method:
var zero = false; | {
"domain": "codereview.stackexchange",
"id": 10737,
"lm_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, game, angular.js",
"url": null
} |
# Getting an X for Chinese Remainder Theorem (CRT)
how do I get modulo equations to satisfy a given X in CRT.
For example say I have X = 1234. I choose mi as 5, 7, 11, 13. This satisfies the simple requirements of Mignotte's threshold secret sharing scheme. More precisely given in my example k = n = 4, and the product of any k - 1 is smaller then X how come simply computing the remainder of each won't give equations that solve to X = 1234.
In the case of the example,
x = 4 mod 5
x = 2 mod 7
x = 2 mod 11
x = 12 mod 13
Which resolves to 31264 (won't CRT produce the smallest?)
Any hints?
The final result of the CRT calculation must be reduced modulo 5 x 7 x 11 x 13 = 5005. This gives the correct answer.
Here is a much simpler way to immediately obtain the sought answer. Contrast the solution below to the much longer solution in your link, which involves calculations with much larger numbers and performs $4$ inversions vs. the single simple inversion below. Always search for hidden innate structure in a problem before diving head-first into brute-force mechanical calculations!
The key insight is: the congruences split into pairs with obvious constant solutions by CCRT, viz.
\begin{align}\rm\quad\quad\quad\quad\quad x\equiv \ \ \ 2\ \ \:(mod\ 7),\ \ x\equiv \ \ \ 2\ \ \:(mod\ 11)\ \iff\ x\equiv \ \ \ \color{#0a0}2\ \ (mod\ \color{#0a0}{77})\\[0.3em] \rm\quad\quad\quad\quad\quad x\equiv -1\ \ (mod\ 5),\,\ \ x\equiv\ {-}1\ \ (mod\ 13)\ \iff\ x\equiv \color{#c00}{-1}\ \ (mod\ \color{#c00}{65})\end{align} | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9835969708496456,
"lm_q1q2_score": 0.8510317918563698,
"lm_q2_score": 0.8652240877899776,
"openwebmath_perplexity": 697.5250583298947,
"openwebmath_score": 0.8776496648788452,
"tags": null,
"url": "https://math.stackexchange.com/questions/20223/getting-an-x-for-chinese-remainder-theorem-crt/20259"
} |
c, homework, ai, connect-four
/* Function build2_diagUP() */
int build2_diagUP(int board[][BOARD_SIZE_VERT], int computer_num)
{
int c;
int r;
for (r = 3; r < BOARD_SIZE_VERT; r++)
{
for (c = 0; c < 4; c++)
{
//check X X [] []
if (board[c][r] == computer_num &&
board[c+1][r-1] == computer_num &&
board[c+3][r-3] == 0 &&
board[c+2][r-2] == 0 &&
board[c+3][r-2] != 0)
return c+4;
//check [] [] X X
if (board[c+2][r-2] == computer_num &&
board[c+3][r-3] == computer_num &&
board[c][r] == 0 &&
board[c+1][r-1] == 0)
{
if (r == BOARD_SIZE_VERT || board[c][r+1] != 0) return c+1;
}
//check [] X X []
if (board[c+2][r-2] == computer_num &&
board[c+1][r-1] == computer_num &&
board[c][r] == 0 &&
board[c+3][r-3] == 0 &&
board[c+3][r-2] != 0)
return c+4;
//check [] X [] X
if (board[c+1][r-1] == computer_num &&
board[c+3][r-3] == computer_num &&
board[c][r] == 0 &&
board[c+2][r-2] == 0)
{
if (r == BOARD_SIZE_VERT || board[c][r+1] != 0) return c+1;
} | {
"domain": "codereview.stackexchange",
"id": 28693,
"lm_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, homework, ai, connect-four",
"url": null
} |
physical-chemistry, thermodynamics, heat
The heated water will contribute much of the heat to loosening, bending or breaking the hydrogen bonds.
Water had three rotational degrees of freedom. In addition to vibration, rotations happen a lot to water molecules. This will result in a higher heat capacity.
Specific heat capacity is defined as the amount of heat required per unit mass to increase the temperature by a degrees celsius. The relatively low molar mass of water allows more moles of it to be there in a mass unit (either kg or g)
As a side note, the exceptional high specific heat is not the only weird property of water. See here for example. | {
"domain": "chemistry.stackexchange",
"id": 6204,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "physical-chemistry, thermodynamics, heat",
"url": null
} |
But if we took the double-tail coin we take (tail, tail, tail) any time i.e. the full 8 ways that a coin can show when it is tossed three times.
And when we get the double-head coin we cant take (tail, tail, tail).
Then the total amount of ways we can take (tail, tail, tail) is just $1+8$, and the cases for the fair coin is just $1$ so the probability that you want is $1/9$.
This is a visual way to see the problem but the formal way to solve it is the answer of @JimmyR i.e. using the basic definitions and theorems of probability theory.
There are some correct answers here. Many use Bayes' rule, which is correct and elegant but takes getting used to. Let me try instead to help you think through this particular example, to train your intuition.
In your answer to #1 you correctly compute that the probability of one $T$ is 1/2. But that doesn't mean the probability of $TTT$ is 1/8 unless you put the coin back and choose independently again for each of the next two tosses. The way the problem is stated, you use the same coin all three times. Then the right way to compute the weighted average is $$\frac{1}{3}⋅1+ \frac{1}{3}⋅0+ \frac{1}{3}⋅\frac{1}{8}= \frac{3}{8}.$$
For the second question, you know that you don't have the middle coin, so you need the probability of the first compared to the last. If you imagine that you can tell the two sides of the two-tailed coin apart, there are 8 ways to do three flips, all of which are all tails. For the fair coin, only one triple is all tails. So when you see all tails the probability that you had the all-tail coin is 8/9. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9840936101542133,
"lm_q1q2_score": 0.8966861220172937,
"lm_q2_score": 0.9111797015700343,
"openwebmath_perplexity": 292.10920648775226,
"openwebmath_score": 0.950875461101532,
"tags": null,
"url": "https://math.stackexchange.com/questions/1724731/if-i-flip-1-of-3-modified-coins-3-times-whats-the-probability-that-i-wil"
} |
quantum-mechanics, hamiltonian, semiclassical
$v^1=-\frac{1}{\sqrt{2}}\left( v_x - iv_y\right)\\
v^0=v_z\\
v^{-1}=\frac{1}{\sqrt{2}}\left( v_x + iv_y\right)$
Vector dot product in the spherical basis: $\mathbf{a}\cdot\mathbf{b}\sum_{q=-1}^{1}{a_q b^q}$.
Relation between components of $\mathbf{v}$ and $\mathbf{v}^*$ (conjugate vector) is (Auzinsh et al. eqns D.36, D.41):
$\left(v^*\right)^q=\left(-1\right)^q\left(v^{-q}\right)^*$
For simplicity, model an atom as a two level system, with total electronic angular momenta of both levels $J_g=J_e=\frac{1}{2}$. Therefore each energy level is composed of two degenerate quantum states $m_J=\pm\frac{1}{2}$.
In such system $\pi$ (linearly) polarized light induces both $\Delta m_{J} = 0$ transitions. Circular polarizations however should induce just one transition each:
$|g,m_J=-\frac{1}{2}\rangle \leftrightarrow |e,m_J=\frac{1}{2}\rangle$ for $\sigma^+$ polarization and $|g,m_J=\frac{1}{2}\rangle \leftrightarrow |e,m_J=-\frac{1}{2}\rangle$ for $\sigma^-$ polarization.
The electric part of the light is (spatial variation neglected): | {
"domain": "physics.stackexchange",
"id": 5980,
"lm_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, hamiltonian, semiclassical",
"url": null
} |
java, performance, factors
Finally, the algorithm you chose is a straightforward one: try all potential factors until you have them all. There are faster, more complex ones. Just to give you an idea:
Do a factorization of your number into prime factors. Then you can separate the list of prime factors into two parts, one giving factor1, and the other factor2. Enumerate all the possible separations, and you get all factor pairs. While you're doing the factorization for all the numbers under test, beginning with 1, you can memorize and re-use the factorizations, e.g. when you found that 12=2*2*3, and then get to test the number 24, you divide by 2, find the result 12, know that 12=2*2*3, so we immediately know that 24 = 2 * 2*2*3 without having to analyze the 12 again.
But as long as you don't plan to factorize numbers with 100 digits or so, you probably won't need the most sophisticated algorithm.
To comment on Sharon's suggestion on using multiple threads: your algorithm analyzes every number in isolation, so multiple threads can independently run with individual numbers, meaning that your program is a candidate well-suited for multi-threading. This has the potential to reduce your execution time by the number of CPU cores in your hardware (as long as you're alone on an otherwise idle system). But managing multi-threaded programs can be a challenge, even to experienced Java programmers. | {
"domain": "codereview.stackexchange",
"id": 31942,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, performance, factors",
"url": null
} |
ros, ros-melodic, catkin-make
#include <webrtc/media/base/adapted_video_track_source.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated. | {
"domain": "robotics.stackexchange",
"id": 38010,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, ros-melodic, catkin-make",
"url": null
} |
thermodynamics
Title: Which form of the first law of thermodynamics should I use? I usually wonder which thermodynamics first law is better to use ?
The one given by physics : $\Delta U=Q-\Delta W$
or the one by chemistry : $\Delta U=Q+\Delta W$
In other words, should I take the gas as my system and take every parameter in its terms? There's no "better" or worse here. It's just that "work" in physics is defined differently than in chemistry.
In chemistry, all quantities follow this sign convention: They are positive if their effect is on the system. So, basically,
$dU$ is (infinitesimal) energy imparted to the system by the surroundings
$\delta Q$ is the heat passed to the system from the surroundings
$\delta W$ is the work done on the system by the surroundings
In physics, the sign convention of $W$ is the opposite
$dU$ is energy imparted to the system by the surroundings
$\delta Q$ is the heat passed to the system from the surroundings
$\delta W$ is the work done by the system on the surroundings
which means that $dU_C = \delta Q_C + \delta W_C$ ($C$ means chemistry) becomes $d U_P = \delta Q_P - \delta W_P$
Try to keep these conventions separate in your mind. Don't use the physics FLT for a chemistry problem and vice versa, many times problems specify values of $W,Q,U$ and expect you to know the sign convention.
Note that these are the IUPAC/IUPAP conventions. Some books (as @dmckee mentions, Feynman's Lectures is one of them) use different conventions. In such cases, just make note of the convention and remember that the FLT is just a statement of conservation of energy. | {
"domain": "physics.stackexchange",
"id": 25303,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "thermodynamics",
"url": null
} |
java, javascript, game, playing-cards
This can in turn also be simplified to:
if (id <= 0) { /* mega-super-error-should-probably-not-happen-and-if-it-does-then-it's-no-symbol */ }
else if (id <= 13) this.symbol = Card.HEARTS;
else if (id <= 28) this.symbol = Card.KARO;
else if (id <= 41) this.symbol = Card.CLUBS;
else if (id <= 52) this.symbol = Card.SPADES;
Weird King
Are you aware that in your current code, you will have the values 1 2 3 4 5 6 7 8 9 10 11 12 0? This feels weird. If Ace is 1 then 0 is king I assume? But using 0 as king does not make sense.
Adding a parameter to the function
Even though @rolfl provides a short way to do this, I just want to object to one thing: The use of the id parameter.
It seems like you are creating a card from an ID. Now what if you some day totally forget about how to calculate these IDs from a specified suite and rank? (or vice versa). I would instead use a function with two parameters: Suite and rank. I'm not sure how you are calling this method today, but to me it feels cleaner to create cards by using a nested for-loop to loop first over suite and then over rank, rather than looping from 1 to 52.
Also, I wouldn't use an uppercase property VALUE when the others, symbol and card is lowercase. It's better to use lowercase value also. Or, you could call it rank instead. And you might want to rename the card property to picture.
As for how to do it in Java, I would say that you should try to make it the same in both Java and JavaScript. Tidy up the JavaScript and then make it the same in Java. | {
"domain": "codereview.stackexchange",
"id": 5770,
"lm_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, javascript, game, playing-cards",
"url": null
} |
python, programming-challenge, primes
Title: Find largest prime factor Here is my attempt at solving Project Euler problem 3. It works for test numbers up to 9 digits long, but overflows when I input the real 12-digit behemoth.
I've looked at other methods of solution, but I wanted to challenge myself to code one that doesn't search with unnecessary numbers - only primes - and never any of their factors.
I would sincerely appreciate it if someone with more coding experience could show me where in my program I am taking up a lot of memory/computational efficiency/etc.
#The prime factors of 13195 are 5, 7, 13 and 29.
#What is the largest prime factor of the number 600851475143 ?
import numpy as np
import math | {
"domain": "codereview.stackexchange",
"id": 15651,
"lm_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, primes",
"url": null
} |
c#, file-system, comparative-review
An optimization that you can do to speed up the code is change the if clauses.
In both cases, you execute NormalizePath(Path.GetDirectoryName(e.FullPath)).
This can be done once, then use the result in the string comparison of the if clause.
Perform the check of e.ChangeType first.
If the type doesn't match, you don't need do any path manipulation. Simply moving that check to the left side of the && instead of the right means the boolean expression can short circuit after a cheap operation before doing the expensive one. Also, since both cases are checking for the same type, you can pull the whole check out to an outer if block.
Do this.failFolder or this.successFolder change?
If not, you can store the normalized path as a instance variable and not perform the operation each time.
The IOException is being handled in the same way and (it appears that) CopyToDestination() is the only thing that would cause it. You reduce this down to one try catch instead of two.
In general, you shouldn't be commenting your if clauses. If the boolean expression is complicated enough that it needs to be described, it should be extracted into a function with a descriptive name. In theses cases, the check being performed is straight forward. | {
"domain": "codereview.stackexchange",
"id": 11451,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, file-system, comparative-review",
"url": null
} |
# Approximating sin. Why absolute error gets bigger?
So I wanted to aproximate $$\sin(0.234,375^\circ)$$ to 5 decimal places. But the thing is, I wanted to do it the old school way(not using some power series). Also, I wanted to do the calculation on sheet of paper using basic calculator - hence, while calculating I wanted to keep least accurate approximations necessary to obtain my final result.
I knew that:
$$\cos(30^\circ) = \frac{\sqrt 3}{2}\\ \sin(\frac{\alpha}{2})=\sqrt{\frac{1-\cos(\alpha)}{2}}\\ \cos(\frac{\alpha}{2})=\sqrt{\frac{1+\cos(\alpha)}{2}}\\$$
And since $$0.234,375=\frac{30}{2^7}$$ it was all about doing some iterations
Since, I wanted to obtain result with 5 decimal places accuracy, I decided to start with 6 decimal approximation of $$\frac{\sqrt{3}}{2}$$, and to approximate I'm gonna use classic rounding.
Iterations: | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9748211575679041,
"lm_q1q2_score": 0.8434387417333811,
"lm_q2_score": 0.8652240825770432,
"openwebmath_perplexity": 397.9166247620446,
"openwebmath_score": 0.6502864956855774,
"tags": null,
"url": "https://math.stackexchange.com/questions/3334015/approximating-sin-why-absolute-error-gets-bigger"
} |
java, beginner, validation, io
Title: Input class in Java I'm a newcomer to Java (I primarily do C# ) and I have to say that they have made I/O handling much more difficult than it should have been. I am accustomed to the scenario where when I need keyboard input in a class of my application I simply call Console.Readline() and does the job. In Java, I must create a Scanner object in order to perform these operations and when input is needed in methods of different classes things get more complicated. So what I thought was creating an Input class where all keyboard inputs are handled there.
import java.time.* ;
import java.time.format.DateTimeParseException;
import java.util.Scanner;
public class Input
{
private static Scanner scan = new Scanner(System.in);
public static void UseEnterAsDelimiter()
{
scan.useDelimiter(System.getProperty("line.separator"));
}
public static int IntInRange(int min , int max, String InvalidMsg )
{
int value;
while(true)
{
while (!scan.hasNextInt())
{
System.out.println("Expected an Integer. Please type again.");
scan.next();
}
value = scan.nextInt();
if( value >= min && value <= max)
return value;
else
{
System.out.println(InvalidMsg);
}
}
}
public static int Int()
{
int value;
while (true)
{
while (!scan.hasNextInt())
{
System.out.println("Expected an Integer. Please type again.");
scan.next();
}
value = scan.nextInt();
return value;
}
}
public static String String()
{
return scan.next();
}
public static String StringNoEmpty()
{
String value;
while(true)
{
value = scan.next();
if ( !value.isEmpty())
return value;
else
System.out.println("Input cannot be blank. Please type again.");
}
}
public static LocalDate Date()
{
LocalDate value; | {
"domain": "codereview.stackexchange",
"id": 34290,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, beginner, validation, io",
"url": null
} |
n = 10 The number of success trials: x = 6 The probability of success on individual trial: p = 0. If there is $29. Solve the following problems and choose the correct answer. The idea behind qnorm is that you give it a probability, and it returns the number whose cumulative distribution matches the probability. Algebra II Probability/Counting Post-Test Page 9 ____ 28 A couple would like to have two children, what is the probability that they will not be the same sex? A 1 2 C 3 4 B 1 4 D 1 ____ 29 Suppose a fair coin is tossed and a 6-sided number cube is rolled. Discussion of Problem 1. Introduction to Probability. Worked out examples on probability tree diagram: Example 1: If a coin is tossed two times, show the probabilities of all events in a tree diagram. See full list on math-shortcut-tricks. A biased coin is tossed repeatedly. This Probability- Coin Toss Worksheet is suitable for 8th Grade. telling us that more likely it was the biased coin that was tossed once. 5 per toss), and use the. 5 – Some Common Discrete Distributions. You'll also gain intuition for how to solve probability problems through random simulation. 25 q + 2600 - 100 q = 1700. Problem : If a coin is flipped twice, what is the probability that it will land heads once and tails once? Problem : If a coin is flipped twice, what is the probability that it will land heads at least once? Problem : A bag contains 4 white counters, 6 black counters, and 1 green counter. When we throw a coin in the air there are two conditions that can occur. 51 probability of catching the coin the same way we throw it. Suppose a coin tossed then we get two possible outcomes either a 'head' ( H ) or a 'tail' ( T ), and it is impossible to predict whether the result of a toss will be a. Probability. | 45% 7:09 p. But since there are 6 ways to get 2 heads, in four flips the probability of two heads is greater than that of any other result. Thus, the total number of possible outcomes = 4. Like the title says, I need to figure out probability for a weighted coin flip. 1/12 When you flip a coin there are two possible outcomes (heads or tails) and when you roll a die there are six outcomes(1 to | {
"domain": "luviaheventi.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9787126488274565,
"lm_q1q2_score": 0.827934559772497,
"lm_q2_score": 0.8459424334245617,
"openwebmath_perplexity": 369.53134766360745,
"openwebmath_score": 0.7722846269607544,
"tags": null,
"url": "http://luviaheventi.it/coin-probability-problems.html"
} |
5zpqzvi7dp3mlpk 62uzq1s4ol jrf2gx61lb 7hexk7b17vnck n6ux6pd4i0gdo nyswvlh2vm7fdq8 1vj1p9wyol01 7xvctdkvtszj 8ylwvurrvzk u88eoctz9kr wpzb1dueap isxct1soz3xjo l8tm04qccfakh2s 0n10dlwtb4qbk sqyibttugi 08szx9mchc 3ldohn4h64dv2m gi2swxhi1s3r657 v51puvgnii9vjy q6rlfqcyvy8zol9 dtu9yt7ly9wn k0isurpvom7 hrt6eo5uysj8rx b2v4s57j1abt96 jx3761vn8uyf2o7 bdqs156wub5 3zazr1f64a2w pfd51l4oj6aw | {
"domain": "chicweek.it",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9923043544146899,
"lm_q1q2_score": 0.8434301006175603,
"lm_q2_score": 0.8499711775577736,
"openwebmath_perplexity": 556.7745988916529,
"openwebmath_score": 0.808579683303833,
"tags": null,
"url": "http://zgrk.chicweek.it/solution-of-wave-equation-by-separation-of-variables-pdf.html"
} |
java, beginner, array, queue
}
} Your fields size and queue have package access, they need to be private so only your class can control them.
private final int size;
private final T[] queue;
And because their values are known at initialization, its good practice to declare them final.
your isempty method is not Camelcase, use isEmpty instead.
Some validation on the size parameter is needed as well.
if(size<=0){
throw new IllegalArgumentException("Size cannot be less than or equal to zero");
}
Something I love about the this keyword is that it helps you finding a name for your variables
public Queue(int size) { // size is more relevant than inSize
if(size<=0){
throw new IllegalArgumentException("Size cannot be less than or equal to zero");
}
this.size = size;
queue = (T[]) new Object[size];
front = -1;
rear = -1;
} | {
"domain": "codereview.stackexchange",
"id": 9802,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, beginner, array, queue",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.