text stringlengths 1 1.11k | source dict |
|---|---|
For a linear recurrence like the one here, this amounts to adding up the consecutive relations:
\require{cancel} \begin{align*} 2x_{n} &= \color{red}{\bcancel{x_{n-2}}} + \color{blue}{\cancel{x_{n-3}}} \\ 2x_{n-1} &= \color{blue}{\cancel{x_{n-3}}} + \color{green}{\cancel{x_{n-4}}} \\ \color{red}{\bcancel{2}}x_{n-2} &= \color{green}{\cancel{x_{n-4}}} + \cancel{x_{n-5}} \\ \color{blue}{\cancel{2x_{n-3}}} &= \cancel{x_{n-5}} + \cancel{x_{n-6}} \\ \color{green}{\cancel{2x_{n-4}}} &= \cancel{x_{n-6}} + \cancel{x_{n-7}} \\ \dots \\ \cancel{2x_7} &= \cancel{x_5} + \color{brown}{\cancel{x_4}} \\ \cancel{2x_6} &= \color{brown}{\cancel{x_4}} + x_3 \\ \cancel{2x_5} &= x_3 + x_2 \\ \color{brown}{\cancel{2x_4}} &= x_2 + x_1 \\ \hline \\2 x_n + 2x_{n-1}+x_{n-2} &= x_1 + 2x_2 + 2x_3 \end{align*}
Then, passing to the limit with $$\,x_n, x_{n-1}, x_{n-2} \to L\,$$ gives $$\,5L = x_1 + 2x_2 + 2x_3\,$$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9911526451784085,
"lm_q1q2_score": 0.8056755877605455,
"lm_q2_score": 0.8128673133042217,
"openwebmath_perplexity": 318.6225298487406,
"openwebmath_score": 0.9998005032539368,
"tags": null,
"url": "https://math.stackexchange.com/questions/4485083/limit-of-sequence-given-by-x-n-fracx-n-2x-n-32"
} |
quantum-algorithms, quantum-fourier-transform
Title: How to describe, or encode, the input vector x of Quantum Fourier Transform? Firstly, I'd like to specify my goal: to know why QFT runs exponentially faster than classical FFT.
I have read many tutorials about QFT (Quantum Fourier Transform), and this tutorial somehow explains something important between classical and quantum Fourier Transform.
Inside 1, it describes that:
The quantum Fourier transform is based on essentially the same idea with the only difference that the vectors x and y are state vectors (see formula 5.2, 5.3), | {
"domain": "quantumcomputing.stackexchange",
"id": 472,
"lm_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-algorithms, quantum-fourier-transform",
"url": null
} |
probability, noise, stochastic-processes
\frac{F_mf\partial_mg}{p^\text{eq}} - \frac{F_mfg\partial_m p^\text{eq}}{(p^\text{eq})^2} - \frac{\sigma_m^2\partial_m f\partial_mg}{2p^\text{eq}} + \frac{\sigma_m^2\partial_m f g\partial_m p^\text{eq}}{2(p^\text{eq})^2} $$
Subtracting from this the once-integrated-by-parts $(f, \mathbb{W}g)$, all the symmetric terms drop and we are left with (after multiplying by $p^\text{eq}$):
$$\left(F_a - \frac{\sigma_a^2\partial_a p^\text{eq}}{2p^\text{eq}}\right)(f\partial_ag - g\partial_af) +
\left(F_m - \frac{\sigma_m^2\partial_m p^\text{eq}}{2p^\text{eq}}\right) (f\partial_mg - g\partial_mf) = 0$$
Note that on the left we have stuff that just depends on $a$ and on the right things that depend on $m$. This is to say that each should be zero independent of the other. After straightforward manipulation, we arrive at the wanted result
$$\sigma_m^2\partial_m F_a = \sigma_a^2\partial_a F_m$$ | {
"domain": "physics.stackexchange",
"id": 20785,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "probability, noise, stochastic-processes",
"url": null
} |
Now let the unique function in the product be $g|_{Rng(f)}$ and define $g$ to be the union of these two.
Your intuition about the need for the axiom of choice is true for surjections, if $f$ was surjective then we only know that $f^{-1}[\{b\}]$ is non-empty for every $b\in B$, and we need the full power of the axiom of choice to ensure that an arbitrary surjection has an inverse function.
To the edited question:
The axiom of choice is needed because we have models in which the axiom of choice does not hold, where there exists an infinite family of pairs whose product is empty.
There are weaker forms from which follow choice principles for finite sets. However these are still not provable from ZF on its own.
As indicated by Chris Eagle in the comments, and as I remark above, in a product of singletons there is no need for the axiom of choice since there is only one way to choose from a singleton. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9825575162853136,
"lm_q1q2_score": 0.857131463280188,
"lm_q2_score": 0.8723473680407889,
"openwebmath_perplexity": 129.30781144029993,
"openwebmath_score": 0.8408396244049072,
"tags": null,
"url": "https://math.stackexchange.com/questions/132495/why-dont-you-need-the-axiom-of-choice-when-constructing-the-inverse-of-an-inj/132498"
} |
ros, opencv, video
Then recompile.
Hope this helps
Originally posted by Ivan Dryanovski with karma: 4954 on 2011-05-30
This answer was ACCEPTED on the original site
Post score: 0
Original comments
Comment by Pi Robot on 2011-05-30:
Thanks Ivan--that did the trick. Support for ffmpeg seems to have been turned off deliberately as I found here: https://code.ros.org/trac/ros-pkg/changeset/15321. I submitted a new ticket (https://code.ros.org/trac/ros-pkg/ticket/4980) to see if it can be turned back on.
--patrick
Comment by yuky on 2014-05-25:
Hi
My ROS vervion is hydro, and I cannot find the makefile. Could you tell me where is the Opencv's Makefile?
Thanks | {
"domain": "robotics.stackexchange",
"id": 5709,
"lm_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, opencv, video",
"url": null
} |
According to whether $n$ is even or odd, we have $$f_{n-1}f_{n+1} - f_nf_n = 1 \qquad \text{or} \qquad f_nf_n - f_{n-1}f_{n+1} = 1.$$
Now, the gcd of $f_n$ and $f_{n+1}$ may be defined alternatively and equivalently as the least positive integer that can be written in the form $pf_n + qf_{n+1}$ where $p$ and $q$ are integers. Because the coefficients of $f_n$ and $f_{n+1}$ in that pair of equations are Fibonacci numbers, hence integers, and because there is no positive integer less than $1$, gcd$(f_n, f_{n+1}) = 1$. Thus, any two consecutive terms of the Fibonacci sequence are relatively prime.
Another approach. suppose $gcd(f_{n+1}, f_{n}) = d$. Then since $f_{n+1} = f_n + f_{n-1}$, $gcd(f_n, f_{n-1}) \ne 1$ and by infinite descent we will end up with n = 4 and n = 3 where gcd(2,3) = 1. Contradiction. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9884918533088548,
"lm_q1q2_score": 0.8035127259846421,
"lm_q2_score": 0.8128673223709251,
"openwebmath_perplexity": 151.07935853294558,
"openwebmath_score": 0.9298673868179321,
"tags": null,
"url": "https://math.stackexchange.com/questions/24378/prove-that-any-two-consecutive-terms-of-the-fibonacci-sequence-are-relatively-pr"
} |
python, game, pygame
if MorS == "main":
if choice == 1:
choice = 3
elif choice == 2:
choice = 1
elif choice == 3:
choice = 2
elif MorS == "settings":
if Schoice == 1:
Schoice = 3
elif Schoice == 2:
Schoice = 1
elif Schoice == 3:
Schoice = 2
# Check if return is pressed
elif event.key == K_RETURN:
if MorS == "main":
if choice == 1:
singleplayer.play()
elif choice == 2:
MorS = "settings"
elif choice == 3:
pygame.quit()
sys.exit() | {
"domain": "codereview.stackexchange",
"id": 15615,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, game, pygame",
"url": null
} |
$x^2-25=0$
$(x-5)(x+5)=0$
$x-5=0$ or $x+5=0$
[tex]x=5[/itex] or $x=-5$
When you solve the equation by taking the square root (I should say roots), you have to remember that there are two of them.
5. Dec 15, 2005
### Fermat
More or less, yes.
6. Dec 16, 2005
### HallsofIvy
In general, an equation like x2= a has two solutions.
One is the square root of a: $\sqrt{a}$.
The other is the negative of the square root of a:$-\sqrt{a}$. | {
"domain": "physicsforums.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9793540668504082,
"lm_q1q2_score": 0.8203265235202583,
"lm_q2_score": 0.8376199694135332,
"openwebmath_perplexity": 1354.7775175967606,
"openwebmath_score": 0.7370999455451965,
"tags": null,
"url": "https://www.physicsforums.com/threads/another-simple-square-root-problem.104248/"
} |
text-generation
The model would recognize the most frequent patterns in an organized way and do the job.
It could work with sentences instead of paragraphs.
If the articles have very different sizes, you can use summarization for each of them to 10 sentences, and then apply the process described above.
Note: You can't do this with full reviews next to each other because the model would not recognize the beginning from the end for each of them.
https://huggingface.co/facebook/bart-large-cnn
Other models:
https://huggingface.co/models?pipeline_tag=summarization&sort=downloads | {
"domain": "datascience.stackexchange",
"id": 11104,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "text-generation",
"url": null
} |
Case 2-8, any other combination of polarity: $x=\{0|1\}+2a,$ $y=\{0|1\}+2b,$ $z=\{0|1\}+2c.$ These lead to polynomials with a factor of $2$ before all variables, and a constant as follows:
$[1+2a,0+2b,0+2c]:\; failure\; constant=1,\; vgcd=2$
$[0+2a,1+2b,0+2c]:\; failure\; constant=1,\; vgcd=2$
$[1+2a,1+2b,0+2c]:\; failure\; constant=3,\; vgcd=2$
$[0+2a,0+2b,1+2c]:\; failure\; constant=-1,\; vgcd=2$
$[1+2a,0+2b,1+2c]:\; failure\; constant=-3,\; vgcd=2$
$[0+2a,1+2b,1+2c]:\; failure\; constant=-1,\; vgcd=2$
$[1+2a,1+2b,1+2c]:\; failure\; constant=-1,\; vgcd=2$
These 7 combinations of polarities can never occur.
References
1. M. I. Krusemeyer, G. T. Gilbert, L. C. Larson, A Mathematical Orchard, MAA, 2012 | {
"domain": "cut-the-knot.org",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9884918492405834,
"lm_q1q2_score": 0.82373456410002,
"lm_q2_score": 0.8333245891029456,
"openwebmath_perplexity": 183.37566867675724,
"openwebmath_score": 0.8808542490005493,
"tags": null,
"url": "https://www.cut-the-knot.org/arithmetic/BasicsOfInfiniteDescent.shtml"
} |
python, performance, networking
manufacturer name though the use of netaddr library for each and every MAC address we find and wr_log() writes the MAC address, SSID name and manufacturer info in a log file. Your variable names are quite hard to make sense of. I had to read your explanatory text to figure out what vali was supposed to do; I still have no idea what obs means. Judging by the line print O+'[+]'+W+' Got first packet! Many more to go...\n', it also looks like you might have a variable called "O" (capital letter oh), which most style guides advise against because it's hard to distinguish it from 0 (the number zero). I would use longer, more descriptive names. Write out validation or valid_pairs instead of using vali. Write packet and packet_counter instead of p and pc. I could have written my first sentence as "ur vrbl nms r q hd 2 mk sns of", and you might have been able to understand it, but ovssly ts mch mr dfclt 2 ndrstnd if i wrt lk ths. Apply the same principle to your code. | {
"domain": "codereview.stackexchange",
"id": 13588,
"lm_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, networking",
"url": null
} |
def dfs(graph, visited, vertex, sorted_order):
if visited[vertex]:
return
for child in graph[vertex]:
dfs(graph, visited, child, sorted_order)
visited[vertex] = True
sorted_order.append(vertex)
def topological_sort(vertices, edge_list):
sorted_order = []
# # convert edge list to an adjacency list
for edge in edge_list:
visited = collections.defaultdict(bool)
for edge in edge_list:
sorted_order.reverse()
return sorted_order
# Course Schedule II
"""
Course Schedule II:
There are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1.
You are given an array prerequisites where prerequisites[i] = [ai, bi] indicates that you must take course bi first if you want to take course ai. | {
"domain": "paulonteri.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9736446471538803,
"lm_q1q2_score": 0.8216539436277485,
"lm_q2_score": 0.8438950966654774,
"openwebmath_perplexity": 2673.6699016621983,
"openwebmath_score": 0.21644490957260132,
"tags": null,
"url": "https://dsa.paulonteri.com/Data%20Structures%20and%20Algorithms%2016913c6fbd244de481b6b1705cbfa6be/_Patterns%20for%20Coding%20Questions%20e3f5361611c147ebb2fb3eff37a743fd/Trees%20%26%20Graphs%20%28Additional%20content%29%200fcf8228f7574bfc90076f33e9e274e0/Topological%20Sort%20%28for%20graphs%29%20e35d20a5223f4c50b4a73c0f71dc2c07.html"
} |
-
Ah sorry for being imprecise. Asking a question about something one is trying to understand sometimes is difficult. I did mean to ask "Which elements are present in all groups" to which the answer then would be, "The neutral element and for every element, its inverse". Now how do I translate this into a question in set theory? – Rudy the Reindeer Nov 5 '12 at 13:36
@Asaf: Are there any other sets which are guaranteed to be in $M$, in the sense of the second part of your answer? For example, does $M$ have a set whose members are precisely those sets in $M$ corresponding to the external finite ordinals? – Zhen Lin Nov 5 '12 at 14:25
@Zhen: Well, note that such set is always inductive. The existence of such set would imply that every model is an $\omega$-model, which is not true in general. – Asaf Karagila Nov 5 '12 at 14:29 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9693242009478239,
"lm_q1q2_score": 0.8238976306729613,
"lm_q2_score": 0.849971175657575,
"openwebmath_perplexity": 200.11891754944335,
"openwebmath_score": 0.9239818453788757,
"tags": null,
"url": "http://math.stackexchange.com/questions/229683/which-sets-are-present-in-every-model-of-zf/229691"
} |
fixed-point, floating-point
By Q8, I assume you mean unsigned Q0.8 (no integer bits, 8 fractional bits). In this format, there is no representation for the numbers $1.0$ or $1.5$. The largest value that an 8-bit unsigned integer can hold is $255$, which in this representation would correspond to a fixed-point value of $\frac{255}{256} = 0.9961$.
Similarly to the above, in signed Q0.7 format, there is no representation for $1.0$ or $1.5$. The largest 8-bit signed number is $127$, which would represent $\frac{127}{128} = 0.9922$.
You need to be explicit about whether your number is signed or unsigned. If you have a signed Q1.7 format, that would imply that your values are 9 bits long (1 sign bit, 1 integer bit, 7 fractional bits), which is unlikely. However, assuming that you had such a 9-bit signed number with 1 integer bit and 7 fractional bits, you can represent fixed-point numbers in the range $-2$ to $(2 - 2^{-7})$. | {
"domain": "dsp.stackexchange",
"id": 1168,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fixed-point, floating-point",
"url": null
} |
ros
* /dsr01a0509/move_group/planner_configs/SPARS/type: geometric::SPARS
* /dsr01a0509/move_group/planner_configs/SPARStwo/dense_delta_fraction: 0.001
* /dsr01a0509/move_group/planner_configs/SPARStwo/max_failures: 5000
* /dsr01a0509/move_group/planner_configs/SPARStwo/sparse_delta_fraction: 0.25
* /dsr01a0509/move_group/planner_configs/SPARStwo/stretch_factor: 3.0
* /dsr01a0509/move_group/planner_configs/SPARStwo/type: geometric::SPARStwo
* /dsr01a0509/move_group/planner_configs/STRIDE/degree: 16
* /dsr01a0509/move_group/planner_configs/STRIDE/estimated_dimension: 0.0
* /dsr01a0509/move_group/planner_configs/STRIDE/goal_bias: 0.05
* /dsr01a0509/move_group/planner_configs/STRIDE/max_degree: 18
* /dsr01a0509/move_group/planner_configs/STRIDE/max_pts_per_leaf: 6
* /dsr01a0509/move_group/planner_configs/STRIDE/min_degree: 12
* /dsr01a0509/move_group/planner_configs/STRIDE/min_valid_path_fraction: 0.2
* /dsr01a0509/move_group/planner_configs/STRIDE/range: 0.0 | {
"domain": "robotics.stackexchange",
"id": 38235,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros",
"url": null
} |
regular-languages, finite-automata
Matching leftmost and rightmost symbol 0, and removing them
0 1 0 0
R 0 0 0 0 0 0 R
R 1 0 R
Filling in the sides with fully red tiles
R
R R
R
Creating the bottom line in blue
R
R R
B
But this has nothing to do with finite state machines, as far as I can tell. | {
"domain": "cs.stackexchange",
"id": 3447,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "regular-languages, finite-automata",
"url": null
} |
to Tutors 1. Integration by Substitution : Edexcel Core Maths C4 January 2011 Q7 (c) : ExamSolutions - youtube Video. ; noun An authoritative, prescribed direction for conduct, especially one of the regulations governing procedure in a legislative body or a regulation observed by the players in a game, sport, or contest. 015 359 1 1 3. Area of a Trapezium formula = 1/2 * (a + b) * h, where a and b are the length of the parallel sides and h is the distance between them. Estimate the Area Under a ROC Curve. The area of a disk is half its circumference times its radius or the product of the constant π (the constant ratio of the circumference of a circle to its diameter), multiplied by the square of the radius of the circle. Two basic numerical integration methods, that is, the trapezoidal and Simpson's rule are applied to subsurface hydrocarbon reservoir volume calculation, where irregular anticline is approximated. Hence, formula will need more data points for each sub-area. Exercises 1. | {
"domain": "calcolailtuomutuo.it",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9865717420994768,
"lm_q1q2_score": 0.8405125581701728,
"lm_q2_score": 0.8519528000888386,
"openwebmath_perplexity": 744.3997072342853,
"openwebmath_score": 0.8069357872009277,
"tags": null,
"url": "http://calcolailtuomutuo.it/mmac/trapezoidal-rule-for-area-calculation.html"
} |
quantum-teleportation
$\rho = \frac 1 4 \begin{bmatrix} \alpha\alpha^* & \alpha\beta^* \\ \beta\alpha^* & \beta\beta^* \end{bmatrix}
+ \frac 1 4 \begin{bmatrix} \beta\beta^* & \beta\alpha^* \\ \alpha\beta^* & \alpha\alpha^* \end{bmatrix}
+ \frac 1 4 \begin{bmatrix} \alpha\alpha^* & -\alpha\beta^* \\ -\beta\alpha^* & \beta\beta^* \end{bmatrix}
+ \frac 1 4 \begin{bmatrix} \beta\beta^* & -\beta\alpha^* \\ -\alpha\beta^* & \alpha\alpha^* \end{bmatrix}$
Empirical Indistinguishability
As a very interesting aside, we can simplify this to:
$\rho = \frac 1 4 \begin{bmatrix} 2(\alpha\alpha^* + \beta\beta^*) & 0 \\ 0 & 2(\alpha\alpha^* + \beta\beta^*)) \end{bmatrix}$
Recall that qbits obey the 2-norm, so we have the identity $||\alpha||^2 + ||\beta^2|| = 1$ which is equivalent to $\alpha\alpha^* + \beta\beta^* = 1$; thus:
$\rho = \frac 1 4 \begin{bmatrix} 2(1) & 0 \\ 0 & 2(1) \end{bmatrix}
= \begin{bmatrix} 1/2 & 0 \\ 0 & 1/2 \end{bmatrix}$ | {
"domain": "physics.stackexchange",
"id": 51456,
"lm_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-teleportation",
"url": null
} |
ros, rosbridge, rosbridge-server
Comment by rtoris288 on 2013-11-25:
That was going to be my next suggestion. Make sure the message has all the correct fields or it might throw an excepting trying to access something that doesn't exist.
https://github.com/RobotWebTools/rosbridge_suite/blob/hydro-devel/rosbridge_server/scripts/rosbridge_websocket#L81-L83
Comment by trianta2 on 2013-11-25:
I'm currently printing all of the fields to console. An exception was thrown upon printing the time field, yet I'm not sure why. Still investigating...
Comment by rtoris288 on 2013-11-25:
What is your client sending in the time fields? It should be a number (make sure it's not being sent as a string or anything), in seconds.
Comment by trianta2 on 2013-11-25: | {
"domain": "robotics.stackexchange",
"id": 16259,
"lm_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, rosbridge, rosbridge-server",
"url": null
} |
slam, navigation, path, hector, action-server
QMainWindow State: | {
"domain": "robotics.stackexchange",
"id": 24709,
"lm_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, path, hector, action-server",
"url": null
} |
javascript, html, css, ecmascript-6, event-handling
transform: scale3d(1, 1, 1);
}
}
.main {
width: 100vw;
height: 100vh;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: flex-start;
color: white;
background-color: rgba(0, 0, 0, 0.65);
} | {
"domain": "codereview.stackexchange",
"id": 39624,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, html, css, ecmascript-6, event-handling",
"url": null
} |
the following set S of activities: (We call this the 0-1 knapsack problem. However, the situation is different to the general case of. • This strategy does not guarantee optimal solutions either. It is a problem in combinatorial optimization. to obtain the optimal solution of this problem an example of knapsack problem with 8. Knapsack problem is an OPTIMIZATION PROBLEM Dynamic programming approach to solve knapsack problem Step 1:. If there was partial credit that was proportional to the amount of work done (e. Why to use greedy algorithm? It's straightforward, easy to examine and easy to code. In this project we use Genetic Algorithms to solve the 0-1 Knapsack problem where one has to maximize the benefit of objects in a knapsack without exceeding its capacity. Knapsack Problem: Most commonly known by the name rucksack problem, is an everyday problem faced by many people. To solve the knapsack problem, construct the knapsack with 2n 2 /ε rows, and n columns. Since every solution that | {
"domain": "orsicycling.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9835969689263265,
"lm_q1q2_score": 0.8087027323801034,
"lm_q2_score": 0.8221891261650247,
"openwebmath_perplexity": 607.8602767137431,
"openwebmath_score": 0.5280691385269165,
"tags": null,
"url": "http://orsicycling.it/hhz/greedy-algorithm-knapsack-problem-with-example.html"
} |
c++, c++11, linked-list, reinventing-the-wheel
Title: Yet another doubly linked list (follow-up) I've integrated the feedback from my previous question "Yet another doubly linked list". In addition to that the list now uses the copy and swap idiom. It also has a very simple iterator to enable it to work with a ranged for loop.
So far everything works but I'm not very confident about this code. I would like some feedback specifically on whether the copy and swap idiom is employed correctly.
To keep it simple the iterator only implements the bare minimum required to traverse the list.
As more of a sidenote I'm also curious if this code is easy to read/has acceptable formatting or how to improve on those aspects.
Code:
#include <cstddef>
#include <initializer_list>
#include <iostream>
#include <utility> | {
"domain": "codereview.stackexchange",
"id": 30221,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, c++11, linked-list, reinventing-the-wheel",
"url": null
} |
quantum-mechanics, schroedinger-equation, scattering
Any solution of the Schrodinger equation with rotational invariance around the $z$ axis can be expanded as $$\psi_{k}=\Sigma_{l}A_{l}P_{l}(\cos \theta)R_{kl}(r),$$ where $R_{kl}(r)$ are the continuum radial functions associated with angular momentum $l$ satisfying
$$-\frac{1}{2M}\frac{1}{r^{2}}\frac{d}{dr}\big(r^{2}\frac{d}{dr}R_{kl}\big)+\big(\frac{l(l+1)}{r^{2}}+V(r)\big)R_{kl} = \frac{k^{2}}{2M}R_{kl}$$
The $R_{kl}(r)$ are real, and at infinity look like a spherical plane wave which we can choose to normalise as
$$R_{kl}(r) \rightarrow \frac{1}{r}\sin(kr-\frac{1}{2}l\pi+\delta_{l}(r))$$
where $\delta_{l}(r) << kr$ as $r \rightarrow \infty$. | {
"domain": "physics.stackexchange",
"id": 26569,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, schroedinger-equation, scattering",
"url": null
} |
ros, battery, turtlebot
Title: Turtlebot NUC battery state
Hi community,
I'd like to use the turtlebot with a more powerful NUCi5 instead of a poor netbook.
The NUC has no /proc/acpi/battery/BAT1
Is it possible to replace it with simply setting:
export TURTLEBOT_BATTERY=/var/tmp/battery/BAT1
and write my own file for battery simulation/fake ?
Later I'd like to fill-up the content with real data from an attached external USB-ADC-Modul.
Which parameters/values are neccessary to make default turtlebot happy with the fake-setup ?
Any suggestions ?
Thanks for some feedback
Cheers
Christian
Originally posted by ChriMo on ROS Answers with karma: 476 on 2017-01-04
Post score: 1
If you'd like to setup a way to generate a battery status that would be interesting. Note that we've recently added support to disable the battery monitoring too: https://github.com/turtlebot/turtlebot/blob/kinetic/turtlebot_bringup/launch/minimal.launch#L21 | {
"domain": "robotics.stackexchange",
"id": 26639,
"lm_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, battery, turtlebot",
"url": null
} |
quantum-gate, mathematics, simulation
Title: How to generate a SWAP of $N$ qubits? I know that SWAP2 (swaps 2 qubits) gate looks like:
$$
SWAP2=\begin{bmatrix}
1 & 0 & 0 & 0 \\
0 & 0 & 1 & 0 \\
0 & 1 & 0 & 0 \\
0 & 0 & 0 & 1
\end{bmatrix}
$$
and SWAP3 gate looks like
$$
SWAP3=\begin{bmatrix}
1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\
0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 \\
0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\
0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\
\end{bmatrix}
$$
The question is, how do I generate SWAP of N qubits, SWAPN?
I need this for my Fourier transform algorithm. "SWAPN" isn't something that would be universally understood. But you say you want it for your Fourier Transform algorithm, so by that, I interpret that what you want is: SWAP2(1,N).SWAP2(2,N-1).SWAP2(3,N-2)...., i.e. the pairwise swap between opposite qubits. | {
"domain": "quantumcomputing.stackexchange",
"id": 1134,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-gate, mathematics, simulation",
"url": null
} |
sorting, vba, collections, binary-search
Title: UniqueList Class in VBA I often find myself abusing dictionary objects just for the exist method like this,
For Each x in Something
If Not dict.Exists(x) Then dict.Add x, False
Next x | {
"domain": "codereview.stackexchange",
"id": 9197,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "sorting, vba, collections, binary-search",
"url": null
} |
botany, terminology
I'll note that I haven't found evidence of plants being referred to in this specific manner, but read the example papers below for use of the related phrases "thermohalophyte vegetation" and "thermohalophytes", respectively:
Accogli, R., Nutricati, E., Famà, L., Medagli, P., Manno, D., De Bellis, L., Marchiori, S. and Colasante, M., 2008. Iris revoluta Colas., natural hybrid origin species: characterization and preservation problems. Plant Biosystems, 142(1), pp.162-165.
Vekhov, N.V., 1996. Thermal and freshwater springs of the Chukchi Peninsula: Unique subarctic ecosystems. Part ii. flora. Polar Geography, 20(3), pp.209-220.
Is this word-blending approach the best or most appropriate? I Couldn't say; but there is certainly prior precedence for combining the habit adjectives into "thermohalo-". | {
"domain": "biology.stackexchange",
"id": 10322,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "botany, terminology",
"url": null
} |
fourier-transform, time-frequency
I am aware that the time localization information is still contained in the phase part of the FT but if this is the case then what do we really need the time-frequency representations for? Is it just to easily extract this information since it's so hard doing it using the phase of the FT?
Any thoughts on that would be appreciated. What a tricky question to overlook. Indeed I'm one of those who would immedieately press that Fourier transforms do lose time localization of the events as the comments stated. Yet it's certainly (mathematically and practically) true that any (transformable) signal waveform is exactly preserved under this reversible transform including all of its time distribution information as well. Your example of the reversed chirp case clearly demonstrates this. This needs an answer. At least to clarify why then there is the well accepted idea that FT do not preserve time localization of events? | {
"domain": "dsp.stackexchange",
"id": 5209,
"lm_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, time-frequency",
"url": null
} |
c#, xaml
private void cycleThroughColumnsLeftOverAsync(Grid anyGrid, int anyStartingColumn, double anyGLValue, int anyVertStart, int anyVertEnd){
for (int index = 0; index < anyVertStart; index++)
{
if (anyGrid.Children[index] as Grid != null)
{
(anyGrid.Children[index] as Grid).ColumnDefinitions[anyStartingColumn].Width = new GridLength(anyGLValue);
}
else
{
break;
}
}
for (int index = anyVertEnd; index < anyGrid.Children.Count; index++)
{
if (anyGrid.Children[index] as Grid != null)
{
(anyGrid.Children[index] as Grid).ColumnDefinitions[anyStartingColumn].Width = new GridLength(anyGLValue);
}
else
{
break;
}
}
} | {
"domain": "codereview.stackexchange",
"id": 4403,
"lm_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#, xaml",
"url": null
} |
• Personally, I would take $-(k\vec{v})$ to be the additive inverse of $k\vec{v}$, and I would write the scalar multiple as $(-1)(k\vec{v})$. Of course, these are equal, so in reality, I never write either of these expressions, but simply write $-k\vec{v}$, and don't worry about which interpretation it has. Mar 14 '20 at 17:39
• Basically you have $\vec{v}$ and its inverse $-\vec{v}$. Than you have $k \vec{v}$ and you prove that $(-k) \vec{v}= - (k \vec{v})$. Mar 14 '20 at 18:01 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9752018369215508,
"lm_q1q2_score": 0.8105322290554394,
"lm_q2_score": 0.8311430499496095,
"openwebmath_perplexity": 234.46736054836194,
"openwebmath_score": 0.9032891392707825,
"tags": null,
"url": "https://math.stackexchange.com/questions/3580929/k-vecv-vs-k-vecv-for-k-in-mathbbr-and-vecv-in-mathbbs/3581030"
} |
quantum-mechanics, special-relativity, angular-momentum, dirac-equation, dirac-matrices
EDIT I got a hint. The Dirac equation derivation involves taking the square root of the :
$$-\frac{d^2}{dt^2}+\frac{d^2}{dx^2}+\frac{d^2}{dy^2}+\frac{d^2}{dz^2}$$
So basically the minkowski metric signature. Lorentz transformations leave the minkowski metric unchanged. The generators of Lorentz transforms are $J_x$, $J_y$, $J_z$ and whatever $J$ is for boost.
I believe this hint gets us closer to the connection. The Pauli matrices (more precisely, the first two) and the 4-dimensional $\gamma$-matrices are both manifestations of the general concept of a Clifford algebra. The Pauli matrices are a specific choice of representation for a Clifford algebra in two dimensions, the $\gamma$-matrices form a 4-dimensional Clifford algebra, and in the "chiral basis" these 4d matrices look just like a bunch of Pauli matrices inside a larger matrix. | {
"domain": "physics.stackexchange",
"id": 86661,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, special-relativity, angular-momentum, dirac-equation, dirac-matrices",
"url": null
} |
python, performance, homework, numpy, neural-network
# Normalize
dataset_large["data"] = dataset_large["data"]/255
validation_large["data"] = validation_large["data"]/255
print("large dataset data: {}".format(dataset_large["data"].shape))
print("large dataset labels: {}".format(dataset_large["labels"].shape))
print("large validation set data: {}".format(validation_large["data"].shape))
print("large validation set labels: {}".format(validation_large["labels"].shape))
def softmax(s):
numerator = np.exp(s)
denominator = np.matmul(np.ones(10).T, np.exp(s))
return numerator/denominator
def relu(s1):
h = np.maximum(np.zeros_like(s1), s1)
return h
def layer_1(X, W1, b1):
# WARNING: X must have shape (3072, n)
# W1 must have shape (3072, 3072)
# b1 must have shape (3072, 1)
# s will get shape (10, n)
# Return p with shape (10, n)
if not X.shape[0] == n_input:
raise ValueError("Got wrong shape of s1: {}".format(X.shape))
s1 = np.matmul(W1, X) + b1 | {
"domain": "codereview.stackexchange",
"id": 30225,
"lm_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, homework, numpy, neural-network",
"url": null
} |
cc.complexity-theory, ds.algorithms, sorting
To make a 'random' distribution, we can randomly use $\mathrm{Compare}(A,B)$ with $P(A < B)≈0.5$, except that with the initial $I_A$ all identical, we do not expect randomization at a sublogarithmic depth (i.e. with $I_A$ long enough). However, I conjecture that we get randomization at a sublogarithmic depth using generalizations (probably any reasonable choice will work) of $\mathrm{Compare}$ to $k=ω(1)$ elements: If we keep $k=ω(1)$ elements entangled (i.e. connected using comparison results), we should have about $k$ noncommuting choices for each comparison with $S$. This should allow $O(\log_k n + \log k)$ randomization depth, as desired (assuming that $k$ is not too large as we need depth $Θ(\log k)$ to distentangle the elements). I expect that the compute can be made quasilinear if using a small enough $k$. | {
"domain": "cstheory.stackexchange",
"id": 4451,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "cc.complexity-theory, ds.algorithms, sorting",
"url": null
} |
graph-states, stabilizer-state
\end{array}\right.
$$
Thus, every $|\Psi_x\rangle$ is an eigenstate of every stabilizer, and with a different pattern of $\pm 1$ eigenvalues (and must therefore be mutually orthogonal).
While it must be the case that the different states $|\Psi_x\rangle$ are orthogonal, I think it's useful to think about this in terms of the way that the graph states are created. Remember that $|\psi\rangle$ is created from qubits in the $|+\rangle$ state and then have controlled-phase gates applied between them. Now, if I evaluate $\langle\Psi_y|\Psi_x\rangle$, think of this as a calculation
$$
\langle+|^{\otimes n}CP\cdot Z_{x\oplus y}\cdot CP|+\rangle^{\otimes n}
$$
where $CP$ represents the collection of controlled phase gates. Pauli $Z$ commutes with controlled phase, which means we can bring the two CPs together and annihilate them, leaving behind
$$
\langle+|^{\otimes n} Z_{x\oplus y}|+\rangle^{\otimes n}.
$$ | {
"domain": "quantumcomputing.stackexchange",
"id": 1358,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "graph-states, stabilizer-state",
"url": null
} |
redox, terminology
No. $\ce{CuO}$ is the oxidizing agent (the thing that causes something else to be oxidized) because the $\ce{Cu}$ is reduced (gains electrons, going from oxidation state $+2$ to $0$) in the course of oxidizing the nitrogen of $\ce{NH3}$, which loses electrons and goes from oxidation state $-3$ to $0$.
Conversely, $\ce{NH3}$ is the reducing agent here, because it causes something else to be reduced (here, the $\ce{Cu}$) and loses electrons in the process.
What happens for a compound $\ce{AB}$ where $\ce A$ gets oxidised and $\ce B$ gets reduced?
If only the species $\ce{AB}$ is involved, or in the case where two of the same species $\ce A$ react to form both oxidized and reduced products:
$$
\ce{2A -> Ox + Red}
$$
the reaction is called disproportionation.
Do I call the compound $\ce{AB}$ a reducing agent if the net change in oxidation number (between the two elements $\ce A$ and $\ce B$) is negative? | {
"domain": "chemistry.stackexchange",
"id": 11269,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "redox, terminology",
"url": null
} |
objective-c, modules, lua
NSString *outputNS = [NSString string];
for (int i = numberOfResults; i > 0; i--) {
outputNS = [outputNS stringByAppendingFormat:@"%s ", lua_tostring(luaStack, -1 * i)];
}
lua_pop(luaStack, numberOfResults); //remove all results from the stack
output.text = [output.text stringByAppendingFormat:@"%@\n", outputNS];
}
}
#pragma mark - Boilerplate Setup Code
- (BOOL)shouldAutorotate {
return YES;
}
- (NSUInteger)supportedInterfaceOrientations {
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
return UIInterfaceOrientationMaskAllButUpsideDown;
} else {
return UIInterfaceOrientationMaskAll;
}
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
- (void)dealloc {
lua_close(luaStack);
}
@end
Here are two example scripts:
testscript01.lua
repair = function(amount)
return amount * 10
end
testscript02.lua
mymodule = {} | {
"domain": "codereview.stackexchange",
"id": 8998,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "objective-c, modules, lua",
"url": null
} |
scheduling
Naval Research Logistics Quarterly seems to be a Wiley pay-walled journal, but my library has a subscription to it. Johnson's paper begins:
Let us consider a typical multistage problem formulated in the following terms by R. Bellman:
"There are n items which must go through one production stage or machine and then a second one. There is only one machine for each stage. At most one item can be on a machine at a given time.
"Consider $2n$ constants $A_i, B_i, i = 1, 2, \cdots, n$. These are positive but otherwise arbitrary. Let $A_i$ be the setup time plus work time of the $i$th item on the first machine, and $B_i$ the corresponding time on the second machine. We seek the optimal schedule of items in order to minimize the total elapsed time."
He doesn't give the full reference to Bellman. Johnson's paper extends the definition in the obvious way to 3 machines. | {
"domain": "cs.stackexchange",
"id": 6714,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "scheduling",
"url": null
} |
×
# Elementary Techniques used in the IMO (International Mathematical Olympiad) - Cauchy Schwarz Inequality
If people asked you, what is the most elementary inequality you know? I bet your answer would be AM-GM. But in this series of posts I will try to show you the power that Cauchy Schwarz has over that of AM-GM. But as an introduction, let us first state and prove the theorem.
Cauchy Schwarz Inequality: Let $$(a_1, a_2, \ldots , a_n)$$ and $$(b_1, b_2, \ldots, b_n)$$ be two sequences of real numbers, then we have:
$$(a_1^2 + a_2^2 + \ldots + a_n^2)(b_1^2 + b_2^2 + \ldots + b_n^2) \geq (a_1b_1 + a_2b_2 + \ldots + a_nb_n)^2$$
In particular, equality holds iff there exists $$k \in \mathbb{R}$$ for which $$a_i = k b_i$$ for $$i = {1, \ldots, n}$$.
Proof: We will present $$2$$ proofs, one originating from analysis on the equality case, the other by wishful thinking on small cases of $$n = 2,3$$.
(i) Consider defining the following function $$f$$: | {
"domain": "brilliant.org",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9850429151632047,
"lm_q1q2_score": 0.8540674323862745,
"lm_q2_score": 0.8670357598021707,
"openwebmath_perplexity": 692.9916151993567,
"openwebmath_score": 0.9441800713539124,
"tags": null,
"url": "https://brilliant.org/discussions/thread/elementary-techniques-used-in-the-imo-internatio-V/"
} |
python, parsing, file, console
def chunks (arr, size = 1):
return [arr[i: i+size] for i in range(0, len(arr), size)]
def lmap (func, iterable):
return list(map(func, iterable))
hex_digits_chunks = chunks(lmap(hexa, range(16)), 4)
printable_ascii = lmap(ord, string.digits + string.ascii_letters + string.punctuation)
hexview.py
from gen import *
class HexViewer ():
def __init__ (self, file):
self.data = open(file, 'rb').read()
self.hex_data = lmap(hexa, self.data)
self.hex_chunks = chunks(chunks(self.hex_data, 4), 4)
self.ascii_data = [(chr(int(byte, 16)) if int(byte, 16) in printable_ascii else '.') for byte in self.hex_data]
self.ascii_chunks = chunks(self.ascii_data, 16)
self.rows = len(self.hex_chunks)
self.addresses = lmap(lambda o: hexa(o * 16, 8), range(0, self.rows))
def __str__ (self):
table_format = ' {:<15}{:<60}{:<20}\n'
str_rep = '' | {
"domain": "codereview.stackexchange",
"id": 22948,
"lm_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, parsing, file, console",
"url": null
} |
homework-and-exercises, differentiation, vector-fields, dirac-delta-distributions
But first I also have to correct a misconception (you may not have it but many students do): the divergence of $\hat r/r^2$ is not $4\pi \delta(r)$. It is, rather, $4\pi ~\delta_3\big(\vec r\big).$ This is a 3D Dirac $\delta$-function which looks for whether a volume includes the origin point $\vec 0$ in it, so we can write this in Cartesian coordinates as $\delta(x)~\delta(y)~\delta(z)$. This is distinct from the 1D Dirac $\delta$ function applied to the spherical coordinate $r$, $\delta(r).$ For one reason why this matters, it matters because we have a mathematical ambiguity about what $\int_0^X dx~\delta(x)$ should be, should it be 0 or 1 or maybe $1/2$ in between? The starting point of the integral is not clear on whether it contains that point at $x=0$ completely or halfway or not at all. And this is important here because all of our radial integrals start at 0 so if you choose $1/2$ as a nice intermediary then you would find that because the angular integral gives you $4\pi$ of | {
"domain": "physics.stackexchange",
"id": 56588,
"lm_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, differentiation, vector-fields, dirac-delta-distributions",
"url": null
} |
navigation, ros-kinetic, costmap, jackal, move-base
yaw_goal_tolerance: 0.3
xy_goal_tolerance: 0.35
latch_xy_goal_tolerance: false
sim_time: 4.0
sim_granularity: 0.02
angular_sim_granularity: 0.03
vx_samples: 30
vtheta_samples: 30
controller_frequency: 20.0
meter_scoring: true
occdist_scale: 0.1
pdist_scale: 0.4
gdist_scale: 0.6
heading_lookahead: 1.0
heading_scoring: false
heading_scoring_timestep: 1.8
dwa: true
simple_attractor: false
publish_cost_grid_pc: true
oscillation_reset_dist: 0.4
escape_reset_dist: 0.0
escape_reset_theta: 0.4 | {
"domain": "robotics.stackexchange",
"id": 31568,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "navigation, ros-kinetic, costmap, jackal, move-base",
"url": null
} |
newtonian-mechanics, speed-of-light, collision, faster-than-light, shock-waves
Title: Newton's cradle faster than light? If we have a Newton's cradle toy where the balls actually touch each other. Can energy be transferred from the first ball to the last one faster than the speed of light? And what factors control the energy flow in such case? Any energy transfer from collisions between the balls won't be transferred faster than light. It will be transferred at the speed of sound within the metal, which is much, much slower than the speed of light. For example, for solid steel balls, the speed of sound is roughly 5900 m/s, so a collision at one end of a 5-cm-long chain of steel balls will take around 8 microseconds to propagate to the other end - detectable with advanced high-speed cameras. | {
"domain": "physics.stackexchange",
"id": 61119,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "newtonian-mechanics, speed-of-light, collision, faster-than-light, shock-waves",
"url": null
} |
because that is where the denominator of the fraction equals 0 which is undefined. *Restrictions apply. 1 What is the integral Z ∞ 1 1 x2 dx ? Since the anti-derivative is −1/x. Mar 31, 2020 #1 Good morning everyone. Improper integral definition is - a definite integral whose region of integration is unbounded or includes a point at which the integrand is undefined or tends to infinity. The definite integral of a function is closely related to the antiderivative and indefinite integral of a function. Trench Andrew G. The Euler Integral of the second kind is also known as gamma function. Consider the function on [0,1]. WeBWorK has been upgraded to version 2. The lesson explains in an easy to follow manner that In mathematical analysis, an improper integral is the limit of a definite integral as an endpoint of the interval(s) of integration approaches either a specified real number, ∞ , − ∞ , or in some instances as both endpoints approach limits. This is a description. Improper | {
"domain": "wind4us.it",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9899864296722662,
"lm_q1q2_score": 0.8116832763331256,
"lm_q2_score": 0.8198933359135361,
"openwebmath_perplexity": 482.0014043585325,
"openwebmath_score": 0.9617266654968262,
"tags": null,
"url": "http://pvod.wind4us.it/improper-integral.html"
} |
homework-and-exercises, newtonian-mechanics, forces, free-body-diagram
The simpler assumption is that the bracket is rigidly attached and can transfer any force from the axis to the holding object. You can see that this bracket will hold the axis in one position regardless of the angle that the rope makes.
But if it's not rigidly attached, it will simply pivot so that the force vector necessary is along the attachment point.
These pulleys are not rigidly attached, but when the forces are static, it doesn't matter because they move to a position that opposes all forces from the rope.
Both assumptions yield the same solution. | {
"domain": "physics.stackexchange",
"id": 22791,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises, newtonian-mechanics, forces, free-body-diagram",
"url": null
} |
javascript, performance
// If REMOVED is loaded, we will check if there is an REMOVED link.
function doesREMOVEDExist() {
iimDisplay('Checking if an REMOVED link is on page.');
var link = iimPlay('CODE: SET !TIMEOUT_TAG 1\n'
+ 'TAG POS=1 TYPE=A ATTR=TXT:REMOVED');
if (link !==1) {
return false;
}
return EANFCheck(2);
}
// We will check if the REMOVED was already REMOVEDed.
function checkREMOVED() {
iimDisplay('Checking if REMOVED if valid.');
var link = iimPlay('CODE: SET !TIMEOUT_TAG 1\n'
+ 'TAG POS=1 TYPE=DIV ATTR=TXT:An<SP>error<SP>occurred:');
if (link !==1) {
return false;
}
return EANFCheck(2);
} | {
"domain": "codereview.stackexchange",
"id": 8970,
"lm_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, performance",
"url": null
} |
waves, acoustics, speed, dispersion
We find that at low ultrasonic frequencies the arrival velocity of
ultrasonic pulse, in such a material, increases with the grain size.
At the high ultrasonic frequencies a decrease of the pulse velocity
with frequency and grain size is observed. | {
"domain": "physics.stackexchange",
"id": 44221,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "waves, acoustics, speed, dispersion",
"url": null
} |
c#, beginner, object-oriented, csv, role-playing-game
Then we'll take your parsing:
public Player GetHiscore(string name)
{
WebRequest _request = HttpWebRequest.Create(string.Format("http://services.runescape.com/m=hiscore/index_lite.ws?player={0}", name));
_request.Proxy = null;
_request.AuthenticationLevel = AuthenticationLevel.None; | {
"domain": "codereview.stackexchange",
"id": 23955,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, beginner, object-oriented, csv, role-playing-game",
"url": null
} |
quantum-information, terminology, quantum-computer
$$ P E_i^\dagger E_j P = 1\hspace{-3pt}\mathrm{l}_A \otimes g^{ij}_B.$$
You can interpret this condition as saying that no error process associated to the channel $\mathcal{E}$ can gain any information about subsystem $A$.
Consider error channels which consist of Kraus operators that, when expanded in the Pauli basis, only have support on at most $d$ of the $n$ qubits in our Hilbert space. If every such channel is correctable for subsystem $A$, then we say our code has distance $d$. The largest such $d$ is called the distance of the code. For the toric code, this is the linear size of the lattice. | {
"domain": "physics.stackexchange",
"id": 70247,
"lm_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-information, terminology, quantum-computer",
"url": null
} |
special-relativity, fluid-dynamics, tensor-calculus
Title: Tensor derivative in special relativity and fluid mechanics I’m working through Special Relativity by V. Faraoni, and am puzzled by something in his chapters on tensors. He tells us that the partial derivative of a tensor field, e.g. $T_{\alpha, \gamma}$, is not a tensor, because
\begin{align*}\frac{\partial T_{\alpha'}}{\partial x^{\gamma'}} &= \frac{\partial x^{\delta}}{\partial x^{\gamma'}}\frac{\partial}{\partial x^{\delta}}\left[\frac{\partial x^{\nu}}{\partial x^{\alpha'}}T_{\nu}\right]\\
&= \frac{\partial x^\delta}{\partial x^{\gamma'}}\left[\frac{\partial}{\partial x^{\delta}}\left(\frac{\partial x^{\nu}}{\partial x^{\alpha'}}\right)\right]T_{\nu} + \frac{\partial x^{\delta}}{\partial x^{\gamma'}}\frac{\partial x^{\nu}}{\partial x^{\alpha'}}\frac{\partial T_{\nu}}{\partial x^{\delta}},
\end{align*} | {
"domain": "physics.stackexchange",
"id": 67942,
"lm_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, fluid-dynamics, tensor-calculus",
"url": null
} |
c#, winforms, event-handling
namespace MyTestConsole
{
/// <summary>
/// Handles System.Windows.Forms.WebBrowser DocumentCompleted event handlers
/// </summary>
/// <remarks>
///
/// Part of code borrowed from
/// http://stackoverflow.com/questions/3783267/how-to-get-a-delegate-object-from-an-eventinfo
/// by
/// http://stackoverflow.com/users/259769/enigmativity
///
/// Needs refactoring, any is very welcome.
///
/// </remarks>
public class WebBrowserDocumentCompletedEventHandlersKeeper
{
private const string EVENT_NAME = "DocumentCompleted";
private System.Windows.Forms.WebBrowser _webBrowser;
public WebBrowserDocumentCompletedEventHandlersKeeper(System.Windows.Forms.WebBrowser webBrowser)
{
_webBrowser = webBrowser;
} | {
"domain": "codereview.stackexchange",
"id": 16476,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, winforms, event-handling",
"url": null
} |
which is trivially solvable with $x_1 = \cdots = x_m = 0$ and $w = 1$.
If you allow coefficients for the new variables, you can always achieve this with one extra variable. Indeed, given the system $$a_{11}x_{1} + a_{12}x_{2} +\cdots + a_{1n}x_{n} = b_1 \\ a_{21}x_{1} + a_{22}x_{2} +\cdots + a_{2n}x_{n} = b_2\\ ...\\ a_{m1}x_{1} + a_{m2}x_{2} +\cdots + a_{mn}x_{n} = b_m\\$$ the new system $$a_{11}x_{1} + a_{12}x_{2} +\cdots + a_{1n}x_{n}+b_1w = b_1 \\ a_{21}x_{1} + a_{22}x_{2} +\cdots + a_{2n}x_{n}+b_2w = b_2\\ ...\\ a_{m1}x_{1} + a_{m2}x_{2} +\cdots + a_{mn}x_{n}+b_mw = b_m\\$$ is always consistent. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9808759621310288,
"lm_q1q2_score": 0.8130861490874519,
"lm_q2_score": 0.828938806208442,
"openwebmath_perplexity": 102.06770000152686,
"openwebmath_score": 0.9962101578712463,
"tags": null,
"url": "https://math.stackexchange.com/questions/2669023/correcting-an-inconsistent-system-of-linear-equations-by-introducing-variables"
} |
gravity, earth, distance
Title: What type of instrument can I use to determine my current distance from the center point of Earth? Immediately, I think of a scale, but is there better way? I can only imagine weighing an object of known mass with an extremely precise scale.
I am asking because I would like to be able to address absolute elevations relative to the center of Earth as ternary component of the geographic coordinate system. Sounds like GPS is best here. The position of the antenna is determined first in coordinates relative to the center of the earth, and then translated onto the ellipsoid and geoid. So finding the position relative to the center of the earth should actually be more accurate than finding its altitude relative to sea level. (Survey-grade can be centimeter resolution).
However, a consumer receiver isn't going to give you any of the information from that intermediate step. I think you'll need to find some sort of survey-grade unit that can provide such data. | {
"domain": "physics.stackexchange",
"id": 31066,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gravity, earth, distance",
"url": null
} |
We can also reformulate it as follows:
Corollary 3: Every binary tree of size $$n>1$$ has a subtree such that both the subtree and its complement have sizes between $$\f{(n+1)/3}$$ and $$\f{(2n+1)/3}$$.
Proof: Taking $$u$$ with $$\f{(n+1)/3}\le\s(u)\le\f{(2n-1)/3}$$ by Corollary 2, the complement of the subtree rooted at $$u$$ has size between $$n-\f{(2n-1)/3}=\c{(n+1)/3}=\f{n/3}+1$$ and $$n-\f{(n+1)/3}=\c{(2n-1)/3}=\f{(2n+1)/3}$$. QED
Using Corollary 2, the simple bound $$n/3\le\s(u)<2n/3$$ works if $$n\equiv0,2\pmod3$$. It also works for all $$n$$ if the tree is full:
Corollary 4: Every binary tree of size $$n>1$$ such that all nodes have $$0$$ or $$2$$ children has a node $$u$$ such that $$n/3\le\s(u)<2n/3$$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. Yes\n2. Yes",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9683812309063187,
"lm_q1q2_score": 0.8250151030441596,
"lm_q2_score": 0.8519528019683105,
"openwebmath_perplexity": 1431.3130238773806,
"openwebmath_score": 0.6435009837150574,
"tags": null,
"url": "https://cs.stackexchange.com/questions/133521/for-a-binary-tree-of-n-nodes-there-is-a-subtree-with-n-3-to-2n-3-nodes/133995"
} |
python, python-3.x, playing-cards, curses
I intend to make a Roguelike for the 7DRL event this year and I intend to do it with Python 3.5.3 and the curses library. It'll be harder than what I usually do but I'm looking forward to it. By helping me hammer out my fundamentals here you will help me to be better prepared for making a small Roguelike in the near future.
Note: the GREEN_TEXT and RED_TEXT color pair definitions were originally
going to be used for the player's funds and for busting prompts, respectively. I haven't removed them because I intend to add that functionality myself very soon, if not today.
Here is the code itself:
"""
Project: Simple 21/Blackjack
File: twenty-one-curses.py
Date: 24 JAN 2019
Author: sgibber2018
Description: A simple implementation of 21/Blackjack using the terminal and python.
Uses the curses library for character cell graphics.
""" | {
"domain": "codereview.stackexchange",
"id": 33304,
"lm_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, playing-cards, curses",
"url": null
} |
c++, thread-safety
// create the chunk data somehow:
p_data = std::make_shared<std::vector<XMFLOAT3>>();
// read-only thread
{
auto const p = p_data.load(/* std::memory_order::acquire */); // or maybe even relaxed
// data in *p is now safe to read
}
// modify thread
{
auto new_data = std::shared_ptr<std::vector<XMLFLOAT3> const>{};
if (a_copy_of_the_existing_data_is_needed)
new_data = p_data.load(/* std::memory_order::acquire */); // or maybe even relaxed
// fill new_data with new data somehow, then
p_data.store(new_data /*, std::memory_order::release */); // or relaxed
} | {
"domain": "codereview.stackexchange",
"id": 40313,
"lm_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++, thread-safety",
"url": null
} |
quantum-mechanics, statistical-mechanics, electromagnetic-radiation, wavefunction, scattering
Can someone please explain the mathematics $\langle \Psi \rangle_{ij}^i = \langle \Psi \rangle_i^i$? In the context of quantum mechanics, I usually interpret the brackets $\langle$ and $\rangle$ to relate to bra-ket notation (inner products in Hilbert space), but it seems that they are used differently in this context (perhaps for some purpose of conditional average?). Furthermore, I would usually interpret the subscripts and superscripts as referring to tensor notation (such as Einstein summation notation), but it isn't clear to me what it means in this context (I wonder if the subscripts refer to conditioning with respect to some values, or something similar?). | {
"domain": "physics.stackexchange",
"id": 69745,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, statistical-mechanics, electromagnetic-radiation, wavefunction, scattering",
"url": null
} |
number-guessing-game, rust
Make sure you get your bounds right (0 is not a possible number).
Don’t use std::old_io, it’s on the way out.
So long as you flush stdout explicitly, you can get the input on the same line as the query.
Prefer semicolons at the end of blocks when producing () (by that, I mean cases like in the if block).
With an if statement, either put the whole thing on one line or finish each line after the {.
Avoid putting multiple statements on the same line.
let mut a; loop { a = …; … } should only be preferred over loop { let a = …; … } if you’re going to use the value of a after the loop. Minimising the distance between definition and declaration and merging the two if possible is strongly preferable. As an aside, any place where you can drop a mut without convolution should also be taken.
There doesn’t seem much point in splitting the acquisition of user input into a separate function. | {
"domain": "codereview.stackexchange",
"id": 12998,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "number-guessing-game, rust",
"url": null
} |
# Four coins with reflip problem?
I came across the following problem today.
Flip four coins. For every head, you get $\$1$. You may reflip one coin after the four flips. Calculate the expected returns. I know that the expected value without the extra flip is$\$2$. However, I am unsure of how to condition on the extra flips. I am tempted to claim that having the reflip simply adds $\$\frac{1}{2}$to each case with tails since the only thing which affects the reflip is whether there are tails or not, but my gut tells me this is wrong. I am also told the correct returns is$\$\frac{79}{32}$ and I have no idea where this comes from. Could someone help me out please? Thanks! | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9755769085257165,
"lm_q1q2_score": 0.8171626903936171,
"lm_q2_score": 0.837619959279793,
"openwebmath_perplexity": 965.516978635075,
"openwebmath_score": 0.9179347157478333,
"tags": null,
"url": "https://math.stackexchange.com/questions/2922494/four-coins-with-reflip-problem"
} |
python, bigdata, matlab, jupyter, ipython
So you can choose to share context Globally (default Zeppelin's behavior), Per Note (the only possible Jupyter's behavior), or Per User.
If you can't / don't want to switch to Zeppelin, look at other options of sharing common dataframes between your notebooks using:
Apache Arrow
Feather
ps. You can't import ipynb files to Zeppelin currently as of now (it has its own notebook format stored as a json file), until https://issues.apache.org/jira/browse/ZEPPELIN-1793 is implemented; although it's not that hard to convert them manually in most cases. | {
"domain": "datascience.stackexchange",
"id": 1410,
"lm_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, bigdata, matlab, jupyter, ipython",
"url": null
} |
cosmology, quantum-information, universe, estimation, information
Large black holes
However, it was found that most galaxies store a huge black hole in their center and black holes actually maximize the entropy that can be squeezed into a fixed volume, or carried by a fixed amount of bound mass. At our galactic center, the Sgr A* black hole has mass about 4 million solar masses or $10^{37}$ kg which is about $10^{45}$ Planck masses, so the radius is also about $10^{45}$ Planck lengths and the area is $10^{90}$ Planck areas, producing $10^{90}$ bits of entropy just from the single black hole.
Because there are approximately $10^{11}$ galaxies in the Universe, we get $10^{101}$ bits of entropy carried by the galactic black holes which is much higher than the CMB entropy.
Cosmic holographic bound on entropy | {
"domain": "physics.stackexchange",
"id": 19216,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "cosmology, quantum-information, universe, estimation, information",
"url": null
} |
thermodynamics, solid-state-physics, degrees-of-freedom
A problem with Chet Miller's answer is that it might imply that $C_P\approx C_V$ because the compressibility $\beta_T$ is small. But $\beta_T$ is in the denominator, so decreasing it alone should make $C_P-C_V$ larger. The resolution is that low-$\beta_T$ materials are also low-$\alpha$ materials; in fact, incompressibility implies zero thermal expansion $\alpha$. As shown above, the squaring of a small $\alpha$ term causes it to dominate the expression and imply $C_P\approx C_V$. | {
"domain": "physics.stackexchange",
"id": 78066,
"lm_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, solid-state-physics, degrees-of-freedom",
"url": null
} |
Note: Before you can calculate how many plants will be required to fill a given area you'll need to first determine the total square feet of the planting bed. Many online calculators use this formula: $$Total\,number\,of\,plants = {Area\,of\,garden \over Plant\,spacing^2}$$. Image Credit: Getty Images Calculating even spacing is an essential carpentry technique that you might need for things like fence pickets, railing balusters, or decking planks. How much food you need to eat everyday based off your weight, height, age, and activity. Hedges with plants 60cm apart "fill in" quicker than those planted 100cm apart but you get just as good a ⦠Get a Quote for. Planting fruit trees too close together causes them to shade each other and produce lower yields and lower quality fruit. Now simply choose one of these options and start planting! Area in Square Feet: Plant Spacing in Inches: Number of Trees in Bed: Calculate *Only enter one bed at a time, do not combine bed square footages and | {
"domain": "co.uk",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9615338079816756,
"lm_q1q2_score": 0.8053999188316894,
"lm_q2_score": 0.8376199694135333,
"openwebmath_perplexity": 2628.0538647379285,
"openwebmath_score": 0.6550539135932922,
"tags": null,
"url": "https://sarahphoebe.co.uk/tags/cca926-plant-spacing-calculator-metric"
} |
python, python-3.x
):
a=E6
elif (
a != "rien"
):
print("!!!DESOLE la session est deja occupee!!! ")
elif (
x == '6' and y == '1' and z == '2'
):
if (
b == "rien"
):
b=E6
elif (
b != "rien"
):
print("!!!DESOLE la session est deja occupee!!! ")
elif (
x == '6' and y == '1' and z == '3'
):
if (
c == "rien"
):
c=E6
elif (
c != "rien"
):
print("!!!DESOLE la session est deja occupee!!! ")
elif (
x == '6' and y == '2' and z == '1'
):
if (
d == "rien"
):
d=E6
elif ( | {
"domain": "codereview.stackexchange",
"id": 33587,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, python-3.x",
"url": null
} |
java, object-oriented, multithreading, factory-method, static
Whether or not to use runnable or thread class depends on what you're doing, at the moment I don't think it makes a lot of difference either way. As I've said, I'm not sure that spinning up a thread for each transaction really makes sense to me.
static methods in your main class are fine, however, you want your main to be responsible for one thing, typically bootstrapping your application. With that in mind, the scope for having many static methods should be quite small. I think the same applies for static classes, they aren't 'bad', however they may be a sign that the Main class is doing too much.
For multi-threading, control performed at the right level. Typically, you want to minimise the amount of time when objects are locked, so protecting balance in the base object seems to make sense. However, as I've already indicated you need to be careful about what you do in derived classes to ensure you don't accidentally break that encapsulation. | {
"domain": "codereview.stackexchange",
"id": 38691,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, object-oriented, multithreading, factory-method, static",
"url": null
} |
ros, gazebo, ros-fuerte, overlay
[rosmake-0] Finished <<< std_msgs No Makefile in package std_msgs
[rosmake-3] Starting >>> bondcpp [ make ]
[rosmake-0] Starting >>> angles [ make ]
[rosmake-1] Finished <<< resource_retriever ROS_NOBUILD in package resource_retriever
[rosmake-2] Finished <<< dynamic_reconfigure ROS_NOBUILD in package dynamic_reconfigure
[rosmake-2] Starting >>> geometry_msgs [ make ]
[rosmake-2] Finished <<< geometry_msgs No Makefile in package geometry_msgs
[rosmake-2] Starting >>> sensor_msgs [ make ] | {
"domain": "robotics.stackexchange",
"id": 12545,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, gazebo, ros-fuerte, overlay",
"url": null
} |
You can prove something more general:
PROP Suppose $f:[a,\infty)\to\Bbb R$ has bounded derivative. Then $f$ is uniformly continuous on its domain.
P Pick $x,y\in[a,\infty)$ arbitrarily. By the mean value theorem, we can write $$|f(x)-f(y)|=|f'(\xi)||x-y|$$
Let $M=\sup\limits_{x\in[a,\infty)}|f'(x)|$. Then $$|f(x)-f(y)|\leq M|x-y|$$
Thus, for any $\epsilon$ we may take $\delta=\frac{\epsilon}{2M}$. Note that in your case $M=1$. I only divide by $2$ to turn $\leq$ into $<$.
ADD This means, for example, that $\log x$ (over $[a,\infty)$, $a>0$), $\sin x$, $\cos x$, $x$, and similar functions are all uniformly continuous. Note, for example, that $\sin(x^2)$ is not uniformly continuous. Note that we actually prove $f$ is $1$-Lipschitz with constant $M$, so this might be of interest.
• A very useful answer! Thanks alot. – Heisenberg Jun 19 '13 at 18:44 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9752018419665618,
"lm_q1q2_score": 0.8455348767110601,
"lm_q2_score": 0.8670357666736772,
"openwebmath_perplexity": 154.0370448862917,
"openwebmath_score": 0.8916768431663513,
"tags": null,
"url": "https://math.stackexchange.com/questions/424698/is-lnx-uniformly-continuous"
} |
paragraph 2
paragraph 1
paragraph 2
> This is a quote
This is a quote
# I indented these lines
# 4 spaces, and now they show
# up as a code block.
print "hello world"
# I indented these lines
# 4 spaces, and now they show
# up as a code block.
print "hello world"
MathAppears as
Remember to wrap math in $$...$$ or $...$ to ensure proper formatting.
2 \times 3 $$2 \times 3$$
2^{34} $$2^{34}$$
a_{i-1} $$a_{i-1}$$
\frac{2}{3} $$\frac{2}{3}$$
\sqrt{2} $$\sqrt{2}$$
\sum_{i=1}^3 $$\sum_{i=1}^3$$
\sin \theta $$\sin \theta$$
\boxed{123} $$\boxed{123}$$
Sort by:
In Approach 2, the floor function fails to be constant on the two subintervals; consider the two endpoints! The first integral takes the value of 1 due to the step at 1, and the second one takes a value of 5. With this correction, both approaches work and yield the same result.
- 1 year, 9 months ago
First off, integration by parts doesn't work as the step function isn't differentiable. | {
"domain": "brilliant.org",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9702398991698342,
"lm_q1q2_score": 0.8577301880297868,
"lm_q2_score": 0.8840392863287585,
"openwebmath_perplexity": 1428.5985123719056,
"openwebmath_score": 0.9855186343193054,
"tags": null,
"url": "https://brilliant.org/discussions/thread/a-calculus-problem/"
} |
java, optimization, tree, complexity
printPaths(Node node, List<Integer> path) { ... }
List<Integer> path = new ArrayList<Integer>();
You can omit the return statement here:
if(node.leftChild == null && node.rightChild == null) {
System.out.println(path);
return;
} else {
printPaths(node.leftChild,new ArrayList<Integer>(path));
printPaths(node.rightChild,new ArrayList<Integer>(path));
}
And you should add a space in front of the opening paren of the if, and after commas in argument lists, like this:
if (node.leftChild == null && node.rightChild == null) {
System.out.println(path);
} else {
printPaths(node.leftChild, new ArrayList<Integer>(path));
printPaths(node.rightChild, new ArrayList<Integer>(path));
}
Another alternative is to keep the return but drop the else:
if (node.leftChild == null && node.rightChild == null) {
System.out.println(path);
return;
}
printPaths(node.leftChild, new ArrayList<Integer>(path));
printPaths(node.rightChild, new ArrayList<Integer>(path)); | {
"domain": "codereview.stackexchange",
"id": 9758,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, optimization, tree, complexity",
"url": null
} |
c++, object-oriented
Title: Basic C++ Circle Class I'm trying to improve on my basic C++ skills and create really nice, concise and clean code that is free from artifacts.
The program can add and subtract radius values from each circle, assign one circle to another and furthermore give the area.
Any tips on how this program can be improved, whether considering readability issue or anything else would be great.
// Basic circle exercise 23rd March
#include <cstdio>
#include <math.h>
using namespace std;
//==============================================================================
/* interface */
//==============================================================================
namespace corey
{
class Circle
{
public:
Circle(const int & r = 1.0);
~Circle();
const double & getRadius() const;
const double getArea() const; | {
"domain": "codereview.stackexchange",
"id": 32923,
"lm_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
} |
photons, electrons, energy-conservation, atomic-physics, orbitals
following explanation, which really just describes the physical law that makes atoms behave in this way, might not be the kind of "why" answer you are looking for, but it's the only kind physics knows how to give. | {
"domain": "physics.stackexchange",
"id": 57960,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "photons, electrons, energy-conservation, atomic-physics, orbitals",
"url": null
} |
machine-learning, image-classification, training
Title: Tool to label images for classification Can anyone recommend a tool to quickly label several hundred images as an input for classification?
I have ~500 microscopy images of cells. I would like to assign categories such as 'healthy', 'dead', 'sick' manually for a training set and save those to a csv file.
Basically, the same as described in this question, except I do not have proprietary images, so maybe that opens up additional possibilities? I just hacked together a very basic helper in python
it requires that all images are stored in a pyton list allImages.
import matplotlib.pyplot as plt
category=[]
plt.ion()
for i,image in enumerate(allImages):
plt.imshow(image)
plt.pause(0.05)
category.append(raw_input('category: ')) | {
"domain": "datascience.stackexchange",
"id": 6857,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "machine-learning, image-classification, training",
"url": null
} |
c, linked-list
void list_prepend(List *list, void *data)
{
list_insert(list, data, 0);
}
void list_append(List *list, void *data)
{
list_insert(list, data, list_size(list));
}
static void delete_node(List *list, ListNode *node)
{
if (is_sentinel_node(node)) {
free(node);
return;
}
if (list->vtable->dtor != NULL) {
list->vtable->dtor(get_container(list, node));
}
}
void list_remove(List *list, const size_t pos)
{
if (list_is_empty(list)) {
return;
}
ListNode *current_node = front_node(list);
assert(pos < list_size(list));
for (size_t i = 0; i < pos && !is_sentinel_node(current_node->next); i++) {
current_node = current_node->next;
}
current_node->prev->next = current_node->next;
current_node->next->prev = current_node->prev;
delete_node(list, current_node);
}
void list_delete(List **list)
{
ListNode *current_node = (*list)->head; | {
"domain": "codereview.stackexchange",
"id": 43806,
"lm_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, linked-list",
"url": null
} |
javascript, jquery, canvas
} else {
canvas.setZoom(canvas.getZoom() * getZoom(widc));
}
}
canvas.getActiveObject().setText(event.target.value);
canvas.renderAll();
letteringL.value = event.target.value.length;
}
<script src = "https://cdnjs.cloudflare.com/ajax/libs/fabric.js/1.7.20/fabric.min.js" ></script>
<div class="wrapper-canvas">
<canvas class="" id="editor" width="1000" height="auto"></canvas>
</div>
<input class="text-input" type="text" id="Eletter" value="Your Text">
<input id="LetteringL" type="hidden" value=""> | {
"domain": "codereview.stackexchange",
"id": 28360,
"lm_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, canvas",
"url": null
} |
acid-base, equilibrium, solubility, solutions
Matlab scripts used
The matlab scripts I used are the following:
First mols.m as a depency of the other two,
%%%% amount of mol, Vol=volume, d=density, pwt=%weight, M=molecularweight
function mol=mols(Vol, d, pwt, M)
mol=(Vol*d*pwt)/M;
end
First script, all matlab calculated
clc;
clear all;
%Units to be used
%Volume is in CC also cm^3, 1 litre is 1000 CC, 1 cc = 1 ml
%density is in g/cm^3
%weigth percentages are in fractions of 0 to 1
%Molecular weight is in g/mol
% pts=10; %number of points for linear spacing
%weight percentages of NH4OH and HF
xhf=0.49;
xnh3=0.28;
%H2O
Vh2o=1800;
dh2o=1.00; %0.997 at 25C when rounded 1
mh2o=18.02;
%HF values
Vhf=100;
dhf49=1.15;
dhf=dh2o+(dhf49-dh2o)*xhf/0.49; %@ 25C
Mhf=20.01;
nhf=mols(Vhf,dhf,xhf,Mhf);
%NH4OH (NH3) values
% Vnh3=linspace(0.1*Vhf,1.9*Vhf,pts);
Vnh3=10;
dnh3=0.9; %for ~20-31% @~20-25C
Mnh3=17.03; %The wt% of NH4OH actually refers to the wt% of NH3 dissolved in H2O
nnh3=mols(Vnh3,dnh3,xnh3,Mnh3); | {
"domain": "chemistry.stackexchange",
"id": 10391,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "acid-base, equilibrium, solubility, solutions",
"url": null
} |
typescript
A bit silly in this case - applyOperation(4, 5, add) amounts to the same as add(4, 5) - but it can be useful in other situations.
Too much deduplication?
You also posted another question. There you're showing a single function that can add or subtract numbers, but it can also return a string representation of an add or subtract expression. Those are two different kinds of functionality that each deserve their own function(s). Putting them together into a single function actually decreases code quality: you end up with a function that's harder to understand and easier to use incorrectly. | {
"domain": "codereview.stackexchange",
"id": 23360,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "typescript",
"url": null
} |
python, beginner, regex
root = tk.Tk()
root.geometry("350x350")
root.wm_title("Password Tools")
maintitle = tk.Label(root, text = 'Password Tools', font = ('Comic Sans MS',18))
generatesingle = tk.Button(root, text="Generate Single Password", command=generatesinglepass)
generatemulti = tk.Button(root, text="Generate Multiple Password to Text File", command=generatepass)
checkstrength = tk.Button(root, text = "Check Password Strength", command=strength)
checkstrengthfromtext = tk.Button(root, text = "Check Password Strength from Text File", command=multiplestrength)
quit = tk.Button(root, text = "Quit Program", command=quit)
outputlabel = tk.Label(root, text = "Output")
displaypasswords = Text(root)
maintitle.pack()
generatesingle.pack()
generatemulti.pack()
checkstrength.pack()
checkstrengthfromtext.pack()
quit.pack()
outputlabel.pack()
displaypasswords.pack()
root.mainloop() | {
"domain": "codereview.stackexchange",
"id": 38798,
"lm_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, regex",
"url": null
} |
mycology
Does this mean that not only is going to the swimming pool not a cure of fungal infections, but it is actually the cause? Well, maybe not. While the articles show that there is a larger incidence of fungal infections among swimmers, they only show correlation, not causality. People who partake in sports activities have a bigger chance of having these infections than the general public. These are also the people who are more likely to go swimming.
To settle the matter for good, we need an article named "Prevalence of fungal infections among occasionally swimming couch potatoes" :-) | {
"domain": "biology.stackexchange",
"id": 8817,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "mycology",
"url": null
} |
ros, roscpp, documentation
Originally posted by Constantin S on ROS Answers with karma: 296 on 2014-02-13
Post score: 0
Original comments
Comment by Constantin S on 2014-02-13:
I looked through the header and saw that my second link pretty much describes all of the init functionality. So I guess my question is just related to navigating the doxygen documentation ... am I doing it wrong or is ros::init really not in there?
Short answer: http://docs.ros.org/hydro/api/roscpp/html/init_8h.html
But I don't know why it doesn't appear in the API doc under the same url as before. It seems like doxygen is not correctly referencing any symbols in the ros namespace.
Originally posted by Dirk Thomas with karma: 16276 on 2014-02-13
This answer was ACCEPTED on the original site
Post score: 1 | {
"domain": "robotics.stackexchange",
"id": 16964,
"lm_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, roscpp, documentation",
"url": null
} |
the following: we will say and write when if and only if Limit test Let f(x) and g(x) be two positive functions defined on [a,b]. 6 - Graphs of Trigonometric Functions. 8 Derivatives of Inverse Trig Functions. The Tangent Line p. Khan Academy is a nonprofit with the mission of providing a free, world-class education for anyone, anywhere. Find limits of trigonometric functions by rewriting them using trigonometric identities. Everything from limits to derivatives to integrals to vector calculus. application of. View any or all of the videos to the right. Course Precalculus Khan Academy. Although the trigonometric functions are defined in terms of the unit circle, the unit circle diagram is not what we normally consider the graph of a trigonometric function. Two Intercept Form for the Equation of a Line. Find the limit from the graph: This problem takes a graph with several discontinuities. Enroll Now to get full accesses on online free video lectures and Tutorials by khan Academy with | {
"domain": "dwvu.pw",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9883127440697254,
"lm_q1q2_score": 0.805704651951348,
"lm_q2_score": 0.8152324826183822,
"openwebmath_perplexity": 787.0766131253902,
"openwebmath_score": 0.7274582982063293,
"tags": null,
"url": "http://vpph.dwvu.pw/limits-of-trigonometric-functions-khan-academy.html"
} |
c#, wpf, rubberduck, xaml
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return value;
}
}
public class BindingModeValueToTextConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var mode = (Rubberduck.Settings.BindingMode)value;
switch (mode)
{
case Rubberduck.Settings.BindingMode.EarlyBinding:
return RubberduckUI.UnitTestSettings_EarlyBinding;
case Rubberduck.Settings.BindingMode.LateBinding:
return RubberduckUI.UnitTestSettings_LateBinding;
default:
return value;
}
} | {
"domain": "codereview.stackexchange",
"id": 18539,
"lm_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#, wpf, rubberduck, xaml",
"url": null
} |
classical-mechanics, everyday-life, stress-strain
Title: Why does dry spaghetti break into three pieces as opposed to only two? You can try it with your own uncooked spaghetti if you want; it almost always breaks into three when you snap it. I am asking for a good physical theory on why this is along with evidence to back it up. Or, a reference to a good study previously done on this would also be satisfactory. The math behind everything would be a great bonus if it exists. | {
"domain": "physics.stackexchange",
"id": 18577,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "classical-mechanics, everyday-life, stress-strain",
"url": null
} |
bacteriology, brain, parasitology, ant
Link to that research paper: "Mice Infected with Low-Virulence Strains of Toxoplasma gondii Lose Their Innate Aversion to Cat Urine, Even after Extensive Parasite Clearance".
One theory is that the parasite simultaneously infects the ovaries/testes of the rodent, causing increased testosterone levels in the male and thereby causing it to engage in more risk-taking behaviour. A lot of the literature relevant to this theory is behind paywalls, but as far as I can tell studies have shown that: | {
"domain": "biology.stackexchange",
"id": 10206,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "bacteriology, brain, parasitology, ant",
"url": null
} |
energy, energy-conservation, capacitance, dipole
The capacitors are not connected to batteries and are pre-charged, the entire setup is in vacuum and gravity is non existent
they still have the velocity gained by the two additional capacitors but none of the three capacitors lose their charge. The dipole gains some kinetic energy so where does the energy come from? | {
"domain": "physics.stackexchange",
"id": 98201,
"lm_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, energy-conservation, capacitance, dipole",
"url": null
} |
zoology, mammals, echolocation, bats
Ulanovsky, N., & Moss, C. F. (2008). What the bat’s voice tells the bat’s brain. Proceedings of the National Academy of Sciences of the United States of America, 105(25), 8491–8498. http://doi.org/10.1073/pnas.0703550105
Roverud, R.C., Nitsche, V. & Neuweiler, G. J Comp Physiol A (1991) 168: 259. Discrimination of wingbeat motion by bats, correlated with echolocation sound pattern https://doi.org/10.1007/BF00218418
Hearing by Bats (edited by Richard R. Fay) | {
"domain": "biology.stackexchange",
"id": 8356,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "zoology, mammals, echolocation, bats",
"url": null
} |
deep-learning, convolutional-neural-networks, terminology, objective-functions, comparison
In mathematical optimization, the objective function is the function that you want to optimize, either minimize or maximize. It's called the objective function because the objective of the optimization problem is to optimize it. So, this term can refer to an error function, fitness function, or any other function that you want to optimize. [10] states that the objective function is a utility function (here).
A utility function is usually the opposite or negative of an error function, in the sense that it measures a positive aspect. So, you want to maximize the utility function, but you want to minimize the error function. This term is more common in economics, but, sometimes, it is also used in AI [11]. | {
"domain": "ai.stackexchange",
"id": 1279,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "deep-learning, convolutional-neural-networks, terminology, objective-functions, comparison",
"url": null
} |
sql, ms-access
If you can't have any case with non existing employees and sites, it's better to change your 2 LEFT JOIN into INNER JOIN. Just throw the 2 queries and compare the results.
In your WHERE clause, having some <> is generally inefficient on large tables. It's always better to make a IN() and list all the possibilities excluding "Not assigned" or "first contact" :
If cases.[assigned to] can only contain an employee username or "Not Assigned", then just doing an INNER JOIN on the employee table will automatically filter the not assigned and you don't need to specify it in the WHERE clause.
if you have a limited number of case.priority values, list them all but "first contact" : AND cases.priority IN ("priority1", "super urgent", "can wait")
For the Age, if you want to compute the days from your open_date, it's better to do :
dateDiff("d",Now(),cases.[opened date]) AS Age | {
"domain": "codereview.stackexchange",
"id": 21899,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "sql, ms-access",
"url": null
} |
python, python-3.x, random, playing-cards, bitcoin
A "check" function should probably return True or False to indicate the value checked. An exception should indicate that the function failed to accomplish what was asked. In terms of checking, its not failure to have that be check came up false.
The only recognised characters in this context are hexadecimal
characters and card ranks and suits.
"""
for i in argument:
i is bad name. Firstly, I'd suggest avoiding single letter variable names, they are hard to determine what they are. Also, i usually is taken to stand for index, and this isn't an index.
if i not in recognisedCharacters:
message = ("Character '" + i +
"' not recognised as part of card or hexadecimal.")
raise UnrecognisedCharacterError(message) | {
"domain": "codereview.stackexchange",
"id": 6235,
"lm_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, random, playing-cards, bitcoin",
"url": null
} |
objective-functions, gradient-descent, regularization, gradient-clipping
Title: What is the best way to combine or weight multiple losses with gradient descent? I am optimizing a neural network with Adam using 3 different losses. Their scale is very different, and the current method is to either sum the losses and clip the gradient or to manually weight them within the sum. Something like: $clip(w_1\nabla_{L_1} + w_2\nabla_{L_2} + w_3\nabla_{L_3}, c)$.
I am thinking of better approaches. My current idea is to clip gradients separately (to avoid having one gradient "overtaking" the others too much), then weigh them, sum them, and finally clip them (with a smaller threshold than the one used for the first clipping).
Something like: $clip(w_1clip(\nabla_{L_1},c) + w_2clip(\nabla_{L_2},c) + w_3clip(\nabla_{L_3},c), c_2)$.
I am not sure what the best way to weigh them would be, though. Like having weights $w_i$ proportional to their gradient norm? | {
"domain": "ai.stackexchange",
"id": 3821,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "objective-functions, gradient-descent, regularization, gradient-clipping",
"url": null
} |
electrostatics, atoms
Title: Do inner shell electrons feel the electric field/force from an outer shell electron in an atom? We just finished studying Gauss’ law and were puzzled by this thought. If I look at a copper atom and focus on the 29th electron in the 4th shell, according to Gauss’ law, I can draw a Gaussian surface that completely encloses the first three shells plus the nucleus. It is my understanding that the 29th electron will not contribute to the E-field inside this Gaussian because this charge is outside the Gaussian. However, it does not mean that the 29th electron doesn’t apply an electric force on the inner electrons, especially the 3rd shell electrons. So here is my dilemma: wouldn’t this effect the E-field of the inner shell electrons? | {
"domain": "physics.stackexchange",
"id": 9426,
"lm_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, atoms",
"url": null
} |
java, optimization, algorithm
System.out.printf("%n");
}
}
/**
* Solves the knight's tour using backtracking
*
* @param sRow the starting row
* @param sCol the starting column
*/
public static void solveTour(int sRow, int sCol) {
board = new int[BOARD_LENGTH][BOARD_LENGTH];
//Make all of board -1 because have not visited any square
for (int r = 0; r < BOARD_LENGTH; r++) {
for (int c = 0; c < BOARD_LENGTH; c++) {
board[r][c] = -1;
}
}
board[sRow][sCol] = 1;
if (solveTour(sRow, sCol, 2)) {
printTour();
} else {
System.out.printf("No Solution!%n");
}
} | {
"domain": "codereview.stackexchange",
"id": 14043,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, optimization, algorithm",
"url": null
} |
python, matrix, numpy
Title: Finding a zero crossing in a matrix I am trying create an algorithm for finding the zero crossing (check that the signs of all the entries around the entry of interest are not the same) in a two dimensional matrix, as part of implementing the Laplacian of Gaussian edge detection filter for a class, but I feel like I'm fighting against Numpy instead of working with it.
import numpy as np
range_inc = lambda start, end: range(start, end+1) | {
"domain": "codereview.stackexchange",
"id": 10212,
"lm_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, matrix, numpy",
"url": null
} |
python, performance, python-3.x
mike = Roller('mike',25)
mike.roll_multiple(6)
Roller should not inherit from Dice, as Roller represents a human. Humans being a sub-class of Dice is pretty unintuitive. Rather, Roller should have an attribute: self.dice = Dice()
There's no particular reason Roller.age should be of type str. I'd keep it as an int and only convert to str if you need its string-represantation.
f-Strings are a really convenient tool for creating strings containing variables / expressions. They also handle converting to str for you. Example: print(f'age: {self.age}')
You don't need the empty parantheses in class Dice()
You should put a space after the comma between arguments in a function call: mike = Roller('mike',25) becomes mike = Roller('mike', 25) | {
"domain": "codereview.stackexchange",
"id": 41378,
"lm_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",
"url": null
} |
quantum-operation, nielsen-and-chuang, unitarity, kraus-representation
How does $\mathcal E(\rho)=\mathrm{Tr}_{env}[U(\rho\otimes\rho_{env})U^\dagger]$ turn into $P_0\rho P_0+P_1\rho P_1$?
Equivalent statement of the unitary freedom of Kraus operator?
and links therein. | {
"domain": "quantumcomputing.stackexchange",
"id": 3228,
"lm_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-operation, nielsen-and-chuang, unitarity, kraus-representation",
"url": null
} |
At this point, may I conclude $$\lim_{n\rightarrow +\infty} {S_n} = 0$$ since the ratio of $$S_{n+1}$$ and $$S_n$$ can be squeezed between 0 and a very small number, the sequence $$S_n$$ is decreasing and is bounded below by zero?
The way I envisioned the proof was like this
$$rS_0 > S_1$$
$$r^{2}S_0 > S_2$$
.
.
.
$$r^{n}S_{0} > S_{n}$$
Using the definition of a limit we want to show that $S_n \rightarrow 0$
$$0< | S_{n} -0 | < |S_{0}|r^{n}$$ . We know $S_0$ is bounded since the original sequence is convergent.
If you have already proving that $\lim_ {n \to \infty } r^{n} = 0 \quad 0<r<1$ then the proof is complete.
Samuelb88
The way I envisioned the proof was like this
$$rS_0 > S_1$$
$$r^{2}S_0 > S_2$$
.
.
.
$$r^{n}S_{0} > S_{n}$$
Using the definition of a limit we want to show that $S_n \rightarrow 0$
$$0< | S_{n} -0 | < |S_{0}|r^{n}$$ . We know $S_0$ is bounded since the original sequence is convergent. | {
"domain": "physicsforums.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9683812309063187,
"lm_q1q2_score": 0.8069758973527671,
"lm_q2_score": 0.8333245953120234,
"openwebmath_perplexity": 267.80455661422707,
"openwebmath_score": 0.970655083656311,
"tags": null,
"url": "https://www.physicsforums.com/threads/need-help-understanding-something-in-my-proof.461545/"
} |
c#
public File()
: this(new THeader(), new TRecord[0])
{
}
File(THeader header, IEnumerable<TRecord> records) =>
(Header, Records) = (header, records.ToList());
public THeader Header { get; }
public IList<TRecord> Records { get; }
public override string ToString() =>
string.Join(Environment.NewLine,
Records.Select(Serializer<TRecord>.Format)
.Prepend(Serializer<THeader>.Format(Header)));
public void Save(string path) =>
Save(new StreamWriter(path));
public void Save(TextWriter writer)
{
using (writer)
writer.WriteLine(ToString());
}
} | {
"domain": "codereview.stackexchange",
"id": 36240,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#",
"url": null
} |
electromagnetic-induction
Can you get induction with straight wires? This is an interesting question, and the answer is yes. It is most evident with the differential form of Faraday's law: the presence of a changing magnetic field will produce a curling electric field in the vicinity of the wire, inducing a current. | {
"domain": "physics.stackexchange",
"id": 39280,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electromagnetic-induction",
"url": null
} |
2. ### Pre Calculus
f(x)=(2x^2+5x-12)/(x^2-3x-28) Is this function continuous at x=7? If not which condition does it fail?
3. ### Math11
Hello, I don't know how to do this, please help. Thank you. 1).Does the function satisfy the hypotheses of the Mean Value Theorem on the given interval? f(x) = 5x2 − 3x + 2, [0, 2] Yes, it does not matter if f is continuous or
4. ### Calculus help
The function is continuous on the interval [10, 20] with some of its values given in the table above. Estimate the average value of the function with a Right Hand Sum Approximation, using the intervals between those given points. | {
"domain": "jiskha.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9702399034724604,
"lm_q1q2_score": 0.8412326785636091,
"lm_q2_score": 0.8670357460591569,
"openwebmath_perplexity": 893.3000304035952,
"openwebmath_score": 0.8109428286552429,
"tags": null,
"url": "https://www.jiskha.com/questions/615068/if-the-following-function-is-continuous-what-is-the-value-of-a-b-f-x-3x-2-2x-1"
} |
c++, c++11, sfml
private:
float rumbleWidth(float projectedRoadWidth, std::size_t lanes)
{
return projectedRoadWidth / std::max(6u, 2 * lanes);
}
float laneMarkerWidth(float projectedRoadWidth, std::size_t lanes)
{
return projectedRoadWidth / std::max(32u, 8 * lanes);
}
void draw(sf::RenderTarget& target, sf::RenderStates states) const
{
states.transform *= getTransform();
target.draw(mLandscape, states);
target.draw(mRumbleSide1, states);
target.draw(mRumbleSide2, states);
target.draw(mMainRoad, states);
target.draw(mLanes1, states);
target.draw(mLanes2, states);
}
private:
Point mPoint1;
Point mPoint2;
Polygon mRumbleSide1;
Polygon mRumbleSide2;
Polygon mLanes1;
Polygon mLanes2;
Polygon mMainRoad;
sf::RectangleShape mLandscape;
Colors mColors;
std::size_t mIndex;
}; | {
"domain": "codereview.stackexchange",
"id": 16998,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, c++11, sfml",
"url": null
} |
beginner, c, array, cache
Bug: Code in header file
Code is apparently designed for different VECTOR_RESERVE_SIZE depending on which .c includes it.
Unfortunately, if 2 .c files each include this, the there will be 2 vector_init(), vector_free(), etc, creating linker conflict.
Instead, divide code into vector.h and vector.c files. I suspect though this causes trouble with the VECTOR_RESERVE_SIZE scheme. IMO, VECTOR_RESERVE_SIZE is unnecessary.
Corner bug
No need to assume vector_free() is not called again. Leave data in a diminished, but correct state.
void vector_free(vector_t *p) {
free(p->data);
p->data = NULL; // add
p->used = 0; // add
}
else not needed
if (!(i > p->used))
{
return (void*)((char*)p->data + p->size_of_each * i);
}
// else { return NULL; }
return NULL; | {
"domain": "codereview.stackexchange",
"id": 40905,
"lm_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, array, cache",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.