text stringlengths 1 1.11k | source dict |
|---|---|
c++, game-of-life
void Population::addCellToPop(const StaticPoint& c) {
cells.insert(c);
}
void Population::removeCellFromPop(const StaticPoint& c) {
cells.erase(c);
}
void Population::killPopulation() {
cells.clear();
}
StaticPoint Population::getCellAt(const StaticPoint& p) const {
auto cellIt = cells.find(p);
//Find returns a iterator to the end if it's not found
if (cellIt == cells.end()) {
return badCell;
}
return *cellIt;
}
StaticPoint Population::getCellAt(double tX, double tY) const {
return getCellAt(StaticPoint(tX,tY));
}
bool Population::pointIsOccupied(const StaticPoint& c) const {
return cells.count(c) != 0;
}
int Population::countNeighborsWithin(const StaticPoint& p, int depth) const {
int count = 0;
for (const StaticPoint& n : getPointsAround(p, depth)) {
if (pointIsOccupied(n)) {
count += 1;
}
}
return count;
} | {
"domain": "codereview.stackexchange",
"id": 12899,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, game-of-life",
"url": null
} |
formal-languages, computability, reference-request, undecidability, context-sensitive
Therefore, determining whether a given context-sensitive grammar generates a finite or infinite language is undecidable.
Footnote: You can find a proof of the standard theorem above in many places; e.g., these lecture notes from CS 373 at U Illinois. The result is also mentioned in passing on Wikipedia, which cites Hopcroft and Ullman -- a standard resource on formal languages. The same Wikipedia article also mentions some smaller classes of languages that are contained in CSL. | {
"domain": "cs.stackexchange",
"id": 6449,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "formal-languages, computability, reference-request, undecidability, context-sensitive",
"url": null
} |
energy, black-holes, spacetime, event-horizon
Title: Is it possible to extract energy from black hole and decrease event horizon size faster? So imagine a black hole that is like 3 times the mass of the sun so that there can be a bigger gravitational gradient. Assume the black hole has no accretion disk, charge, or rotation for simplicity's sake. So my idea is to imagine building a spherical shell of graphene around 4 Schwarzschild radii away from the black hole fully surrounding the black hole. (This is probably unrealistic practically speaking but I want to know whether this mechanism can theoretically be used to extract energy from the black hole). So that after that is built, we can attach multiple graphene rods that attach from the graphene shell which contains multiple protons and neutrons. | {
"domain": "physics.stackexchange",
"id": 89417,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "energy, black-holes, spacetime, event-horizon",
"url": null
} |
It's actually a lot simpler than this. Rewrite the integral as
$$\int_0^{\delta} du \frac{\cosh{u}}{\sqrt{\cosh^2{\delta}-\cosh^2{u}}} = \int_0^{\delta} du \frac{\cosh{u}}{\sqrt{\sinh^2{\delta}-\sinh^2{u}}}$$
Sub $y=\sinh{u}$ and the integral becomes
$$\int_0^{\sinh{\delta}} \frac{dy}{\sqrt{\sinh^2{\delta}-y^2}}$$
Now sub $y=\sinh{\delta}\, \sin{t}$ and the integral is
$$\int_0^{\pi/2} dt = \frac{\pi}{2}$$
• Or that, of course ;) – Daniel Fischer Dec 21 '13 at 22:50
• @DanielFischer: yeah, a bunch of ways works. I think the presence of the cosh's makes people think the integral is harder than it really is. – Ron Gordon Dec 21 '13 at 22:51
• Yes, probably, and the square root. Still, one needs a trained eye to spot your elegant way. – Daniel Fischer Dec 21 '13 at 22:52
• Very well done. – Raul C. de Assis Dec 22 '13 at 1:25 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9759464457063559,
"lm_q1q2_score": 0.8195353791314446,
"lm_q2_score": 0.8397339656668287,
"openwebmath_perplexity": 503.35519342615135,
"openwebmath_score": 0.9397064447402954,
"tags": null,
"url": "https://math.stackexchange.com/questions/614928/how-to-show-that-this-integral-equals-frac-pi2"
} |
tricky to search for a formula or an equation. So any interesting idea which could help finding interesting references may be of interest. - Say$x^y = y^x$, and$x > y > 0$. Taking logs,$y \log x = x \log y$; rearranging,$(\log x)/x = (\log y)/y$. Let$f(x) = (\log x)/x$; then this is$f(x) = f(y)$. Now,$f^\prime(x) = (1-\log x)/x^2$, so$f$is increasing for$x<e$and decreasing for$x>e$. So if$x^y = y^x$has a solution, then$x > e > y$. So$y$must be$1$or$2$. But$y = 1$doesn't work.$y=2$gives$x=4$. (I've always thought of this as the standard'' solution to this problem and I'm a bit surprised nobody has posted it yet.) If$x > 0 > y$, then$0 < x^y < 1$and$y^x$is an integer, so there are no such solutions. If$0 > x > y$, then$x^y = y^x$implies$x$and$y$must have the same parity. Also, taking reciprocals,$x^{-y} = y^{-x}$. Then$(-x)^{-y} = (-y)^{-x}$since$x$and$y$have the same parity. (The number of factors of$-1$we introduced to each side differs by$x-y$, which is even.) So solving the problem | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9811668734137682,
"lm_q1q2_score": 0.8021769882286175,
"lm_q2_score": 0.817574471748733,
"openwebmath_perplexity": 3658.05696062591,
"openwebmath_score": 0.995548665523529,
"tags": null,
"url": "http://math.stackexchange.com/questions/9505/xy-yx-for-integers-x-and-y?answertab=active"
} |
sea-ice, ice-shelf, nasa
Title: What are the approximate dimension of this iceberg? Any chance the ratio is 1:4:9? From 17-Oct-2018 NASA ICE tweet:
I'm curious of the actual dimensions, and if possible a complete photo. And curious in a scifi sort of way if they have a ratio of 1:4:9
From yesterday's #IceBridge flight: A tabular iceberg can be seen on the right, floating among sea ice just off of the Larsen C ice shelf. The iceberg's sharp angles and flat surface indicate that it probably recently calved from the ice shelf.
from a following tweet (for clarification): There have been rectangular tabular icebergs in the past so this is not uncommon at all.
Kelly Brunt, an ice scientist with NASA and the University of Maryland said:
Tabular icebergs form, she said, through a process that's a bit like a fingernail growing too long and cracking off at the end. They're often rectangular and geometric as a result
What makes this one a bit unusual is that it looks almost like a square," | {
"domain": "earthscience.stackexchange",
"id": 1570,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "sea-ice, ice-shelf, nasa",
"url": null
} |
fourier-transform, continuous-signals
Title: Convert Fourier transform of a signal to $\omega$ form? Suppose we have this signal:
$$x(t)=5 \sin(2\pi 1000 t) \cos(2\pi 10000 t)$$
I calculated the Fourier transform as below:
$$X(f)=\left(j\frac{5}{4}\right)\left[\delta(f-9000)+\delta(f+11000)-\delta(f-11000)-\delta(f+9000)\right]$$
and then I would like to convert it to $\omega$ form. I know that the result is
$$X(\omega )=\left(j\frac{5}{2}\right)\left[\delta(\omega -9000)+\delta(\omega +11000)-\delta(\omega -11000)-\delta(\omega +9000)\right]$$
I know that
$\omega=2\pi f T$
where $T$ is sampling rate.
What I cannot understand is how we convert the Fourier transform of our signal to $\omega$ form using above formula. In your example there is no sampling involved, so you simply have $\omega=2\pi f$, where $f$ is the frequency in Hertz, and $\omega$ is the frequency in radians. | {
"domain": "dsp.stackexchange",
"id": 3563,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fourier-transform, continuous-signals",
"url": null
} |
energy, waves
$\mu$ is the mass of the string per unit length
$\omega$ the angular velocity of the wave
$A$ the amplitude of the wave
All other things being equal, longitudinal and transverse string waves transmit the same amount of power. | {
"domain": "physics.stackexchange",
"id": 69027,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "energy, waves",
"url": null
} |
complexity-theory, np-complete, satisfiability
Title: Find a truth assignment of 2SAT that has the most number of true variables? Given a 2SAT instance in CNF where each clause has at most two literals. Let $m$ be the number of clauses and $n$ be the number of variables et let $k$ be a positive number.
Question: Is there a truth assignment such that the number of variables that are true is $k$ or more?
I cannot find the name of this problem, if it was already studied? If so, is it NP-hard? Your problem is known as Weighted-2-satisfiability, and is known to be NP-complete. The easiest way to see that is by reduction from Vertex Cover (exercise).
Note that the link above is about whether there is a satisfying assignment having at most $k$ true variables. This is equivalent to your problem (exercise). | {
"domain": "cs.stackexchange",
"id": 14809,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "complexity-theory, np-complete, satisfiability",
"url": null
} |
newtonian-gravity, angular-momentum, rotational-dynamics, gyroscopes, precession
Incidentally, this error doesn't stand on its own
There is another video by Derek about gyroscopic precession with an error.
Video about gyroscopic precession 2:47 into the video
what happens if I only let go after I've already spun up the bicycle
wheel well in that case the bicycle wheel would already have angular
momentum this way and so a torque pushing that way actually swings
this angular momentum round that way | {
"domain": "physics.stackexchange",
"id": 83085,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "newtonian-gravity, angular-momentum, rotational-dynamics, gyroscopes, precession",
"url": null
} |
I've heard something about ambient spaces, which is supposed to be the space containing all spaces you are considering, in this case $X$ would be an ambient space, and $E$ would not be an ambient space.
Does the concept of ambient spaces affect whether a set can be open, closed or both? For example if we let $X = \mathbb{R^3}$, and $E = \mathbb{R^2}$, where $E \subset X$, then is $E$ open, closed or both open and closed?
If it does, then does that mean that a metric space can only be open/closed or both, relative to itself or some other metric space which acts as an ambient space?
Your proof is correct except the conclusion. What you have proved is the $E$ must be simultaneously open and closed.
• @ArinCharudhuri So instead of having a proof by contradiction, I actually had a direct proof, that $E$ must be simultaneously open and closed? – Perturbative Oct 16 '16 at 0:52
• Yes. You are correct. – Arin Chaudhuri Oct 16 '16 at 0:54 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9869795091201805,
"lm_q1q2_score": 0.8329071682558201,
"lm_q2_score": 0.8438950966654774,
"openwebmath_perplexity": 91.97573705358647,
"openwebmath_score": 0.9614254236221313,
"tags": null,
"url": "https://math.stackexchange.com/questions/1970306/can-an-open-set-contain-all-of-its-limit-points"
} |
$$\begin{array}{|rcll|} \hline \text{Position} &=& (800-1) \pmod{4} \\ &=& 799 \pmod{4} \\ &=& 3 \\ \hline \end{array}$$
$$\text{Column} =\ ?, ~\text{Row is even}:$$
$$\begin{array}{|rcll|} \hline \hline \text{Position} ~&(& 1 & 2 & \color{red}3 & 4\text{ or }0& ) \\ \hline \text{Row even} ~&(& D & C & \color{red}B & A &) \\ \hline \end{array}$$
The integer 800 will be written in column B
Dec 7, 2018
edited by heureka Dec 7, 2018 | {
"domain": "0calc.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9833429619433692,
"lm_q1q2_score": 0.8062363349235186,
"lm_q2_score": 0.8198933293122506,
"openwebmath_perplexity": 2422.7387732294947,
"openwebmath_score": 0.5726091861724854,
"tags": null,
"url": "https://web2.0calc.com/questions/help_18263"
} |
everyday-chemistry, home-experiment, carbon-allotropes
References:
[1]http://www.nobelprize.org/nobel_prizes/physics/laureates/2010/press.html
[2]http://www.nature.com/nmat/journal/v13/n6/full/nmat3944.html
[3]https://www.newscientist.com/article/dn25442-make-graphene-in-your-kitchen-with-soap-and-a-blender/
[4]http://www.researchgate.net/publication/251567939_Conductive_Thin_Films_of_Pristine_Graphene_by_Solvent_Interface_Trapping | {
"domain": "chemistry.stackexchange",
"id": 3827,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "everyday-chemistry, home-experiment, carbon-allotropes",
"url": null
} |
ros, linking
/usr/lib/arm-linux-gnueabihf/libavcodec.so.53: undefined reference to `speex_encode_int'
Originally posted by MarkyMark2012 on ROS Answers with karma: 1834 on 2013-06-11
Post score: 0
Did you consider setting the linker flags via cmake as suggested by the error message, e. g. :
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -rpath -rpath-link" )
Originally posted by Wolf with karma: 7555 on 2014-03-25
This answer was ACCEPTED on the original site
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 14519,
"lm_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, linking",
"url": null
} |
javascript, library
A better (more readable and maintainable) structure would be:
if(form.node().nodeName !== 'FORM') {
throw 'Type mismatch...';
}
// MUCH CONTENT
You don't need to roll your own form data collector: A FormData object can be created from a form and can then be passed to XMLHttpRequest.prototype.send().
This function is very unflexible since it relies on hardcoded values in the depot. It also restricts the notification area to a div.statusReporter.
Don't use formData[formData.length] = .... Use formData.push(...)!
The use of onsubmit instead of on('submit', ...) prevents other handlers to listen for the submit event.
As far as I understand your code, uploadFile only uploads a single file!
The examination of the full code is by far not complete, but the most important points should be mentioned if I'm not mistaken. | {
"domain": "codereview.stackexchange",
"id": 8842,
"lm_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, library",
"url": null
} |
javascript, jquery, html, html5
Title: Using jQuery 1.7 .on() and event.stopPropagation to close boxes when clicking in document body I have the following code which works but seems like it could be improved. I'm not sure if I'm using event.stopPropagation() correctly or if it is the best solution.
The elements are loaded via AJAX and so need to have .on() (previously .live(), which is now deprecated in jQuery 1.7).
I've used the example given here as a basis.
$('html').on('click', '.poster:not(.active) .image-effect', function (event) {
var obj = $(this).parent();
// If there are no .close spans
if (obj.find('.close').length === 0) {
// Add the close element by javascript to remain semantic
obj.find('.quick-view').append('<span class="close">×</span>');
}
// Close any open Quick Views
closeQuickView();
// Add the active class (controls opacity)
obj.addClass('active'); | {
"domain": "codereview.stackexchange",
"id": 828,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, jquery, html, html5",
"url": null
} |
To get from Def'n 2 to Def'n 1 for a Hausdorff space. For $p\in S$ let $U$ be a compact nbhd of $p.$ Let $V\in \tau$ with $p\in V\subset U.$ Then $Cl_X(V)$ is compact, because it is a closed subset of the compact Hausdorff space $U.$
(i). Observe that for all $W\subset V$ we have ($W$ is open in the space $U$) iff $W\in \tau.$
Let $B$ be an open local base (basis) at $p$ in the space $X.$ Then $C=\{V\cap b:b\in B\}$ is an open local base at $p$ in the space $X$ and also in the space $U$, by (i).
Now a compact Hausdorff space is a regular space. So $U$ is regular.
So for each $c\in C$ we can choose $c'$ where $c'$ is open in $U$ and $p\in c'\subset Cl_U(c')\subset c.$ Let $C'=\{c': c\in C\}.$ By (i), $C'$ is a local open base at $p.$ And $Cl_U(c')$ (which is equal to $Cl_X(c'))$ is a closed subset of the compact Hausdorff space space $U$ so $Cl_U(c')$ is compact. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9740426405416756,
"lm_q1q2_score": 0.8317474272454723,
"lm_q2_score": 0.8539127473751341,
"openwebmath_perplexity": 197.86776428415345,
"openwebmath_score": 0.9241222739219666,
"tags": null,
"url": "https://math.stackexchange.com/questions/2080931/compare-definitions-of-locally-compact-spaces"
} |
ros, camera1394
Title: Specifying GUID causes camera1394 to fail. [camera] device open failed: [Camera1394::open]: Could not find camera with guid
I have 2 cameras connected via firewire, and can open either one independently, when I dont specify the guid. However, when the guid is specified with the command:
rosrun camera1394 camera1394_node _guid:=b09d01008fe780 | {
"domain": "robotics.stackexchange",
"id": 7372,
"lm_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, camera1394",
"url": null
} |
php, performance, zephir
Running unpack on binary file (preload file, 3 unpacks per 12 bytes)...
... fread time: 0.016999959945679
... unpack time: 12.446995973587
... total measured time: 12.463995933533
... records: 265533
Running unpack on binary file (preload file, 12 bytes per unpack)...
... fread time: 0.01200008392334
... unpack time: 4.1770012378693
... total measured time: 4.1890013217926
... records: 265533
Running unpack on binary file (preload, 24 bytes per unpack)...
... fread time: 0.010999917984009
... unpack time: 2.189001083374
... total measured time: 2.200001001358
... records: 265534 (* padding added at end of input) | {
"domain": "codereview.stackexchange",
"id": 14085,
"lm_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, performance, zephir",
"url": null
} |
astronomy, telescopes, stars
NASA's WISE mission discovers coolest class of stars (Science Daily,
August 24, 2011).
whic includes a pretty nice artist's representation of what they might look like:
Could we achieve a high enough resolution to actually be able to study the dynamics of brown dwarf atmospheres in the near-future?
The one thing with brown dwarfs (especially isolated ones like this) is that you can't really subtract the transit spectrum from the parent spectrum (as you can with transiting exoplanets) not currently. The only images we have are of extended red and blue giants, and then only just via interferometers and the largest telescopes.
In maybe 10 years space born infra red interferometers might be imaging these objects but probably more like 20 to 30 years...
The best resoution we have managed so far in the optical is around 0.5 milli arcseconds, an impriovement in this by a factor of 10 to 100 would be necessary to image/measure brown dwarfs. | {
"domain": "physics.stackexchange",
"id": 11610,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "astronomy, telescopes, stars",
"url": null
} |
python, performance, beginner, python-3.x
Example
-------
>>> d = CaseInsensitiveDict({'a': 1, 'b': 2, 'c': 3, 'd': 4})
>>> d.multipopitem(3)
[('a', 1), ('b', 2), ('c', 3)]
>>> d
CaseInsensitiveDict({'d': 4})
"""
return [self.popitem() for _ in range(n)]
def multisetdefault(
self,
/,
*key_sequence: _K,
default: Optional[_V] = None
) -> list[Optional[_V]]:
"""Return a list of values corresponding to an arbitrary sequence of keys.
If any item in key_sequence is not a valid key,
the default value goes in the list.
Additionally, the mapping will be updated
such that the key is added to the mapping,
with this function's `default` parameter
as the associated value. | {
"domain": "codereview.stackexchange",
"id": 41789,
"lm_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, python-3.x",
"url": null
} |
quantum-state, bloch-sphere
Here are some of my thoughts. I refer to the 'qubit' case for some inspiration, i.e., the bases are only $3$ Pauli matrices, and the vector has $3$ dimensions. A brute-force proof is to check the square of the coefficients of $U\sigma_1U^\dagger$ sum to 1, the square of the coefficients of $U\sigma_2U^\dagger$ sum to 1, and also the square of coefficients of $U\sigma_3U^\dagger$ sum to 1. Then for any term $\sum_{i=1,2,3}r_i\sigma_i$, after the action of unitary, i.e. $U\sum_{i=1,2,3}r_i\sigma_i U^\dagger$, easy to see the length of $\vec r$ remain unchanged. But the method becomes too complicated in the '$2$-qubit' case for we need to check $15$ matrix equations in total. So for the '$2$-qubits' case, is there some easier method, and also, for the '$d$-qubit' case, is this character still remain? One of the key things that does not change as the result of a unitary transformation applied to a matrix is the eigenvalues of the matrix. Consequently, any function of the matrix that only | {
"domain": "quantumcomputing.stackexchange",
"id": 3519,
"lm_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-state, bloch-sphere",
"url": null
} |
From left to right, a function with a relative maximum where its derivative is zero; a function with a relative maximum where its derivative is undefined; a function with neither a maximum nor a minimum at a point where its derivative is zero; a function with a relative minimum where its derivative is zero; and a function with a relative minimum where its derivative is undefined. We show a procedure to find global extrema on closed intervals. Discover how to analyze the graph of a function with curve sketching. A function is concave down at a point if there is an interval containing c and the second derivative is negative on this interval. Substitute in. Finding Extreme Values of a Function. Under any of these conditions, the First Derivative Test would have to be used to determine any local extrema. a second derivative number line and it does not find points of inflection. =− 4+24 2 First derivative: ′ =−4 3+48 First derivative will give us critical numbers, increasing and decreasing, | {
"domain": "brouwerverkeersopleidingen.nl",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9916842195563768,
"lm_q1q2_score": 0.8198370424180074,
"lm_q2_score": 0.8267117962054049,
"openwebmath_perplexity": 259.82261796467463,
"openwebmath_score": 0.7462790012359619,
"tags": null,
"url": "http://brouwerverkeersopleidingen.nl/how-to-find-relative-extrema-using-second-derivative-test.html"
} |
thermodynamics, estimation, diffusion, thermal-conduction
$$Q/t = U_{glass}\ A\ \Delta T$$
Using the floor-area you have chosen for your greenhouse and assuming a mean height of 2.5 m, I crudely estimate that $A=30\ \text m^2$
A tea-light, it seems, gives out about 32 W (32 J/s). So by putting $Q/t=32\ \text{J/s}$ we can work out the temperature difference that the tea light could maintain between the inside and outside...
$$\Delta T=\frac {Q/t}{U_{glass}A}=\frac{32\ \text W}{6\ \text {W m}^{-2}\ \text {°C}^{-1}\ 30\ \text m^2}=0.2\ \text{°C}$$
This isn't very impressive is it? And, of course, the tea-light may have to burn for several minutes before this equilibrium temperature difference is established. To be fair , the temperature inside the greenhouse won't be uniform, and it's quite possible that plants near the potted tea-light might be preserved from frost even when the outside temperature is a few degrees below zero. | {
"domain": "physics.stackexchange",
"id": 97821,
"lm_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, estimation, diffusion, thermal-conduction",
"url": null
} |
# The probability of having a perfect matching in a bipartite graph
Say we have a bipartite graph $G$ with two sets, $\{x_1,\dotsc,x_n\}$ and $\{y_1,\dotsc,y_n\}$. For each pair $xy$, there is an edge with probability $p$. Then, what is the probability of having a perfect matching in $G$?
• you need the exact probability? – Salomo May 5 '15 at 1:26
• i am doing some reading on this and i think i can be shown that if n is large enough, G has a perfect matching with probability 1-1/n. But i don't know how to get there. – David May 5 '15 at 1:28
• I don't think it is possible if you didn't fix $p$, say $p$ can be $0$. – Salomo May 5 '15 at 1:31
• true, but what if we fix p=constant * (ln n /n) – David May 5 '15 at 1:44
For too-small $p$, there will be isolated vertices, and in particular there will be no perfect matching. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.984336353126336,
"lm_q1q2_score": 0.8306766257374402,
"lm_q2_score": 0.8438951005915208,
"openwebmath_perplexity": 161.43161975969076,
"openwebmath_score": 0.9079244136810303,
"tags": null,
"url": "https://math.stackexchange.com/questions/1267387/the-probability-of-having-a-perfect-matching-in-a-bipartite-graph"
} |
energy-conservation, conservation-laws, potential-energy, capillary-action
$\gamma_{L}$ 2πr δh increase in the surface energy due to the liquid-solid contact
$\gamma_{G}$ 2πr δh decrease in the surface energy due to the gas-solid contact
$\rho g$ $\pi r^2$ h δh increase in the gravitational potential energy of the system where ρ is the difference between the liquid and gas densities, because we're also displacing air and changing the potential energy of that little parcel of air as well.
Overall change in energy $\delta F = \delta h(\pi r^2 \rho g h + 2\pi r(\gamma_L - \gamma_G))$.
At equilibrium $\delta f = 0$, so $r \rho g h + (\gamma_L - \gamma_G) = 0$ and we have
$$h = \frac{\gamma_G - \gamma_L}{\rho g r}$$ | {
"domain": "physics.stackexchange",
"id": 79281,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "energy-conservation, conservation-laws, potential-energy, capillary-action",
"url": null
} |
rviz
Comment by dornhege on 2012-08-08:
Your code seems quite obscure. Are you sure it does what you want? You walk over the laser in nested loops. If you just want to get the max/min that is wrong.
Comment by Astronaut on 2012-08-09:
Ok. yes than its wrong. What should I do to get max/min?
Comment by dornhege on 2012-08-10:
Well, usually it's: max=0; for(uint i ... laser.range) if(laser.range[i] > max: max=laser.range[i]
Given your purpose I'd suggest to use a visualization_msgs/Marker instead of a LaserScan. A LaserScan can only display complete data, not single beams. With a marker, you can choose specific points, select a color, and also increase the size of the marker. | {
"domain": "robotics.stackexchange",
"id": 10521,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "rviz",
"url": null
} |
geology, petroleum
It's so broad that I daresay you can find an area that would appeal to almost anyone with an interest in science. If you're more quantitative (interested in maths and computing), then you'll find lots of friends in geophysics, but there are plenty of highly quantitative geologists and geochemists (and arguably those fields are more in need of nerds than geophysics is).
I think it's fair to say that most petroleum geoscientists started with a general degree in geology, geophysics, or some related discipline, perhaps followed it up with a post-graduate degree, then got a job in petroleum. They didn't train in petroleum geology per se. | {
"domain": "earthscience.stackexchange",
"id": 2418,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "geology, petroleum",
"url": null
} |
ros, errors
costmap_2d::Costmap2D* costmap_ros_;
costmap_2d::Costmap2DROS *costmap_ros;
__uint32_t size_x, size_y;
__uint32_t map_xi, map_xf, map_yi, map_yf;
ros::Publisher global_plan_pub, goal_marker_pub;
ros::Subscriber pose_sub;
ros::NodeHandle nh_;
int marker_id_cnt;
};
};
#endif | {
"domain": "robotics.stackexchange",
"id": 2379,
"lm_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, errors",
"url": null
} |
observational-astronomy, orbital-mechanics, orbital-elements, meteor
This particular event occurred in the Bismark sea, North of Papua New Guinea, it probably could have been seen from Papua or parts of Indonesia, if the sky was clear (which it rarely is, in the middle of the tropical rain band), but if it was seen, it wasn't reported to the American meteor society (reports from that time)
The satellites are designed to look for rocket launches, and to track the missiles as the climb through the atmosphere to determine the likely target. Thus they are able to get accurate position and velocity vectors of meteors. If you know the position and velocity vector of the meteoroid just prior to impact, it is an exercise in Newtonian gravity to work out the orbit of the meteoroid around the sun. (It is a three body problem as the meteoroid is moving in both the Earth's and the Sun's gravitational field) | {
"domain": "astronomy.stackexchange",
"id": 3678,
"lm_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, orbital-mechanics, orbital-elements, meteor",
"url": null
} |
complexity-theory, optimization, machine-learning, coding-theory, entropy
Title: Complexity of / best algorithm for finding the dichotomy that maximizes information gain? Suppose that $X$ is a finite set with a probability measure $P$. I want to find the subset $A \subset X$ so that the information gain of conditioning on ${A, A^c}$ is maximal. That is, I want to find $A$ that maximizes
$$H(X) -H(X|\{A,A^c\}) = H(X) - (P(A)H(A) + P(A^c) H(A^c)),$$
where $H(A)$ refers to the entropy of the conditional probability distribution so $\mu(B) = P(B \cap A) / P(A)$. (If $P(A) = 0$, then set $P(A) H(A) = 0$. In any case, it won't be a maximizer.)
Since this splits $X$ into two sets, I am calling this a dichotomy, and the question is of finding the dichotomy that produces the largest information gain. | {
"domain": "cs.stackexchange",
"id": 8712,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "complexity-theory, optimization, machine-learning, coding-theory, entropy",
"url": null
} |
galaxies, supernova, structure-formation
Title: Could the center of the galaxy explode as a result of a chain reaction of stars going supernova? I was reading "Ringworld" by Larry Niven. I'll spare you most of the details of the story, and say that one of the parts of the plot is that the center of the Milky Galaxy blows up, because all of the stars in the galactic center are all so close that when one goes supernova, it causes the remaining stars to go supernova which results in an explosion that will annihilate Earth when the explosion reaches it in about 20,000 years. I'll let the book explain: | {
"domain": "physics.stackexchange",
"id": 87243,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "galaxies, supernova, structure-formation",
"url": null
} |
electromagnetism, optics, waves, electromagnetic-radiation, poynting-vector
If $\vec{E}$ is defined to be the real part of the complex field $\vec{E}_c$, where $\vec{E}_c$ is a mathematical tool and not physical. The formula for the Poynting vector involves $\vec{E}\times \vec{B}$, which is very much NOT the real part of $\tilde{E}_c\times \tilde{B}_c$. That is to say, you WANT to calculate $\mathrm{Re}(\vec{E}_c)\times \mathrm{Re}(\vec{B}_c)$, not $\mathrm{Re}(\vec{E}_c\times\vec{B}_c)$ (which is what you have calculated). If you proceeded with the cross product you have in your post, you would in fact find the time average of $\vec{E}_c\times\vec{B}_c$ to be zero! | {
"domain": "physics.stackexchange",
"id": 39752,
"lm_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, optics, waves, electromagnetic-radiation, poynting-vector",
"url": null
} |
1
Asking for help completing homework assignments is a sketchy subject. I'll help with hints, however a full solutions seems to be against the purpose of this site. As others have mentioned there is a built-in method for this Tally as for your own method, you are correct in that it won't work since it's only matching adjacent objects, you can fix this by ...
1
One of the nice things about Mathematica is that it supports many different styles of programming. I think your code has the aspect of more "traditional" code that one might write in a different programming language. Perhaps your code is correct in spirit, but it seems to me overly complicated and as written obviously is not okay because it throws a ...
Only top voted, non community-wiki answers of a minimum length are eligible | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9637799399736477,
"lm_q1q2_score": 0.8153023477070857,
"lm_q2_score": 0.8459424334245618,
"openwebmath_perplexity": 1036.0748998385989,
"openwebmath_score": 0.296828031539917,
"tags": null,
"url": "http://mathematica.stackexchange.com/tags/homework/hot"
} |
Series Description: Textbook notes of Continuous Fourier Series for Numerical Methods book. B), discusses how one moves from Fourier series to Fourier transform when extending previous discussion to functions defined the entire real line. Redefine a Fourier series as an expansion of a periodic function f(x) in the interval [0,2π] in terms of a series of sines and cosines. Applications 35 Chapter 3. XFourier series of a periodic signal x(t) with period T 0 is given by: XTake Fourier transform of both sides, we get: XThis is rather obvious! L7. Symmetry in Exponential Fourier Series Since the coefficients of the Exponential Fourier Series are complex numbers, we can use symmetry to. The discrete Fourier series coefficients are periodic because the analyzed signals are discrete. If I wanted to detect this sequence I just need to look for a series of strong intensities from the FFT output at the rising and falling frequencies of the whistle. Chapter 1 in this book is a short review of some | {
"domain": "psicologicamenteonlus.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9793540704659681,
"lm_q1q2_score": 0.8006948933458974,
"lm_q2_score": 0.817574478416099,
"openwebmath_perplexity": 771.7534024236097,
"openwebmath_score": 0.8521015048027039,
"tags": null,
"url": "http://psicologicamenteonlus.it/fourier-series-notes.html"
} |
interactions, domains
Obviously, if you need anything more fancy than that, it's time to write a proper parser using Perl or Python or any other language that can understand XML. | {
"domain": "bioinformatics.stackexchange",
"id": 998,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "interactions, domains",
"url": null
} |
### C implementation
We can start by writing a C implementation:
#define _GNU_SOURCE
#include <unistd.h>
#include <sys/syscall.h>
int main( void )
{
int i = 1;
const char fizz[] = "Fizz";
const char buzz[] = "Buzz";
const char nl[] = "\n";
char digits[ 2 ];
while( 1 )
{
char *p = digits;
*p = i / 10 + '0';
p += ( i >= 10 );
*p = i % 10 + '0';
p++;
syscall( SYS_exit * ( i > 100 ) + SYS_write * ( i <= 100 ), i <= 100,
digits, ( i % 3 != 0 && i % 5 != 0 ) * ( p - digits ) );
syscall( SYS_write, 1, fizz, ( i % 3 == 0 ) * ( sizeof( fizz ) - 1 ) );
syscall( SYS_write, 1, buzz, ( i % 5 == 0 ) * ( sizeof( buzz ) - 1 ) );
syscall( SYS_write, 1, nl, sizeof( nl ) - 1 );
i++;
}
/* NOT REACHED */
return 0;
}
The basic idea is to calculate the syscall number arithmetically and using the fact that a zero-length write is essentially a no-op.
In at least one associated assembly listing (obtained with Godbolt’s Interactive compiler) there are no conditional branches: | {
"domain": "wordpress.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.983085087724427,
"lm_q1q2_score": 0.8234517011106353,
"lm_q2_score": 0.8376199694135332,
"openwebmath_perplexity": 2000.9667066203313,
"openwebmath_score": 0.7024517059326172,
"tags": null,
"url": "https://mchouza.wordpress.com/page/2/"
} |
android, kotlin, kotlin-compose
The complete function then looks like this:
fun convertInput(fromUnit: Units, toUnit: Units, fromValue: Double):Double {
val lengthMeter = when (fromUnit) {
Units.Meter -> fromValue * 1.0
Units.Kilometer -> fromValue * 1000.0
Units.Feet -> fromValue * 0.3048
Units.Yard -> fromValue * 0.9144
Units.Miles -> fromValue * 1609.34
}
return when (toUnit) {
Units.Meter -> lengthMeter
Units.Kilometer -> lengthMeter / 1000.0
Units.Feet -> lengthMeter * 3.28084
Units.Yard -> lengthMeter * 1.09361
Units.Miles -> lengthMeter * 0.000621371
}
}
Also. The naming convention for enum values in Kotlin is to use uppercase as below
enum class Units {
Meter,
Kilometer,
Feet,
Yard,
Miles
} | {
"domain": "codereview.stackexchange",
"id": 44280,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "android, kotlin, kotlin-compose",
"url": null
} |
vba
Dim names As Variant
names = Array("OverheadsList", "OverheadsActuals", "OApr", "OMay", "OJun", "OJul", "OAug", "OSep", _
"OOct", "ONov", "ODec", "OJan", "OFeb", "OMar")
For i = LBound(names) To UBound(names)
ActiveWorkbook.names.Add Name:=names(i), RefersToR1C1:="=" & _
ActiveSheet.Name & "!" & _
Range(Cells(4, i + 2), Cells(Cells(Rows.Count, i + 2).End(xlUp).Row, i + 2)).Address(ReferenceStyle:=xlR1C1)
Next i
Columns.AutoFit
End Sub | {
"domain": "codereview.stackexchange",
"id": 4401,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "vba",
"url": null
} |
c++, object-oriented
public:
int locator;
void retrieve();
void init();
void store();
}inv1;
void setItemNumber(int &temp)
{
do
{
cout << "\nPlease enter the item number (if finished please enter '0'): ";
cout << "\nNumber must be positive: " << endl;
cin >> temp;
} while (temp < 0);
}
void setQuantity(int &temp)
{
do
{
cout << "\nPlease enter the Quantity: ";
cout << "\nNumber must be positive: " << endl;
cin >> temp;
} while (temp < 0);
}
void setPrice(double &price)
{
do
{
cout << "\nPlease enter the Price: ";
cout << "\nNumber must be positive: " << endl;
cin >> price;
} while (price < 0);
}
void inventory :: init()
{
int counter = 0;
while (counter < 10)
{
productCount[counter] = 0;
productNum[counter] = 0;
productPrice[counter]= 0;
counter++;
locator = counter;
}
} | {
"domain": "codereview.stackexchange",
"id": 22123,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, object-oriented",
"url": null
} |
ros, android-core, android-gingerbread, rosjava-core, android
ROS Core running on a Ubuntu system was taking fine with HTTP thru the firewall but when I did a:
'rostopic echo \mychatter' | {
"domain": "robotics.stackexchange",
"id": 23362,
"lm_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, android-core, android-gingerbread, rosjava-core, android",
"url": null
} |
svm, predict
Title: Get the prediction probability using prediction function I'm new to SVM models. I took custom SVM classifier from the github. In there standard predict function was overwritten by custom predict function.
def predict(self, instances):
predictions = []
for instance in instances:
predictions.append((int)(np.sign(self.weight_vector.dot(instance.T)[0] + self.bias)))#class is determined based on the sign -1,1
I want to get prediction probability of each class. [-1 probability, 1 probability]
I know from standard SVM predict_proba function I can get the probability. Since this is a customized SVM how do I get that? Can somebody help me.
Thank you I have followed scikit-learn https://github.com/scikit-learn/scikit-learn/blob/fd237278e/sklearn/linear_model/_base.py#L293 link and was able to get predicted probabilities. | {
"domain": "datascience.stackexchange",
"id": 9451,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "svm, predict",
"url": null
} |
What do the values of the correlation coefficient mean? Correlation does not describe curve relationships between variables, no matter how strong the relationship is. However, if the two variables are related it means that when one changes by a certain amount the other changes on an average by a certain amount. n A large correlation coefficient implies that there is a large linear component of relationship, but not that other components do not exist. Therefore, the value of a correlation coefficient ranges between -1 and +1. For more general, non-linear dependency, see, Interpretation of the size of a correlation, As early as 1877, Galton was using the term "reversion" and the symbol ", Coefficient of determination § In a non-simple linear model, Correlation and dependence § Sensitivity to the data distribution, Correlation and dependence § Other measures of dependence among random variables, Normally distributed and uncorrelated does not imply independent, "The British Association: | {
"domain": "equipement-hardware.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9732407168145569,
"lm_q1q2_score": 0.831062652543348,
"lm_q2_score": 0.8539127455162773,
"openwebmath_perplexity": 658.7259965617884,
"openwebmath_score": 0.706878125667572,
"tags": null,
"url": "http://equipement-hardware.com/toronto-trivia-jmvkz/a-correlation-coefficient-of-zero-describes-485f80"
} |
c#, validation, winforms, controller
The PipeSize variable is declared and initialized, but never used.
The InitMillForm method could be cleaned up by using a dictionary of values to set the form fields where the key in the dictionary is the year, and the value could be the prefix:
var year = DateTime.Now.Year;
var preferences = new Dictionary<int, string>()
{
{ 2016, "ES" },
{ 2017, "ET" },
{ 2018, "EU" },
{ 2019, "EV" },
{ 2020, "EW" },
{ 2021, "EX" },
{ 2022, "EY" },
{ 2023, "EZ" }
};
millform.Controls["txtPrefEnd"].Text = preferences[year];
millform.Controls["txtPrefStart"].Text = preferences[year]; | {
"domain": "codereview.stackexchange",
"id": 33656,
"lm_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#, validation, winforms, controller",
"url": null
} |
c++, object-oriented
};
Products.h
#pragma once
#include <iostream>
#include <string>
#include <vector>
// Create an Interface for Product Objects
class IProducts
{
public:
// Virtual Function to get the name of the product implementing the interface
virtual const std::string getProductName() const = 0;
// Virtual Function to Display the names of all components of a class implementing the interface
virtual void DisplayComponents() = 0;
// Virtual Function to display the values of the components of a class implementing the interface
virtual void Display() = 0;
// Virtual Function to set the components to desired values
virtual void setAttributes() = 0;
};
// Concretion of Product Interface
class PC_Towers final : public IProducts
{
public:
// Function to set the member variables of the class
void setAttributes ()
{ | {
"domain": "codereview.stackexchange",
"id": 34499,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, object-oriented",
"url": null
} |
resource-request, quantum-circuit
Of the same author, I thought interesting to see this kind of application of QC in Genetic ALgorithms. These two have guided me towards more recent applications and developments.
Quantum-Inspired Evolutionary Algorithms on
IBM Quantum Experience
A New Quantum Inspired Genetic Algorithm for Evolvable Hardware
Where you have implementation and development of state-of-the-art algorithms.
Disclaimer: I am not an expert, I have only tried to help you in your search, simply because I found interesting that such attempts already exist given the state of QC as a field. Hopefully more experienced people will jump in and make helpful comments, while also address further points and improvements.
Att. | {
"domain": "quantumcomputing.stackexchange",
"id": 3591,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "resource-request, quantum-circuit",
"url": null
} |
We'd like to multiply through by , but we must be very careful!
What we get depends on whether $x$ is positive or negative.
Suppose $x$ is positive.
Multiply both inequalities by $x.$
We have: . $\text{-}7x \:<\:1 \quad\Rightarrow\quad x \:>\:\text{-}\tfrac {1}{7}$
. . . and: . $1 \:\le\:x \quad\Rightarrow\quad x \:\ge\:1$
To make both statements true, we use: . $\boxed{x\:\ge\:1}$
Suppose $x$ is negative.
Multiply both inequalities by negative $x.$
We have: . $\text{-}7x \:>\:1 \quad\Rightarrow\quad x \:<\:\text{-}\tfrac{1}{7}$
. . . and: . $1 \:\ge\:x \quad\Rightarrow\quad x \:\le\:1$
To make both statements true, we use: . $\boxed{x \:<\:\text{-}\tfrac{1}{7}}$
Solution: . $\left(x\:<\:\text{-}\tfrac{1}{7}\right)\:\cup\:\left(x\:\ge\:1\right)$
n . . . . . . . $\left(\text{-}\infty,\,\text{-}\tfrac{1}{7}\right)\:\cup\:\left[1,\,\infty\right)$
. . . . . $\begin{array}{ccccc} === & \circ & --- & \bullet & === \\ & \text{-}\frac{1}{7} && 1 \end{array}$ | {
"domain": "mathhelpforum.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9632305339244013,
"lm_q1q2_score": 0.8468210102661154,
"lm_q2_score": 0.8791467675095294,
"openwebmath_perplexity": 747.8941771831446,
"openwebmath_score": 0.9894785284996033,
"tags": null,
"url": "http://mathhelpforum.com/algebra/203119-solving-compound-inequalities-problem.html"
} |
fluid-dynamics, newtonian-gravity, atmospheric-science, weather, lift
Title: How do frogs and fish rain? I saw a documentary about the rain of frogs and fish in certain areas due to water sprouts sucking them up and causing rain of frogs and fish (pretty large ones) hundreds of miles away. But how is it possible that frogs and fish can be transported such large distances without them falling immediately even in calm weathers? The wiki article is explanatory:
Raining animals is a rare meteorological phenomenon in which flightless animals fall from the sky. Such occurrences have been reported in many countries throughout history. One hypothesis is that tornadic waterspouts sometimes pick up creatures such as fish or frogs, and carry them for up to several miles. However, this aspect of the phenomenon has never been witnessed by scientists.
....... | {
"domain": "physics.stackexchange",
"id": 52748,
"lm_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, newtonian-gravity, atmospheric-science, weather, lift",
"url": null
} |
logic, model-checking, linear-temporal-logic, computation-tree-logic
To demonstrate how to approach the questions at hand, let's consider the first one. First, consider what the formulas mean:
$FGp$ means "in every path, after a finite prefix, $p$ always holds".
$AFEGp$ means "in every path, after a finite prefix, a state is reached from which there exists a path in which $p$ is always true."
Now, if $FGp$ holds, then $AFEGp$ must also hold, because in every path, eventually a state is reached from which $Gp$ holds. Thus, our search should restrict to finding a system which satisfies $AFEGp$, but not $FGp$.
To achieve this, we need to at least have a state that satisfies $Gp$, so let's start with that. Take the state $A$ to have the transition $A\to A$, and $A$ is labeled with $p$. Let's also have $A$ as the initial state (this is arbitrary). So far, this system also satisfies $FGp$, so now we fix that by adding a "bad path": we add a state $B$, labeled by $\neg p$ with the transitions $A\to B$ and $B\to A$. | {
"domain": "cs.stackexchange",
"id": 2249,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "logic, model-checking, linear-temporal-logic, computation-tree-logic",
"url": null
} |
homework-and-exercises, electromagnetic-radiation, thermal-radiation, estimation, x-rays
$$
2\frac{k^4T^4}{h^3c^2}\sum_{n=1}^{\infty}\frac{1}{n^4} \Gamma(4, n\cdot x)
$$
Plugging in some numbers reveals that the n = 1 term dominates the other terms, so we can drop higher n terms, resulting in
$$
P \approx 10^{-154} \ \mathrm{Wm^{-2}}.
$$
This is tiny. Over the course of the lifetime of the universe you can expect on average no X-Ray photons to be emitted by the filament.
More exact treatments might get you more exact numbers (we've ignored the surface area of the filament and the solid angle factor for instance), but the order of magnitude is very telling - there are no X-ray photons emitted by a standard light bulb. | {
"domain": "physics.stackexchange",
"id": 24116,
"lm_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, electromagnetic-radiation, thermal-radiation, estimation, x-rays",
"url": null
} |
photometry, apparent-magnitude
Title: Why must all magnitude systems have a reference point? Let $f_*$ and $f_0$ be the observed flux of a star and a reference flux in a particular spectral band, and let $m_*$ and $m_0$ be their respective apparent magnitudes. Then the star's magnitude is given by $m_*-m_0=-2.5\log(f_*/f_0)$.
Encyclopædia Britannica maintains that
All magnitude systems must have a reference, or zero, point.
Why is this? It seems to me that one could just say $m_*=-2.5\log f_*$ and move on, no? Because you can't take the logarithm of something with dimensions only the log of a number.
Your magnitude would depend on what you measured f in. In other words, by choosing a set of units, you choose a zero point! Whether that unit is Jy, W/m$^2$ or the flux of some other object. | {
"domain": "astronomy.stackexchange",
"id": 5505,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "photometry, apparent-magnitude",
"url": null
} |
• Start with the Venn diagram for $A$ and $B.$ You know how many items in $A,$ in $B,$ and in $A\cap B,$ so you know how many are in $A\setminus B$ and in $B\setminus A.$ So far so good. Now add $C$ to the picture. Now you have four quantities to figure out: how many in $C\cap A\cap B,$ how many in $C\cap(A\setminus B),$ how many in $C\cap(B\setminus A),$ and how many in $C\setminus(A\cup B).$ Do you think you can get those four variables in terms of the three variables $|C|,\ |A\cap C|,\ |B\cap C|$? – bof Feb 2 '18 at 3:06
• But for $3$ sets you only need circles. – bof Feb 2 '18 at 3:34 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9793540662478147,
"lm_q1q2_score": 0.8203265170608022,
"lm_q2_score": 0.8376199633332891,
"openwebmath_perplexity": 180.5138297169783,
"openwebmath_score": 0.8355587124824524,
"tags": null,
"url": "https://math.stackexchange.com/questions/2632126/calculate-the-union-of-three-sets-based-only-on-the-values-in-each-set-and-their"
} |
python, classes, selenium
def __init__(self, driver, SRC):
super().__init__(driver, SRC)
self.driver = driver
self.SRC = SRC
def wait_for_page_to_load(self):
driver = self.driver
wait = WebDriverWait(driver, 100)
wait.until(
EC.presence_of_element_located(*self.SRC.INPUT['MAIN_BODY']))
def get_single_element(self, name):
"""Returns a single value as target data."""
driver = self.driver
target_data = driver.find_element(*self.SRC.OUTPUT[str(name.upper())])
return target_data
def number_of_items_found(self):
"""Return the number of items found on a single page."""
driver = self.driver
target_data = driver.find_elements(*self.SRC.OUTPUT['INDEX'])
return len(target_data) | {
"domain": "codereview.stackexchange",
"id": 41492,
"lm_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, classes, selenium",
"url": null
} |
c++, multithreading, thread-safety, c++14
Why bother waking all worker threads when only a single slice of work was added? std::condition_variable_any::notify_one() is more appropriate.
void stop()
{
this->stop_ = true;
}
Here, on the other hand, std::condition_variable_any::notify_all() should have been used, wake the threads currently sleeping.
void stop()
{
this->stop_ = true;
this->cv_.notify_all()
}
std::shared_lock<std::shared_timed_mutex> lock(this->mu_, std::try_to_lock);
this->cv_.wait_for(lock, 10ms);
This part only works as expected for the first thread, as it actually gets the lock. The second thread fails to obtain the lock.
See the documentation for std::condition_variable_any::wait_for. The lock must be locked before entering wait_for.
That means you can't use std::try_to_lock, but actually need std::lock. | {
"domain": "codereview.stackexchange",
"id": 22488,
"lm_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, thread-safety, c++14",
"url": null
} |
earth, atmospheric-science
These all seem like plausible factors, but I'm not sure what the main reasons are. Which factors contribute the most, and how much?
To me reasons 1, 2 and 4 seem like the main causes. Do tidal forces really matter? Does distance to the Sun really matter? (Seems ridiculous because the Sun is 150 million kilometers away from Earth, so a few extra thousand kilometers shouldn't matter at all)
Is there any main biggest factor that makes much more of a difference than the other factors? There are a couple of ways the atmosphere can be viewed as being "thicker" at the equator than at the poles. One sense is the mass per unit area of all of the air overhead, from sea level to outer space, at the equator vs at the North Pole. Atmospheric pressure at sea level, being essentially a potential, is on average pretty much constant worldwide when averaged out over the course of years. | {
"domain": "physics.stackexchange",
"id": 40951,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "earth, atmospheric-science",
"url": null
} |
fluid-dynamics, acoustics, velocity, vector-fields
It is something that has nothing to do with Acoustic or any other area where potentials come into play. Rather, it is a general property of fields provided certain assumptions hold.
For (usually) simply connected regions whenever you have an irrotational field, that is $\textrm{curl}\,\mathbf {v}=0$, then it exists a function $f$ such that $\mathbf{v} = \textrm{grad}\,f$ in every point $x$ where the domains of definition make sense. The function $f$ is then said to be a potential for the field $\mathbf{v}$. Likewise, knowledge of the potential function in any point of the space allows to derive back the field, equivalently (again, provided the correct assumptions on connectivity of the regions to hold). | {
"domain": "physics.stackexchange",
"id": 25041,
"lm_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, acoustics, velocity, vector-fields",
"url": null
} |
beginner, c, programming-challenge
if(k!=1)
printf("\t\tNOT FOUND\n\n");
return p;
}
void mshowclient()
{
int d=32,a=msearchclient();
for(int i=0;i<10;i++)
{
if(a==t[i].f)
{
printf("|FULL Name\t\t|ID\t\t|Adresse\t\t|Telphone Number\t\t|Date of Birth\n");
printf("|%s%c%s \t\t|%d\t\t|%s\t\t|%s\t\t|%d/%d/%d\n" ,t[i].name,d,t[i].prenom,t[i].f,t[i].adr,t[i].tel,t[i].datec.j,t[i].datec.m,t[i].datec.a);
}
}
}
int msearchaccount()
{
account accountt;
int k,*a,p;
printf("enter the ID of account:");
scanf("%d" ,&accountt.ic);
for(int i=0;i<10;i++)
{
if(accountt.ic==v[i].ic)
{
k=1;
printf("\n");
printf("\t\tFOUND\n\n");
a=&v[i].ic;
p=*a;
}
}
if(k!=1)
printf("\t\tNOT FOUND\n\n");
return p;
} | {
"domain": "codereview.stackexchange",
"id": 37438,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "beginner, c, programming-challenge",
"url": null
} |
electromagnetism, angular-momentum, conservation-laws, polarization
Title: Is there intrinsic angular momentum in the conservation law of EM? The equation for conservation of angular momentum in electrodynamics is
\begin{equation}
\frac{\mathrm d\vec{L}_\mathrm{mec}}{\mathrm dt} + \frac{\mathrm d\vec{L}_\mathrm{EM}}{\mathrm dt} = \int M \cdot \mathrm d \vec{S}
\end{equation}
where $\vec{L}_\mathrm{EM}=\int \vec{r} \times (\frac{\vec{E} \times \vec{B}}{4\pi c})\mathrm dV$ is the electromagnetic angular momentum and $M_{il}=\epsilon_{ijk}r_j T_{kl}$ with $T_{ij}$ the Maxwell tensor. | {
"domain": "physics.stackexchange",
"id": 42083,
"lm_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, angular-momentum, conservation-laws, polarization",
"url": null
} |
Nominal problem with Solve, Reduce, FindRoot out
I try to solve the following system but I had the error message. ...
35 views
Conducting mathematical operations without specifying functions
How should I define my functions without entering their exact expression so as to compute operations like differentiation on them? Say I have a function $f(t,x)$, which I don't want to specify. Now I ...
93 views
Efficient function for life duration probability?
Sent to me by a colleague asking me for assistance (the function as is breaks): ...
60 views
Is it possible to call Windows API function to Read/Write INI file directly?
I want to create a function to read or wirte windows *.ini files, so I plant to call GetPrivateProfileString and ...
18 views
Slider controls not showing in CDF deployed to wolfram cloud | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9273632856092014,
"lm_q1q2_score": 0.8073599370464029,
"lm_q2_score": 0.8705972616934406,
"openwebmath_perplexity": 1337.885100627045,
"openwebmath_score": 0.8663334250450134,
"tags": null,
"url": "https://mathematica.stackexchange.com/questions"
} |
c++, optimization, c++11, opengl, graphics
//
void Nixin::Canvas::SpriteBuffer::Begin( ShaderProgram& spriteShader )
{
// Check that two begins have not been called without an end.
if( hasBegun )
{
Debug::FatalError( "Begin was called twice before an end." );
}
hasBegun = true;
shader = &spriteShader; | {
"domain": "codereview.stackexchange",
"id": 7276,
"lm_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++, optimization, c++11, opengl, graphics",
"url": null
} |
8 cm, then we can solve for the area of a hexagon are rectangular or polygonal curves ( closed... See polygon area calculator the calculator below will find the area of triangles... Length a, area = ( 3a 2 √3 ) / 2. measure 6cm third parties as. 2 x s2 endpoints are nonadjacent vertices is called a hexagon in Maths? ] Square.... Generalises to all polygons, so we can area of hexagon for the area of a regular,. Case of the equilateral triangles in which we have discovered a general formula for the hexagon can used! 4Tan ( 180/n ) ] /2 Square units uses the same length this lesson called vertices the into! Altitude through the triangle opposite the 60 degree angle has 180 and we have to properties... Going to be 7 cm Image will be uploaded soon ] [ Image will be uploaded ]!, regular and irregular hexagon perimeter using the smaller triangles inside the hexagon into six triangles a... The rest of the regular polygon inscribed to a circle when you solve the problem are. Arts, special | {
"domain": "gridserver.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9857180648162212,
"lm_q1q2_score": 0.8104466722089778,
"lm_q2_score": 0.8221891239865619,
"openwebmath_perplexity": 437.94188653280725,
"openwebmath_score": 0.661034882068634,
"tags": null,
"url": "https://s78299.gridserver.com/pq2r4/area-of-hexagon-e09066"
} |
electrostatics, potential, conventions
Title: Zero of Electric Potential Energy When you have a positive charge and a negative charge, the line that cuts perpendicularly between their separation distance is an equipotential line of 0 volts. The math indicates that at that point, $V=\frac{kQ}{r}+\frac{k(-Q)}{r}=0$. But do these formulae not presume the zero of electric potential to be when $r=\infty$, that is, $V=\frac{kQ}{\infty}=0$? Why are there two zeroes, or which one is the real one? Both the zeroes are "real" to answer the question.
There is absolutely no problem with multiple points in a space having the same electric potential.
Note that we have ASSUMED the potential to be zero at infinity and based upon that assumption we have found out the potential to be again zero at the equidistant point between two opposite charges. So there is no contradiction at all with two points having the same (zero) potential. | {
"domain": "physics.stackexchange",
"id": 23508,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electrostatics, potential, conventions",
"url": null
} |
strings, sets, substrings
Title: Check whether set of strings is prefix-free via lexicographic sort? I have a set of strings and would like to establish whether the set has the prefix property, which basically means that no string in the set is a prefix of any other string in the set. So {a, b} is prefix-free (has the prefix property) while {a, b, ba} is not prefix-free (lacks the prefix property) because the entire string b is a prefix of ba.
One can of course implement this with a double-loop for quadratic performance. In JavaScript (so you can pop open your browser’s JS Console and try it, if so inclined):
function isPrefixCode(strings) {
for (const i of strings) {
for (const j of strings) {
if (j === i) {
continue;
}
if (i.startsWith(j)) {
return false;
}
}
}
return true;
}
isPrefixCode(new Set('a b c'.split(' '))) // true
isPrefixCode(new Set('ba b c'.split(' '))) // false | {
"domain": "cs.stackexchange",
"id": 21317,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "strings, sets, substrings",
"url": null
} |
coordinate-systems, conformal-field-theory, scaling
\tag{2.121$^*$}
$$
then we find that the action is invariant (that is, $S[\Phi']=S[\Phi]$) if and only if
$$
\Delta = \frac{d}{2}-1,
\tag{2.124}
$$
exactly as the book says. The proof involves an ordinary change of integration variable, which is just plain calculus. The language about the "weight" of $\partial_\mu$ is just a way of saying what happens to $\partial_\mu$ as a result of this ordinary change of integration variable, which explains why the "weight" of $\partial^\mu$ is the same. | {
"domain": "physics.stackexchange",
"id": 78821,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "coordinate-systems, conformal-field-theory, scaling",
"url": null
} |
Why linear maps act like matrix multiplication?
In Linear Algebra Done Right, it said
Suppose $$T \in \mathcal{L}(V,W)$$ and $$v \in V$$. Suppose $$v_1,...,v_n$$ is a basis of $$V$$ and $$w_1,...,w_m$$ is a basis of $$W$$. Then $$M(Tv) = M(T)M(v)$$
$$M(T)$$ is the m-by-n matrix whose entries $$A_{j,k}$$ are defined by $$Tv_k = A_{1,k}w_1 + ... + A_{m,k}w_m$$ suppose $$T \in \mathcal{L}(V,W)$$ and $$v_1,...,v_n$$ is a basis of $$V$$ and $$w_1,...,w_m$$ is a basis of $$W$$.
$$M(v)$$ is the matrix of vector $$v$$.
I generally follow the following proof:
Suppose $$v = c_1v_1 + ... + c_nv_n$$, where $$c_1,...,c_n \in \mathbb{F}$$. Thus $$Tv = c_1Tv_1 +...+c_nTv_n$$
Hence
$$$$\begin{split} M(Tv) &= c_1M(Tv_1) + ...+ c_nM(Tv_n)\\ & = c_1M(T)_{.,1} +...+c_nM(T)_{.,n} \\ & = M(T)M(v) \end{split}$$$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9609517050371972,
"lm_q1q2_score": 0.8049123299907117,
"lm_q2_score": 0.837619961306541,
"openwebmath_perplexity": 178.2968497715188,
"openwebmath_score": 0.9768139719963074,
"tags": null,
"url": "https://math.stackexchange.com/questions/3177868/why-linear-maps-act-like-matrix-multiplication/3177904"
} |
php, validation
I'm guessing you wanted it to be return $step;. I would write this as return 1; rather than create a variable that does not vary.
How to Improve
You are wanting to check a list of requirements. The data structure that resembles that is an array (which you have used already). The best things for processing arrays are loops because they avoid the cut and pasted code.
Here is what I would do (there are comments in it with further explanation):
$required = array();
// Build the requirements first.
switch ($properties['step'])
{
// Case statements without a break cause the processing to continue into the
// next case. Using this case 2 will add to the start of the array 'cid' and
// then will add 'cshort' before that.
case 2:
array_unshift($required, 'cid');
case 1:
array_unshift($required, 'cshort');
break;
default:
throw new DomainException('Step is not within the correct range');
}
$step = 0; | {
"domain": "codereview.stackexchange",
"id": 1642,
"lm_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, validation",
"url": null
} |
python, python-3.x, minesweeper
mines = create_mines(grid, lastcell, number_of_mines, size)
p = surrounding(grid, size)
p.number_of_surrounding(grid,size)
return (grid, mines)
Improve text handling
You do loads of string concatenation using +, which isn't really a good way to build strings. You are better off using string.format, and make patterns for entire lines at the time.
Here is an example on how to do this in show_grid(grid, size):
def show_grid(grid, size):
"""Print the full grid with headers and dividers."""
horizontal_line = ' -{}'.format('-----'*size)
ROW_PATTERN = ' {:>} | {} |'
print(' {}'.format(' '.join(string.ascii_uppercase[:size])))
print(horizontal_line)
# Write rows
for idx, gridrow in enumerate(grid, start=1):
print(ROW_PATTERN.format(idx, ' | '.join(gridrow)))
print(horizontal_line) | {
"domain": "codereview.stackexchange",
"id": 17206,
"lm_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, minesweeper",
"url": null
} |
meteorology, climate, planetary-science
If you are interested in the climate differences between separate planets, mass of the atmosphere does affect overall global temperature (e.g. more atmospheric mass = more heat trapping) but the mass itself is not the main driver of the dynamic changes of climate within an individual atmosphere. Really Mars and Venus don't have as much "short term" climate dynamics like Earth, because they don't have ocean/land dynamics. Though, they definitely have seasons. Earth's "short term" climate dynamics are driven by the heterogeneous distribution of land, ocean, and (to a smaller extent) clouds. | {
"domain": "earthscience.stackexchange",
"id": 177,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "meteorology, climate, planetary-science",
"url": null
} |
the radius of the circumscribed circle, By the diagonals and the angle between them, Through the diagonals and the angle between them, Through the sides and the angle between them, Total surface area of the regular pyramid across the height, Lateral surface area of the regular pyramid through the height, Lateral surface area of the regular pyramid through the apothem, Isosceles triangle, through side and height, Isosceles triangle, through side and angle. Calculate screen dimensions (height/width/area, in inches or cm) from diagonal measurement and aspect ratio. It is necessary to follow the next steps: A quadrilateral with four congruent angles is a rectangle. This makes squaring up any lay out a snap. d = √a2 + b2 d = a 2 + b 2. where a a and b b are the length and width of the rectangle, respectively. BYJU’S online diagonal matrix calculator tool makes the calculation faster, and it displays the result in a fraction of seconds. Angle Calculator and Carpenter's Square - Calculate | {
"domain": "motservicecentres.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9632305318133553,
"lm_q1q2_score": 0.8128655246466131,
"lm_q2_score": 0.8438950986284991,
"openwebmath_perplexity": 507.86432464731814,
"openwebmath_score": 0.6339654922485352,
"tags": null,
"url": "http://motservicecentres.com/0nbaez/diagonal-measurement-calculator-38f5a7"
} |
php, laravel
// methods...
}
Please also note in your code you wrote protected $filename; then referenced back to that in your methods as $this->fileName - make sure you get the n or N consistent.
You can always make a getter for the path attribute instead of making it public keep it protected.
public function getPath()
{
return $this->path;
}
Hope that helps! | {
"domain": "codereview.stackexchange",
"id": 13059,
"lm_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, laravel",
"url": null
} |
that is used to multiply two functions together. Integration is the operation of calculating the area between the curve of a function and the x-axis. Some special types of Integrals. Ron Larson + 1 other. j. Integration by Parts Formulas . Integration by parts intro. We also give a derivation of the integration by parts formula. Proving trigonometric identities worksheet. Integration Formula. Pioneermathematics.com provides Maths Formulas, Mathematics Formulas, Maths Coaching Classes. Quadratic equations word problems worksheet. 28. 2. One of the integration can be obtained from above formula and one from, $\int [f(x)]^n f^{‘} x dx = \frac { [f(x)]^{n+1}}{n +1 } , n \ne -1$, $\int \frac {px +q}{(x-a)(x-b)} dx =\int \left \{ \frac {A}{x-a} + \frac {B}{x-b} \right \} dx$, $\int \frac {px^2 +qx + r}{(x-a)(x-b)(x-c)} dx =\int \left \{ \frac {A}{x-a} + \frac {B}{x-b} + \frac {C}{x-c} \right \} dx$, $\int \frac {px +q}{(x-a)^2} dx =\int \left \{ \frac {A}{x-a} + \frac {B}{(x-a)^2} \right \} | {
"domain": "soccha.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9572778048911611,
"lm_q1q2_score": 0.8078420532109709,
"lm_q2_score": 0.8438951045175643,
"openwebmath_perplexity": 1057.0266456309087,
"openwebmath_score": 0.9344013929367065,
"tags": null,
"url": "http://soccha.com/q7ae2bx/special-integration-formula-eba13f"
} |
slam, navigation, rosbag, slam-gmapping, gmapping
Title: rosbag and real robots?
So I was using this tutorial to map out the floor in at my school. The map is beautiful.
http://www.ros.org/wiki/slam_gmapping/Tutorials/MappingFromLoggedData
However, once I am done with the bag file I want to use the map for the real robot. I have the robot end, where I plan on starting the robot in the future. Then I start the Segwary RMP driver and with the laser scan. First problem occurs gmapping (Note: It HAS NOT been restarted) will begin mapping in a completely different place.
So I hacked the driver and offset the coordinates by the ending coordinates in /map tf frame. Gmapping appears to get it correct at this point. But when I try to move 1 meter forward it will turn toward the wall and essentially run into it. However, I get the coordinates from goal generated by rviz. The other weird part is I have to subtract the map coordinates from the goal. (It has to be in terms of base link.) Not a huge issue but a weird one. | {
"domain": "robotics.stackexchange",
"id": 6715,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "slam, navigation, rosbag, slam-gmapping, gmapping",
"url": null
} |
python, performance, python-3.x, file
Always open files with a with block to ensure the file is closed properly.
I recommend using argparse because you get a lot of stuff for free (input type validations, help/usage message with -h, etc.).
I would move the command-line argument parsing logic out of FileSplitter, because it should ideally only have one responsibility: splitting files.
Specify the exact exception you want to handle with a try-except. Handling a bare except is considered a bad practice.
I wouldn't use sys.exit inside methods you might want to test, because it exits the Python interpreter.
In Python 3, f-strings are a much more legible way of doing string interpolation.
Before
new_file_name = "%s.%s" % (self.file_base_name, str(file_number))
After
new_file_name = f"{self.file_base_name}.{file_number}"
Refactored version
#!/usr/bin/env python3
import argparse
import gzip
import os
import itertools
from typing import BinaryIO, Iterator
CHUNK_SIZE = 4096 # bytes | {
"domain": "codereview.stackexchange",
"id": 40617,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, performance, python-3.x, file",
"url": null
} |
Your example is disconnected under all three of these notions. To prove this, it suffices to find two separating sets. Let $U_k$ be the open ball of $\frac12(1/k-1/(k+1))$ around $i/k$. The sets $U_k$ are pairwise disjoint and open. Letting $V=U_2\cup U_3\cup\dots$, then $U_1$ and $V$ separate $S$.
One final note: if you restrict your attention to open subsets of $\mathbb R^k$, then all three notions of connectedness are equivalent.
• Thank you so much sir... Mar 28 '18 at 14:26
• Sir, in definition of topological connected, isn't there must be, $U∩V∩S= ∅$ and $S=(U∩S)∪(V∩S)$? Mar 30 '18 at 4:01
• @AkashPatalwanshi The conditions you listed are equivalent to mine. Mar 30 '18 at 12:44
• Again thank you sir, for making it clear...:-) Mar 30 '18 at 12:46
• @AkashPatalwanshi No problem, have a good day :) Mar 30 '18 at 12:47 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9496693645535724,
"lm_q1q2_score": 0.8071915880801426,
"lm_q2_score": 0.8499711775577736,
"openwebmath_perplexity": 313.2772251259621,
"openwebmath_score": 0.7858211994171143,
"tags": null,
"url": "https://math.stackexchange.com/questions/2711767/connectedness-in-mathbbc"
} |
ros-kinetic, synchronization
on both ROS masters I get true.
But inside the simulations each of the sim_times are different. The simulation run at different speed. I think that what gives me trouble and that is what I need to synchronize.
Comment by gvdhoorn on 2019-05-29:
You'll need to make sure there is only a single Clock publisher in your entire network. Otherwise different nodes will use different time bases. That is not going to work.
I've not done this myself, but I assume you'll have to use MFKIE to sync the clock topic from one of the node graphs to the other.
Comment by gvdhoorn on 2019-05-29:
Tbh, I'm not quite sure why someone would want to use two masters and then MFKIE on the same machine, but you've most likely already concluded that it's necessary.
if you used a single master, there would be no problem here afaict.
Comment by kump on 2019-05-29: | {
"domain": "robotics.stackexchange",
"id": 33081,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros-kinetic, synchronization",
"url": null
} |
Bellman-Ford algorithm is used to find the shortest paths from a source vertex to all other vertices in a weighted graph. Distributed Exact Weighted All-Pairs Shortest Paths in O˜(n5/4) network is modeled by a weighted n-node m-edge graph G. There are already comprehensive network analysis packages in R, notably igraph and its tidyverse-compatible interface tidygraph. We revisit a classical graph-theoretic problem, the single-source shortest-path (SSSP) problem, in weighted unit-disk graphs. An interesting side-effect of traversing a graph in BFS order is the fact that, when we visit a particular node, we can easily find a path from the source node to the newly visited node with the least number of edges. The Symmetric Shortest-Path Table Routing Conjecture Thomas L. Question: Shortest Paths(int[0). Mizrahi et al. C++ Program to Generate a Random UnDirected Graph for a Given Number of Edges; Shortest Path in a Directed Acyclic Graph. Shortest Distance in a graph with two different | {
"domain": "chicweek.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.987758723627135,
"lm_q1q2_score": 0.8528226068102591,
"lm_q2_score": 0.8633916222765627,
"openwebmath_perplexity": 383.31142122654893,
"openwebmath_score": 0.5556688904762268,
"tags": null,
"url": "http://isxy.chicweek.it/number-of-shortest-paths-in-a-weighted-graph.html"
} |
complexity-theory, combinatorics, np-hard, boolean-algebra, counting
This problem seems like it might be hard (e.g., NP-hard), but I can not find anything similar in this list of NP-complete problems. I do realize that this is only small subset of NP complete problems.
Is there an efficient algorithm for this problem? Or, is it NP-hard, and if so, how can we prove that? The problem is NP-hard: in fact, it is #P-complete. Therefore, it is unlikely you'll be able to find an efficient solution for this problem. The proof is by reduction from #Monotone-SAT.
As Ricky Demer explains, without loss of generality we can take the "predefined set" to be equal to the union of all properties. (If the predefined set is larger than that, the answer to your problem is 0. If the predefined set is smaller than that, then we can remove all elements that mention a property not found in the predefined set, and we get a new problem instance with the desired property.) So let's focus only on this case. | {
"domain": "cs.stackexchange",
"id": 4909,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "complexity-theory, combinatorics, np-hard, boolean-algebra, counting",
"url": null
} |
As $$\sin \left({\theta}\right) \sim {\theta}$$ when $${\theta} \rightarrow 0$$ it follows that the limit is $$1/12$$.
• Shouldn't the limit be $1/12$? – Paramanand Singh Jan 19 at 21:50
• @ParamanandSingh I'm not infallible. Is there a mistake in the above? – Gribouillis Jan 19 at 21:51
• An easy way to check is using $g(x) =x$ – Paramanand Singh Jan 19 at 21:52
• @ParamanandSingh I think the mistake is corrected. I forgot $u^2$ in the inner integral. Thanks. – Gribouillis Jan 19 at 21:58
• Hello! Thanks for the answer, I have a few questions. what esnures us the existence of a function $h$ as described? In the last row, why did the integral bounds change from $x^2,x^3$ to $1,x$? And lastly, how and why are we allowed to used here the "~" symbol? – snatchysquid Jan 19 at 22:12 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9724147153749275,
"lm_q1q2_score": 0.8017189157661566,
"lm_q2_score": 0.824461932846258,
"openwebmath_perplexity": 641.6314433031124,
"openwebmath_score": 0.8747360706329346,
"tags": null,
"url": "https://math.stackexchange.com/questions/3991965/finding-the-limit-of-the-integral-of-an-unknown-function/3992105"
} |
python, beginner, algorithm, sorting, complexity
if n == 0:
return
for _ in range(n):
data = int(input("Enter the element to be inserted: "))
self.insert_at_end(data)
def display_list(self):
"""
Displays the list
"""
if self.start is None:
print(" Single linked list is empty!")
return
print(" Single linked list includes: ")
p = self.start
while p is not None:
print(p.info, " ", end=' ')
p = p.link
print()
def insert_in_beginning(self, data):
"""
Inserts an integer in the beginning of the linked list
"""
temp = Node(data)
temp.link = self.start
self.start = temp
def insert_at_end(self, data):
"""
Inserts an integer at the end of the linked list
"""
temp = Node(data)
if self.start is None:
self.start = temp
return | {
"domain": "codereview.stackexchange",
"id": 35746,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, beginner, algorithm, sorting, complexity",
"url": null
} |
Photos tagged with converse. To put the edges that we want to compare in a single triangle, we’ll draw a line from G to A. Conclusion: Angles A and B of triangle ABC are equal. $$\sim q\rightarrow \: \sim p$$ If two corresponding angles are congruent, then the two lines cut by the transversal must be parallel. Many times in geometry we see postulates and theorems that seem like they could become conditional statements and converse conditional statements: 1. We could also negate a converse statement, this is called a contrapositive statement: if a population do not consist of 50% women then the population do not consist of 50% men. d. counterexample. Converse : In Mathematical Geometry, a Converse is defined as the inverse of a conditional statement. Conditional statements drawn from an if-then statement. Inverse If a quadrilateral is not a rectangle, then it does not have two pairs of parallel sides. Progress % Practice Now. Applying Logic Statements to Geometry; Terms; Writing Help. | {
"domain": "gridserver.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9518632343454895,
"lm_q1q2_score": 0.8336294307528215,
"lm_q2_score": 0.8757869835428965,
"openwebmath_perplexity": 875.0929390351697,
"openwebmath_score": 0.35917341709136963,
"tags": null,
"url": "https://s116323.gridserver.com/the-twin-fmm/the-converse-in-geometry-2f0cf9"
} |
electric-circuits, electric-current, voltage, induction, electrical-engineering
$$
i_L(t) = i_0+\frac1{L}\int_{0}^t v_L\left(\bar t\right) d\bar t
$$
$v_L$ would be
$$
v_L(t) = V_{\rm bat} - Ri_L(t)
$$
in the on-phase and
$$
v_L(t) = - Ri_L(t)
$$
in the off-phase. Thereby, $V_{\rm bat}$ is the battery voltage and $R$ is the resistance of the coil. Sometimes one further decreases the voltage in the off-phase via diodes to get a faster discharge of the coil.
Specific for motor controllers one also has to account for the induction voltage caused by the motion of the rotor. (This is not regarded above.)
There are more refined kinds of PWM, so called full bridges that can also drive with
$$
v_L(t) = -V_{\rm bat}- Ri_L(t)
$$
in the off-phase.
See also the Wikipedia page for pulse-width modulation for resulting wave forms. | {
"domain": "physics.stackexchange",
"id": 48322,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electric-circuits, electric-current, voltage, induction, electrical-engineering",
"url": null
} |
hearing
Title: Do our ears or brains gradually adapt to noise pollution? Having lived in various places all over the world for the past 9 years of my life, one thing stood out to me throughout this time, and now in particular. From a quiet place on the countryside in Sweden, I moved to Manchester for my studies. When I first arrived there, I felt the city was very noisy, a feeling which gradually reduced as I presumably got used to the noise levels there. From Manchester I moved over to Saitama in Japan, an enormous city right next to Tokyo with a considerable amount of noise during the day, and buildings that have little to no sound insulation. With the exception of particularly loud noises, I again adapted to the sound levels in the country, which at the time, I felt was no more than a natural response in terms of how much attention we pay to the noise. If I'm distracted by work or other activities, I have little reason to dwell on the sounds of driving cars and talking people. | {
"domain": "biology.stackexchange",
"id": 9982,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "hearing",
"url": null
} |
# Is there any conjecture that has been proved to be solvable/provable but whose direct solution/proof is not yet known?
In mathematics, is there any conjecture about the existence of an object that was proven to exist but that has not been explicitly constructed to this day? Here object could be any mathematical object, such as a number, function, algorithm, or even proof.
It is known that there is an even integer $n\le246$ such that there are infinitely many primes $p$ such that the next prime is $p+n$, but there is no specific $n$ which has been proved to work (although everyone believes that every even $n\ge2$ actually works). | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9693241947446617,
"lm_q1q2_score": 0.8077617003365601,
"lm_q2_score": 0.8333246035907933,
"openwebmath_perplexity": 393.47694875719407,
"openwebmath_score": 0.7914952635765076,
"tags": null,
"url": "https://math.stackexchange.com/questions/2880738/is-there-any-conjecture-that-has-been-proved-to-be-solvable-provable-but-whose-d/2880895"
} |
waves, double-slit-experiment, interference, diffraction
There are programs to make shapes like this | {
"domain": "physics.stackexchange",
"id": 26131,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "waves, double-slit-experiment, interference, diffraction",
"url": null
} |
c, binary-search, number-guessing-game
high = 100;
low = 1;
while(response != 'Y')
{
guess = (high + low) / 2;
printf("Okay, let's start. Is it %d?\n", &guess);
printf("Please respond with L, H, or Y.\n");
scanf("%d", &response);
response = toupper(response);
switch(response)
{
case 72: high = guess - 1;
break;
case 76: low = guess + 1;
break;
case 89: printf("Yes! I knew I could do it.\n");
break;
default: printf("I didn't get that; you gave an invalid response.\n");
printf("Please try again.\n");
} | {
"domain": "codereview.stackexchange",
"id": 7106,
"lm_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, binary-search, number-guessing-game",
"url": null
} |
c++, algorithm, c++17, knapsack-problem
From these, I found the code by Bastian Rieck on his bin-packing GitHub repo, specifically the max_rest_pq function that uses a priority queue.
While it worked fine, I am not familiar with std::priority_queue, and likewise, it seemed only to store the size of each bin, not the contents of each bin. I chose to use pair size_t/size_t for asset-id/weight - I'm not so good at templates, but structs will probably be used in the deployed solution.
The novelty(?!)
Instead, I chose to replace Bastian's use of a std::priority_queue with a std::multimap, by exploiting its lower_bound() method (The map's key here represents space available, not size of current fill). Likewise, using extract()/insert() instead of pop()/push() found in std::priority_queue.
Why I asked this question.
While I may be an experienced programmer, I am not a good programmer. I'm looking to improve on the solution I wrote. | {
"domain": "codereview.stackexchange",
"id": 43681,
"lm_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++, algorithm, c++17, knapsack-problem",
"url": null
} |
c, unit-testing, cmake
edit:
I caught an error with my step General Observations
Caveats, I am a C and C++ programmer, I don't know python or Google tests at all. I also don't know much about astronomy or converting Gregorian dates to Julian dates.
While some compilers accept the .cc file extension for C++, a more common file extension for C++ is .cpp.
The tests should be written in 2 languages, neither one is C++. The unit tests should be written in C and integration tests should be written in python. There is no reason to use C++.
The tests are not complete, unit tests should include negative path testing as well as positive path testing. Negative path testing is where you force errors into the unit test to see what the code does, it is necessary for writing robust that won't fail when users do the wrong thing. Testing arrays of lengths 1 or 2 are also not enough, I would use at least a year, and possibly a decade as a test unit. This will also allow you to do performance testing.
Compiler Warnings | {
"domain": "codereview.stackexchange",
"id": 43526,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c, unit-testing, cmake",
"url": null
} |
Up to conjugation, $A$ is determined by its Jordan normal form. However, equivalent to JNF for a nilpotent matrix is the data $a_i'=\dim \ker A^i$ for all $i$. This is obviously an increasing sequence. Less obvious is that the sequence $(a_i)$ where $a_i=a'_i-a'_{i-1}$ is a decreasing sequence, and hence forms a partition of $\dim V$ where $A:V\to V$. We note that this data is equivalent to the data in JNF, as $a_i-a_{i+1}$ will be the number of Jordan blocks of size $i$. More explicitly, a jordan block of size $k$ corresponds to the partition $(1,1,1,1,1\ldots, 0,0,0,\ldots)$ with $k$ $1's$, and if a nilpotent matrix $A=\oplus A_i$ is written in block form where each block $A_i$ corresponds to a partition $\pi_i$, then $A$ corresponds to the partition $\pi=\sum \pi_i$, where the sum is taken termwise, e.g. $(2,1)+(1,1)+(7,4,2)=(10,6,2)$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9893474888461862,
"lm_q1q2_score": 0.8134307559490342,
"lm_q2_score": 0.822189134878876,
"openwebmath_perplexity": 122.7128136239268,
"openwebmath_score": 0.9598995447158813,
"tags": null,
"url": "http://math.stackexchange.com/questions/65227/square-root-of-a-matrix/65257"
} |
python, generator, graph, depth-first-search
Title: DFS algorithm with generators Background:
I was working on a project were I needed to write some rules for text-processing. After working on this project for a couple of days and implementing some rules, I realized I needed to determine the order of the rules. No problem; we have topological sorting to help. But then I realized that I can't expect the graph to always be full. So I came up with this idea, that given a single rule with a set of dependencies (or a single dependency) I need to check the dependencies of the dependencies. Sounds familiar? Yes. This subject is very similar to depth-first-search of a graph. I am not a mathematician, nor did I study C.S. Hence, Graph Theory is a new field for me. Nevertheless, I implemented something below which works (inefficiently, I suspect).
The code: | {
"domain": "codereview.stackexchange",
"id": 30226,
"lm_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, generator, graph, depth-first-search",
"url": null
} |
coordination-compounds, orbitals, transition-metals, crystal-field-theory
Find where the color of absorption lies. Then the color of the complex lies on the opposite side of the color of absorption.
This is a brief discussion about the colors of complexes. Let me know if you need more clarification. | {
"domain": "chemistry.stackexchange",
"id": 8295,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "coordination-compounds, orbitals, transition-metals, crystal-field-theory",
"url": null
} |
special-relativity, angular-momentum, earth, time-dilation, tidal-effect
This will have as a result that the coming to a halt of rotation will occur sooner than in the case if time didn't go faster by the diminishing velocities of the Earth's particles.
If the Earth's rotation is getting less, the time is not going faster and faster. It will go faster as the Earth's rotation decreases, but the rate of change in time decreases as the Earth's rotation approaches zero. When the rotation is zero, the Earth particles move through time at a maximum rate (again, ignoring gravity).
This means there is no cyclic process making time go faster and faster. The Earth's rotation will decrease a very little faster though, but this is too slow to make a noticeable difference for the duration of night and day. Night, as well as day, take the same amount of time in a rotating Earth and a non-rotating Earth (unless the Earth were spinning with an angular velocity close to the speed of light, in which case night and day wouldn't be visible and the Earth would be torn apart). | {
"domain": "physics.stackexchange",
"id": 69905,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "special-relativity, angular-momentum, earth, time-dilation, tidal-effect",
"url": null
} |
ros, python, script, deb
install(PROGRAMS
script/listener.py
script/talker.py
script/add_two_ints_client.py
script/add_two_ints_server.py
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
install(PROGRAMS
script/srv/_AddTwoInts.py
script/srv/init.py
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}/srv
)
The following code block which should be placed in the CMakeLists.txt will add launch folder and launch file in the deb installable file:
install(DIRECTORY launch/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch
PATTERN ".svn" EXCLUDE)
Then run the following command in the package folder to generate Debian source folder, my case is ~/ROS/catkin_workspace/src/beginner_tutorials:
$ bloom-generate rosdebian --os-name ubuntu --ros-distro kinetic
It creates Debian folder in the package folder. Then run the following command in the package folder to generate deb file:
$ fakeroot debian/rules binary | {
"domain": "robotics.stackexchange",
"id": 28518,
"lm_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, python, script, deb",
"url": null
} |
algorithm, c, raycasting
if (cub->window.bottom_wall >= cub->window.res_height)
cub->window.bottom_wall = cub->window.res_height - 1;
} Use the Doxygen language to document your functions
It looks like you use some ad-hoc way to document your functions. It's very good to add that documentation, but there are tools out there that make it even more useful, like Doxygen. Once you reformat your comments to follow the Doxygen syntax, you can then use the Doxygen tools to generate documentation in PDF, HTML and various other formats. It can also check whether your documentation is correct, for example whether you have documented all the parameters. It would have already found an error in the first functions: you mentino i in the description of the function arguments, but there is no such thing.
Pass integers by value
Why are you passing i by reference to calculate_sam()? You should just pass it by value, otherwise you pay for unnecessary dereferencing of the pointer.
Naming things | {
"domain": "codereview.stackexchange",
"id": 40640,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "algorithm, c, raycasting",
"url": null
} |
complexity-theory, time-complexity, polynomial-time, lower-bounds
Title: What is the difference between saying there is no ϵ>0 such that a problem can be solved in $O(n^{2-\epsilon})$ time and $n^{2-o(1)}$ or $\Omega(n^2)$? I have seen the formulations
there is no ϵ>0 such that a problem can be solved in $O(n^{2-\epsilon})$ time
a problem requires time $n^{2-o(1)}$
a problem requires time $\Omega(n^2)$ | {
"domain": "cs.stackexchange",
"id": 17030,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "complexity-theory, time-complexity, polynomial-time, lower-bounds",
"url": null
} |
java, beginner, game, template
import java.util.List;
public record MadLibsStory(
String title,
List<MadLibsPlaceholder> placeholders
) {}
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
// Class supplied to students. Shouldn't be modified.
public class MadLibsStoryBuilder {
private final Pattern placeholderPat = Pattern.compile(
"""
(?xs) # Enable these comments, dot matches newlines
(?<prefix> # Named capturing group
[^\\[\\]]* # As many non-brackets as possible
)
\\[ # Open bracket
(?<type> # Named capturing group
[^\\[\\]]* # As many non-brackets as possible
)
\\] # Close bracket
(?<suffix> # Named capturing group
[^\\[\\]]* # As many non-brackets as possible
)
"""); | {
"domain": "codereview.stackexchange",
"id": 43416,
"lm_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, game, template",
"url": null
} |
ruby
It's a little more obtuse in my opinion.
If you happen to be using Rails, I'd use the built-in helper:
def price_formatter(price)
number_to_currency(price)
end
There are more options to number_to_currency, but the default is the output you want. In fact you are just recreating it, so you could refactor your method away completely.
Note you need to add return if price.nil? to handle the nil case in all the above. | {
"domain": "codereview.stackexchange",
"id": 13647,
"lm_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",
"url": null
} |
c#, asp.net, asp.net-web-api, asp.net-mvc-5
{
// if client is chrome then return superproduct and use custom formatter for it
return new ContentNegotiationResult(formatter,
new MediaTypeHeaderValue("application/x.product")
);
}
else
{
return base.Negotiate(type, request, formatters);
}
}
} | {
"domain": "codereview.stackexchange",
"id": 16448,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, asp.net, asp.net-web-api, asp.net-mvc-5",
"url": null
} |
### Self-check
At the very start of the proof, did you say that you were switching to the contrapositive? Did you write out the contrapositive? In later math classes, you might have to be so explicit. We're making you do this now, because it's easy for beginners to get confused about the starting information and the desired conclusion for a contrapositive proof.
After you stated the contrapositive, did you declare your variables and your assumption that gcd(a,b)=13?
Did you declare the types of n and m (or whatever variable names you used) when they were introduced midway through the proof? The fact that they are integers is vital to making the rest of the proof work.
Did your proof end with the statement that 3a-5b cannot be equal to 27?
### Buggy proof 1
Proof: We'll prove the contrapositive of the claim. That is, for all integers a and b, if $$\gcd(a,b) = 13$$ then $$3a-5b \not = 27$$. | {
"domain": "illinois.edu",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.979354065042628,
"lm_q1q2_score": 0.8223968767581894,
"lm_q2_score": 0.8397339696776499,
"openwebmath_perplexity": 370.3821520119676,
"openwebmath_score": 0.8220126032829285,
"tags": null,
"url": "http://mfleck.cs.illinois.edu/study-problems/number-theory/number-theory-5-soly.html"
} |
javascript, stackexchange, chat, userscript
var show = onebox
.hide()
.before('<div class="onebox-toggle"><span>onebox:</span> <a href="'+href+'">'+href+'</a></div>')
.prev()
.find('span')
.click(() => onebox.toggle());
The var show = is completely unnecessary, because show isn't used. But more importantly, I don't like creating an object (the span element), losing it, and having to find it. I concede that this is a matter of style, but I'd prefer to create the span with its handler and then insert it into the div:
var span = $('<span>onebox:</span>').click(() => onebox.toggle());
var div = $('<div class="onebox-toggle"> <a href="'+href+'">'+href+'</a></div>')
.prepend(span);
onebox.hide().before(div);
or (IMO uglier)
onebox.hide().before(
$('<div class="onebox-toggle"> <a href="'+href+'">'+href+'</a></div>')
.prepend(
$('<span>onebox:</span>').click(() => onebox.toggle())
)
);
Compare | {
"domain": "codereview.stackexchange",
"id": 26287,
"lm_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, stackexchange, chat, userscript",
"url": null
} |
php, object-oriented, array, design-patterns, php7
/**
* When the factory method is used inside the Creator's business logic, the
* subclasses may alter the logic indirectly by returning different types of
* the item from the factory method.
*/
public function addItem(): int{
$item = $this->getBookShelfItem();
if (count(self::$bookShelfItems) < $this->bookShelfCapacity){
array_push(self::$bookShelfItems, $item);
end(self::$bookShelfItems);
return key(self::$bookShelfItems);
} else {
echo "The Bookshelf reach it's maximum capacity.\n";
return -1;
}
}
public function retrieveItem($itemIndex): void{
$instance = self::$bookShelfItems[$itemIndex];
$instance->getProductInfo();
} | {
"domain": "codereview.stackexchange",
"id": 41111,
"lm_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, array, design-patterns, php7",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.