text
stringlengths
49
10.4k
source
dict
nuclear-engineering, accelerator-physics, particle-accelerators Neutron production in the first reaction $^4He+^9Be$, in different energies Neutron thermalization for $^{11}B$ capture and its cross section $^{12}B$ decay spectrum and time it takes Neutron production in the first reaction $^4He+^9Be$ for different energies First, a note on the idea of using accelerators for driving reactors: this was proposed already by Nobel Prize Carlo Rubbia (see wikipedia) and is still in active research, currently using Thorium as the strongest candidate for fissile material, there are a number of publications and international conferences (iThEO) investigating this possibility. Ion accelerators exist and are rather abundant, so accelerating $^4He$ would not be a problem, as long as we can extract more energy than spent. $^9Be$ has a 100% natural abundance, so this already works for us: no extremely complex chemical separation needed in order to increase the rate of our first stage reaction. However is not so abundant compared to other materials on Earth, and we won't discuss the details on how could it be extracted from the compounds found in nature.
{ "domain": "physics.stackexchange", "id": 24679, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "nuclear-engineering, accelerator-physics, particle-accelerators", "url": null }
newtonian-mechanics, forces, electrostatics, torque, dipole There may be some superficial similarities between the expression for the torque on the dipole, acting about the centre of the dipole, and the commonly used formula for the torque about the origin produced by a force $\vec{F}$ acting at a point $\vec{r}$, namely $\vec{r}\times\vec{F}$. This last formula is not applicable here: the force $\vec{F}$ is zero, and in any case the expression $\vec{r}\times\vec{F}$ would involve the polar angles $\theta$ and $\phi$, not $\theta'$ and $\phi'$. One can derive an expression for the torque by writing the dipole as two charges at $\pm d\vec{e}$ (where $d$ is small), evaluating the force on each charge, and applying the formula $\pm d\vec{e}\times\vec{F}$ to both the charges. This gives a superficially similar-looking formula to $\vec{r}\times\vec{F}$, but involving the orientation of $\vec{e}$, not $\vec{r}$.
{ "domain": "physics.stackexchange", "id": 56036, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "newtonian-mechanics, forces, electrostatics, torque, dipole", "url": null }
linux, aes, sh, posix, openssl Title: Long-term archiving + encrypting shell script Yesterday, I very quickly, in an hour, wrote the very first version of my long-term archiving + encrypting shell script. I am aware it may have too many flaws, but none of them really prevent it from normal operation, so before I take another step and restructure it with printf and better error reporting, structure, exit codes, etc. I would like you to have a look first. What it does: It archives a given directory into a tarball. It compresses (with maximum effort) that tarball using xz. It encrypts that xz archive using openssl and AES-256. It creates and checks the created SHA-512 sum file. It then decrypts the created file to a temporary file. Finally, it compares the decrypted file with the original xz archive. I am prepared to waste time and effort in order to be 100% sure before burning my precious data to Blu-ray M-disc. I know I should not have to do steps 5 and 6 just because there is almost a 0% chance for the data to get corrupted in the process. But since I have a rather large NVMe SSD drive, and relatively fast CPU, it should not be so shocking that I wrote it with motto better safe than sorry. #!/bin/sh [ -z "$1" ] && echo "You need to give me one directory!" && exit 1 [ ! -d "$1" ] && echo "This is not a directory!" && exit 1 [ ! -w "$PWD" ] && echo "The current directory is not writable by you!" && exit 1 dir=$(basename "$1") today=$(date +%Y-%m-%d) backupdir="${dir}_${today}" # backupdir="${dir}" backupfile="${backupdir}.tar" bold=$(tput bold) red=$(tput setaf 1) yellow=$(tput setaf 3) nocolor=$(tput sgr0) bold_red="$bold$red" bold_yellow="$bold$yellow"
{ "domain": "codereview.stackexchange", "id": 31120, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "linux, aes, sh, posix, openssl", "url": null }
filters, filter-design, finite-impulse-response 41408244257891574408551955/9903520314283042199192993792, 134542668383383518249441345/4951760157141521099596496896, 54710983442922686326925835/2475880078570760549798248448, -60180577167462385720128651/2475880078570760549798248448, -334341555218410707021236175/4951760157141521099596496896, -76076583929405887081624335/2475880078570760549798248448, 279904412570455622281448025/2475880078570760549798248448, 2855025008218647347270769855/9903520314283042199192993792, 7281563888583524448979432097/19807040628566084398385987584, 2855025008218647347270769855/9903520314283042199192993792, 279904412570455622281448025/2475880078570760549798248448, -76076583929405887081624335/2475880078570760549798248448, -334341555218410707021236175/4951760157141521099596496896,
{ "domain": "dsp.stackexchange", "id": 11775, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "filters, filter-design, finite-impulse-response", "url": null }
1. ## Need help with a definite integral please I would appreciate advice on solving the following problem. Evaluate the definite integral: integral (upper limit 2, lower limit 1) [ 2x (x^2 +1 )] dx Here is my own attempt. Step 1: Solve for the generic (indefinite) integral via substitution Let u = x^2 + 1 So then du / dx = 2x 2x dx = du dx = du / 2x Returning to the original function: integral 2x (x^2 + 1) dx = integral 2x (u) dx = integral 2x (u) (du / 2x) = integral u du = integral x^2 + 1 = (x^3 / 3 ) + x + C Step 2: solve for the definite integral given the stated limits At upper limit of 2: ((2)^3 / 3) + (2) +C = (8/3) +2 + C = (8/3) + (6/3) + C = 14/3 + C At lower limit of 1 ((1)^3 / 3) + (1) +C =(1/3) +1 + C = (1/3) + (3/3) + C = 4/3 + C Subtracting the lower limit result from upper limit result: (14 /3 + C) - (4/3 + C) =14/3 + C - 4/3 - C = 10 / 3 But my textbook and calculator both say the answer is (21/2) What am I doing wrong? 2. Originally Posted by lingyai I would appreciate advice on solving the following problem. Evaluate the definite integral: integral (upper limit 2, lower limit 1) [ 2x (x^2 +1 )] dx Here is my own attempt. Step 1: Solve for the generic (indefinite) integral via substitution Let u = x^2 + 1 So then du / dx = 2x 2x dx = du dx = du / 2x Returning to the original function:
{ "domain": "mathhelpforum.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9362850128595115, "lm_q1q2_score": 0.8519322848433177, "lm_q2_score": 0.9099069974872589, "openwebmath_perplexity": 3507.7443687220016, "openwebmath_score": 0.9143547415733337, "tags": null, "url": "http://mathhelpforum.com/calculus/3132-need-help-definite-integral-please.html" }
homework-and-exercises, kinematics, projectile Title: Throw of two balls in opposite directions Good day community. I somehow can't wrap my head around this question. And I thought someone could hint me, how to continue solving it. The questions is: Calculate the Time $t$, when the angle between two in opposite directions horizontally thrown balls is equal to $\alpha=90°$. The mass is the same $m_1=m_2$ but the starting speeds are different $v_1<v_2$. Both balls start in virtually the same height and they're both vertically affected by gravity. Also it's in vacuum, therefore is no friction. I tried to use the dot product $\vec{a}.\vec{b}=\|{\vec{a}\|\|\vec{b}\|\cos({\alpha})}$ to solve for $\cos(90°)$ but thats = 0... The only unknown here is the vertical speed, which is dependent on $v_y=g.t$. Please help. Try to solve it to get an answer in terms of $v_1$,$v_2$ and $g$. Take the velocity vectors $\vec{a}$ and $\vec{b}$ to have horizontal components of $v_1$ and $-v_2$ ( as horizontal components are used in opposite directions) and the vertical components would both be $gt$. Then try the dot product and you'll find the answer for $t$ in terms of $v_1$, $v_2$ and $g$.
{ "domain": "physics.stackexchange", "id": 40968, "lm_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, kinematics, projectile", "url": null }
kinect, rviz, turtlebot, transform How do I get rid of the error? EDIT: tf frames Originally posted by charkoteow on ROS Answers with karma: 121 on 2014-09-25 Post score: 1 Original comments Comment by bvbdort on 2014-09-25: Please share frame.pdf screenshot from rosrun tf view_frames Comment by charkoteow on 2014-09-26: I've updated the question with my frames. Ignore the cart_frame, that's something else that I'm trying to figure out. It can be also caused by openni_launch node if you leave default settings and publish_tf over your urdf model. Set "arg publish_tf" to false in your launch file. Helped in my case. <include file="$(find openni_launch)/launch/openni.launch" > <arg name="publish_tf" value="false" /> </include> Originally posted by Frantisek.Durovsky with karma: 58 on 2014-12-18 This answer was ACCEPTED on the original site Post score: 3 Original comments Comment by charkoteow on 2015-03-03: worked for me too! thank you :) Comment by luc on 2016-12-07: me too! thanks!
{ "domain": "robotics.stackexchange", "id": 19523, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "kinect, rviz, turtlebot, transform", "url": null }
algorithms, correctness-proof, greedy-algorithms Claim $\textbf{6} $. Suppose no course contains any other course. Then there is an optimal schedule containing the course that ends last. Proof: If no course contains any other course, then the class that ends last is also the class that starts last. This claim now follows from Claim 1. Hence, by the general greedy proof strategy described here and by using the above two claims, by induction we can prove that this strategy works.
{ "domain": "cs.stackexchange", "id": 15678, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "algorithms, correctness-proof, greedy-algorithms", "url": null }
homework-and-exercises, forces, pressure, spring, fluid-statics Title: Balancing forces on a liquid My reasoning is as follows Atmospheric pressure = $P_{0}$; Spring stretch = $x$; Pressure under top piston = $P$ Balancing forces on top piston $kx + P S_1 = P_0 S_1$ Balancing forces on bottom piston $(P+h \rho g) S_2+ mg = P_0 S_2$ Solving the two equations gives $x= \frac{g S_1(m+h\rho S_2)}{kS_2}$ But the answer in the book is different (below). As I have not considered the forces on the liquid directly, the forces applied by the supports play no role. What am I missing? The book answer looks wrong to me. I think $k$ can only appear in combination with $x$, since the tension $T=kx$ in the spring is relevant here but $x$ on its own is not. It could be relevant as a geometrical factor, but there is no length marked $x$ in the diagram. I agree with your answer - except that you should have $k$ in there with $x$. I do not think you are missing anything. Judging by the factor $(S_2-S_1)$ in the book answer, it seems that the forces provided by the supports have been taken into account somehow. Like you, I do not think these are relevant. Whatever effect they have will be transmitted through the fluid, and is taken into account by the excess pressure $P$ at the top of the fluid. You have accounted for all of the forces on the upper and lower pistons and correctly balanced them. So I think the book answer is wrong. HOWEVER : In the limit of $m\rightarrow 0$ and $S_2\rightarrow 0$ our equation gives the tension in the spring as $\rho ghS_1$. This suggests that the spring is supporting the whole weight of the fluid, and supports $A$ and $B$ have no effect. This does not seem right. In this limit the book answer for the tension is $-\frac{hS_2}{S_1}\rightarrow 0$. This means that the spring is in compression as $S_2$ gets smaller.
{ "domain": "physics.stackexchange", "id": 30559, "lm_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, forces, pressure, spring, fluid-statics", "url": null }
To prove this, observe first that the map $y\mapsto f(x_0,y)$ is increasing on $[y_0-\delta,y_0+\delta]$ because $\frac{\partial h}{\partial y}(x_0,y)>0$ on this interval by the choice of $\delta$. Since $f(x_0,y_0)=c$, it follows in particular that $h(x_0, y_0-\delta)<c<h(x_0,y_0+\delta)$. Now the set $$U=\{ x\in\mathbb R;\; h(x,y_0-\delta)<c<h(x,y_0+\delta)\}$$ is an open set in $\mathbb R$ by the continuity of $h$, and $x_0\in U$ by what has just been observed. So one can find an open interval $I_1$ such that $x_0\in I_1\subset U$. If we set $I:=I_0\cap I_1$ then $x_0\in I\subset I_0$ and $$h(x,y_0-\delta)<c<h(x,y_0+\delta)\quad{\rm for\; every\;}x\in I\, .$$ Let us fix any $x\in I$. Then the map $y\mapsto h(x,y)$ is continuous, and it is increasing on $[y_0-\delta, y_0+\delta]$ because $\frac{\partial h}{\partial y}(x,y)>0$ on this interval, and $h(x,y_0-\delta)<c<h(x,y_0+\delta)$. By the intyermediate value theorem, it follows that there exists a unique $y=y(x)\in [y_0-\delta, y_0+\delta]$ such that $h(x,y(x))=c$. This concludes Step 1.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9895109093587028, "lm_q1q2_score": 0.8112933960422475, "lm_q2_score": 0.8198933315126791, "openwebmath_perplexity": 84.24019310018096, "openwebmath_score": 0.9631057381629944, "tags": null, "url": "https://math.stackexchange.com/questions/801644/show-there-exists-g0-1-to-mathbbr2-such-that-h-circ-g-constant-g-co" }
python, python-3.x, simulation, physics and then normally-distributed Brownian offset generation becomes def get_random_normal_direction() -> float: return rand.normal(scale=MEMBRANE_DIFFUSION_FACTOR_CORRECTED, size=2) Bounds-checking becomes def is_point_within_bounds( pos: np.ndarray, bounds: np.ndarray, ) -> bool: return ( (bounds[:, 0] <= pos) & (bounds[:, 1] >= pos) ).all() Your initial particle state loses all of its uniqueness concerns, operates on floats only, and becomes def init_particles(self) -> np.ndarray: return rand.uniform( low=-CORRECTED_CANVAS_RADIUS, high=CORRECTED_CANVAS_RADIUS, size=(self.n_particles, 2), ) etc.
{ "domain": "codereview.stackexchange", "id": 43882, "lm_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, simulation, physics", "url": null }
programming-languages, logic, coq Title: positivity condition in Coq/CIC I am recently learning the theory behind Coq and learnt that positivity condition guarantees termination of the program. But my question is, what would you think of the following definition? Inductive t : Set := b : t | c : ((t -> unit) -> unit) -> t.
{ "domain": "cs.stackexchange", "id": 9831, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "programming-languages, logic, coq", "url": null }
ros2 That's not really the "CMake way" and I doubt it'd be accepted into ros2_documentation. Perhaps an IMPORTED library would be better, or a Find...cmake script. target_link_libraries(my_node wiringPi) If you're already linking with -lwiringPi, why link it here again? Comment by inflo on 2021-07-10: I tested it, without target_link_libraries() it returns undefined references to e.g. digitalWrite(), a function from wiringPi lib. Its perhaps not the cmake way, but the official ROS 2 documentation also uses target_link_libraries https://docs.ros.org/en/ros2_documentation/galactic/Guides/Ament-CMake-Documentation.html#adding-dependencies Comment by gvdhoorn on 2021-07-10: Linking libraries using add_compile_options(..) is not something you should do. target_link_libraries(..) is what you should use. Comment by inflo on 2021-07-11: but using add_compile_options() is also recommended by official ROS 2 documentation. https://docs.ros.org/en/galactic/Guides/Ament-CMake-Documentation.html#compiler-and-linker-options states : it is at the moment recommended to use the directory level function add_compile_options(-Wall) to not clutter the code with target-based compile options for all executables and tests. Comment by gvdhoorn on 2021-07-11: You're linking libraries using add_compile_options(..). That's not what it's for. The "ROS 2 documentation" also doesn't recommend that. It states that add_compile_options(..) should be used at directory level if you're going to use add_compile_options(..) for what it is intended in the first place. If you don't believe me, try searching for whether add_compile_options(..) should be used for linking, and don't limit yourself to ROS or ROS 2.
{ "domain": "robotics.stackexchange", "id": 36649, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "ros2", "url": null }
# Why does the monotone convergence theorem not apply on Riemann integrals? I had just learned in measure theory class about the monotone convergence theorem in this version: For every monotonically increasing sequence of functions $$f_n$$ from measurable space $$X$$ to $$[0, \infty]$$, $$\text{if}\quad \lim_{n\to \infty}f_n = f, \quad\text{then}\quad \lim_{n\to \infty}\int f_n \, \mathrm{d}\mu = \int f \,\mathrm{d}\mu .$$ I tried to find out why this theorem apply only for a Lebesgue integral, but I didn't find a counter example for Riemann integrals, so I would appreciate your help. (I guess that $$f$$ might not be integrable in some cases, but I want a concrete example.) Riemann integrable functions (on a compact interval) are also Lebesgue integrable and the two integrals coincide. So the theorem is surely valid for Riemann integrals also. However the pointwise increasing limit of a sequence of Riemann integrable functions need not be Riemann integrable. Let $$(r_n)$$ be an ennumeration of the rationals in $$[0,1]$$, and let $$f_n$$ be as follows: $$f_n(x) = \begin{cases} 1 & \text{if x \in \{ r_0, r_1, \dots, r_{n-1} \}} \\ 0 & \text{if x \in \{ r_n, r_{n+1}, \dots \}} \\ 0 & \text{if x is irrational} \\ \end{cases}$$ Then the limit function is nowhere continuous, hence not Riemann integrable.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9840936050226357, "lm_q1q2_score": 0.8324865446836576, "lm_q2_score": 0.845942439250491, "openwebmath_perplexity": 136.06907814625256, "openwebmath_score": 0.9548375606536865, "tags": null, "url": "https://math.stackexchange.com/questions/3455580/why-does-the-monotone-convergence-theorem-not-apply-on-riemann-integrals/3455594" }
homework-and-exercises, momentum, energy-conservation, collision Title: Question About Collisions Between Neutrons I came across this question from AP Classroom that asked something along the lines of, Neutron A was traveling at velocity: $v$ and has wavelength $\lambda$. It then hit neutron B and after the collision both protons were traveling at velocity: $v'$ each. What is the new wavelength of neutron A? So I initially decided to use the conservation of momentum. $$mv=mv'+mv' \Rightarrow v=2v' \Rightarrow \frac{1}{2} v=v' $$ The equation $\lambda=\frac hp$ states that halving the momentum would double the wavelength thus the new wavelength should be $2\lambda$. It turns out that the answer was actually $\sqrt{2} \lambda$. The explanation stated that since this is a collision between neutrons, kinetic energy was conserved, so $$v^2=2v'^2 \Rightarrow \frac {1}{\sqrt 2}v=v' $$ And because of the previous equation decreasing momentum by $\sqrt 2$ would increase wavelength by that amount giving you the answer of $\sqrt{2} \lambda$. What went wrong when I used the conservation of momentum? From what I understand, all collisions must adhere to that law. You are not told that the collision happens in 1D, and momentum is a vector quantity. So it is true that $$m\mathbf v_0=m\mathbf v_A+m\mathbf v_B$$ where $|\mathbf v_A|=|\mathbf v_B|=v'$. But it is not true in general that $mv=2mv'$. In fact, you have shown that for the specific elastic collision here the collision cannot be in 1D, as we would not be able to conserve both momentum and energy in this way (the collision can actually occur in 2D though). However, kinetic energy is a scalar quantity. So, if you know your initial kinetic energy and final kinetic energy, and you know the collision is elastic, then you can use $K_\text{init}=K_\text{final}$ without having to worry about the direction of the velocities.
{ "domain": "physics.stackexchange", "id": 63066, "lm_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, momentum, energy-conservation, collision", "url": null }
python, python-2.x def get_malwaredomainlist(self): """ Gets the information from the MDL Feed :return: The IP addresses and domains returned from MDL """ url = 'http://www.malwaredomainlist.com/hostslist/ip.txt' domains = 'http://www.malwaredomainlist.com/hostslist/hosts.txt' results = self.download_file(url).splitlines() results2 = self.download_file(domains).splitlines() for result in results: if len(result) > 0: ip = self.ipgrabber(result.lstrip().rstrip()) if ip: d['malwaredomainlistip'].append(result) for result in results2: result = result.lstrip('127.0.0.1 , ').rstrip() if not result.startswith('#') \ and not result.startswith('localhost') and len(result) > 0: d['malwaredomainlistdomain'].append(result) return d def get_tornodes(self): """ Gets the information from the Torproject overview :return: The IP addresses of the current TOR exit nodes """ url = 'https://check.torproject.org/exit-addresses' results = self.download_file(url).splitlines() for result in results: if len(results) > 0: ip = self.ipgrabber(result.lstrip().rstrip()) if ip: d['tornodeip'].append(ip) return d def get_ransomwaretracker(self): """ Gets the information from the RansomewareTracker Feed :return: The IP addresses returned from RansomewareTracker """
{ "domain": "codereview.stackexchange", "id": 22928, "lm_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-2.x", "url": null }
computability, semi-decidability, mu-recursion Hints In step 1, use dovetailing. Steps 2 and 3 can not disagree. Step 4 only happens when it should. You can show the necessary lemmas using the assumptions on $B$. As you see, we don't care at all if $B$ is finite as we do not care what $M_B$ looks like; we just use it as a black box. Aside: I am not sure that infinite $B$ with all the properties as listed in the question exist. We can ignore this, though: the problems is stated such that we show something for each such $B$ -- if there is none, we are good.
{ "domain": "cs.stackexchange", "id": 7450, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "computability, semi-decidability, mu-recursion", "url": null }
javascript, node.js, async-await, promise Rewrite It is unclear how you intend to handle this code. Nor is the argument router defined. I assume that the function IndexController.index is only for private use. The returned object IndexController is only a husk object to hold the closure. It has no interface. Note indexService returns a parsed result not the JSON text I have created only the one module as they are so tightly integrated. "use strict"; const fetch = require("node-fetch"); const HttpsProxyAgent = require("https-proxy-agent"); const service = { URL: "https://jsonplaceholder.typicode.com/todos/", get agent() { return new HttpsProxyAgent("http://xxx:80") }, }; async function todos(name){ const response = await fetch(service.url + name, {agent : service.agent}); if (response.ok) { return response.json() } throw new Error("Fetch of `" + name + "` failed. "); } const index = async () => todos("1").then(todo => todos(todo.foo === "a" ? "2" : "3")); function IndexController(router) => { router.get("/", (req, res) => index() .then(todos => /*respond with todos data*/) .catch(err => /*respond with service error*/); ); } module.exports = IndexController;
{ "domain": "codereview.stackexchange", "id": 33887, "lm_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, node.js, async-await, promise", "url": null }
Conversely, assume that $X$ is Jacobson. Let $Z \subset U_ i$ be closed. Then $X_0 \cap \overline{Z}$ is dense in $\overline{Z}$. Hence also $X_0 \cap Z$ is dense in $Z$, because $\overline{Z} \setminus Z$ is closed. As $X_0 \cap U_ i \subset U_{i, 0}$ we see that $U_{i, 0} \cap Z$ is dense in $Z$. Thus $U_ i$ is Jacobson as desired. $\square$ Lemma 5.18.5. Let $X$ be Jacobson. The following types of subsets $T \subset X$ are Jacobson: 1. Open subspaces. 2. Closed subspaces. 3. Locally closed subspaces. 4. Unions of locally closed subspaces. 5. Constructible sets. 6. Any subset $T \subset X$ which locally on $X$ is a union of locally closed subsets. In each of these cases closed points of $T$ are closed in $X$. Proof. Let $X_0$ be the set of closed points of $X$. For any subset $T \subset X$ we let $(*)$ denote the property: • Every nonempty locally closed subset of $T$ has a point closed in $X$. Note that always $X_0 \cap T \subset T_0$. Hence property $(*)$ implies that $T$ is Jacobson. In addition it clearly implies that every closed point of $T$ is closed in $X$. Suppose that $T=\bigcup _ i T_ i$ with $T_ i$ locally closed in $X$. Take $A\subset T$ a locally closed nonempty subset in $T$, then there exists a $T_ i$ such that $A\cap T_ i$ is nonempty, it is locally closed in $T_ i$ and so in $X$. As $X$ is Jacobson $A$ has a point closed in $X$. $\square$
{ "domain": "columbia.edu", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9869795125670754, "lm_q1q2_score": 0.8224743028912161, "lm_q2_score": 0.8333245953120233, "openwebmath_perplexity": 151.07212500491295, "openwebmath_score": 0.9704275131225586, "tags": null, "url": "https://stacks.math.columbia.edu/tag/005T" }
ros, gazebo, ros-kinetic, beginner Title: How much time do I need (approximately) to learn ROS and create my own package? i want to create my own package (catkin, etc., + simple URDF model, adding sensors and programming it for autonomous navigation in Gazebo) . I have just started to learn ROS thoroughly. I want to use python programming language to program my simulated robot model. Just give me advice... How much time do i need ? Originally posted by ARS on ROS Answers with karma: 15 on 2020-02-14 Post score: 0 A week or two sounds like a realistic period. You already know all you need to do. Before Gazebo, look at stage for a 2d simulation which is much simpler to get running. Turtlebot simulation packages are a good place to start Originally posted by Mehdi. with karma: 3339 on 2020-02-14 This answer was ACCEPTED on the original site Post score: 1 Original comments Comment by ARS on 2020-02-15: thank you) It would be good if I had a mentor in robotics , but anyway there are many robotics forums like this one and It's so nice)
{ "domain": "robotics.stackexchange", "id": 34435, "lm_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-kinetic, beginner", "url": null }
magnetic-fields, electromagnetic-induction Title: Does one element of a current carrying wire exert a force on another element of the same wire? Lorentz force $\vec F$ for an external magnetic field $\vec B$ is $$ \vec F = q \vec v \times \vec B $$ and the magnitude of this force is $ F = (qv \times B) \sin \theta $. According to this equations Lorentz force is perpendicular to both the magnetic field and the direction of the movement of the electrons. So the only possible way for a current carrying wire to exert a force on elements of the same wire is to bend one portion of the wire to some angle $ \theta$ with the other wire. Am I right? Is there any other way too? Current in a wire certainly does exert internal forces. The wire is slightly compressed (to a smaller diameter) due to that internal force. This is an important effect in high-current discharges, and is called 'Z-pinch'. It presumably is also dominant in the "exploding wires" effect, and in the lightning-strike mineral, "fulgurite", which adopts a long thin shape. A curved wire, of course, generates a variety of forces; a solenoid, for example, where current is circumferential in a cylinder, will both expand in radius and decrease in length when a high current is applied. Very high field magnets are of odd design because such forces can exceed the material strength of the wire (or machined alloy), e.g. a Bitter magnet.
{ "domain": "physics.stackexchange", "id": 38218, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "magnetic-fields, electromagnetic-induction", "url": null }
cosmology, black-holes, temperature, event-horizon, low-temperature-physics Title: What is the temperature of the event horizon? In a discussion with my son about absolute zero, we arrived at the conclusion that the event horizon might be the place to look, as it "absorbs?" all energy, including light. Found this in the community which supports the idea that it's pretty cold to the touch: Lowest temperature possible in the universe? Don't know enough about blackbody radiation to say, but my understanding of black holes is that anything they can't eat gets stretched, shredded, spun and ejected in jets from the poles, which leads me back to: If we could get close enough to the event horizon to get a measure free from the influence of the "inedible" stuff's temperature, which I would think would have to be pretty close, just how cold would the "outside" of the event horizon, at the point where it's "absorbing" all matter and energy, including light, be? Things would be moving, which contradicts absolute zero rules, but if all energy is being absorbed at the EH, we must be pretty close. Current theory suggests that the "inside surface" of the EH should be violently hot, but the temperature of the "outside surface" would almost certainly have to be very cold, wouldn't it? With your description, if no radiation comes back from the surface of the black hole, the temperature should be the vacuum classical temperature, 0 Kelvin. BUT Hawking predicted a radiation coming out from quantum mechanical interactions with the vacuum at the limits of the event horizon. Hawking showed that quantum effects allow black holes to emit exact black body radiation. The electromagnetic radiation is produced as if emitted by a black body with a temperature inversely proportional to the mass of the black hole. So it depends on the mass of the black hole what black body radiation spectrum it would radiate, which will define the temperature at the event horizon. A black hole of one solar mass (M☉) has a temperature of only 60 nanokelvin (60 billionths of a kelvin); This is still a theoretical prediction as such small temperatures from cosmic bodies cannot be measured.
{ "domain": "physics.stackexchange", "id": 25946, "lm_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, black-holes, temperature, event-horizon, low-temperature-physics", "url": null }
arduino, ros-kinetic, turtlesim, rosserial-arduino Title: How to control turtlesim by a publisher data sent by arduino rosserial I'm noob in ROS, and i used this aduino code to send Float64 data to ros #include <std_msgs/Float64.h> ros::NodeHandle nh; std_msgs::Float64 float_msg; ros::Publisher chatter("chatter", &float_msg); float x = 5; void setup() { nh.initNode(); nh.advertise(chatter); } void loop() { float_msg.data = x; chatter.publish( &float_msg ); nh.spinOnce(); delay(1000); } then i used the following command to control turtle sent publisher data rostopic pub -1 /turtle1/cmd_vel geometry_msgs/Twist -- '[chatter, 0.0, 0.0]' '[0.0, 0.0, 1.8]' but it doesn't read chatter as Float64 data so it doesn't work , even i checked rostopic info chatter and it had float64 data type Thanks in advance Originally posted by requestadepache on ROS Answers with karma: 3 on 2019-07-26 Post score: 0 rostopic is not the right command for republishing the content of one topic as a separate message on another topic since it does not evaluate the arguments passed ('[chatter, 0.0, 0.0]' '[0.0, 0.0, 1.8]'). rostopic pub -1 /turtle1/cmd_vel geometry_msgs/Twist -- '[chatter, 0.0, 0.0]' '[0.0, 0.0, 1.8]'
{ "domain": "robotics.stackexchange", "id": 33534, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "arduino, ros-kinetic, turtlesim, rosserial-arduino", "url": null }
multiplication, Entry-by-Entry commutative, it associative... At ) ij = A properties of matrix multiplication proof ∀ i, j AB ) C = AC + BC 5 the 1! And columns consisting of only zero elements is called A zero is not commutative it! We can have A 2 = 0 1 0 0 0 0 1 0 0 )... Ia = AI =A is occupied by the number 1 … Subsection matrix! Of matrices are such that the products are defined diagonal are equal zero. + C ) = AB + AC ( A + B ) C = AC + BC 5 of. Associative property of matrix multiplication is not commutative, it is associative in the form of and. Identity matrix of the same order such that IA = AI =A Verify the associative property matrix! ) = AB + AC ( A + B ) C = (! A ( B + C ) = AB + AC ( A + B ) C = AC + 5. Provides an alternate means of multiplying two matrices products are defined numbers in..., Entry-by-Entry: A ( BC ) 4 ji ∀ i, j such that the products are defined 4. Important properties of multiplication do not hold, many more do A ( B + C ) = AB AC. Rows and columns in the following sense ) ij = A ( B + C ) = +! Will simplify the process because it contains A zero matrix or null matrix 1 this! C = A ( BC ) 4 For every square matrix is an array of arranged! The following sense ij = A ji ∀ i, j C A... Associative law: A ( BC ) 4 0 even though A ≠ 0 but,! Every square matrix A, there exists an Identity matrix of the order... Equal to zero of multiplying two matrices the number 1 … Subsection MMEE multiplication. That the products properties of matrix multiplication proof defined A, there exists an Identity matrix the... Form of rows and columns more do or column all its elements the! Verify the associative property of matrix multiplication … matrix multiplication … matrix multiplication that the products defined. Hold only when the size of matrices are such that the products are defined, there exists Identity... ” properties of transpose even though matrix multiplication we select any row or column multiplication! Law:
{ "domain": "quali-a.com", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9697854138058637, "lm_q1q2_score": 0.8509641972213056, "lm_q2_score": 0.8774767954920548, "openwebmath_perplexity": 321.55312251542614, "openwebmath_score": 0.8621492385864258, "tags": null, "url": "https://www.quali-a.com/ncqyu/archive.php?tag=4c2715-properties-of-matrix-multiplication-proof" }
Logically speaking, if $z = x^2,\;$ then $\;dz = 2x\,dx$. But it is not necessarily the case that if $\;dz = 2x\,dx,\;$ then $\;z = x^2.\;$ This direction of the implication would only be appropriate if we qualify it: $\;$if $\;dz = 2x\, dx,\;$ then $\;z = x^2 + C\;$ for some constant $C$. So the implication in this step is one-directional: $$z= x^2 \implies dz = 2x \,dx.$$ Your second step, however, uses merely an algebraic equivalence: $ab = c \iff b = \dfrac{c}{a}, \;\;a \neq 0$. So in this step it's appropriate to express this as a bi-directional implication: $$dz = 2x\,dx \iff dx = \frac {1}{2x}\,dz, \quad x \neq 0$$ • Deserves a thumbs - up! +1 – Amzoti May 3 '13 at 0:22 Yes, it is the same constant once you substitute $x^{2}$ back into the equation, but without initial values (initial conditions) it doesn't really matter because it is still an unknown constant value. As pointed out in comments above, the derivative operation is not true both ways. The algebraic steps can be $\iff$ however. So you could write: $z=x^2\implies \mathrm dz=2x\,\mathrm dx\iff \mathrm dx=\frac{\mathrm dz}{2x}$
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9632305328688783, "lm_q1q2_score": 0.820626949608705, "lm_q2_score": 0.8519528000888387, "openwebmath_perplexity": 299.6827412765204, "openwebmath_score": 0.9564781188964844, "tags": null, "url": "https://math.stackexchange.com/questions/379312/questions-about-integration-by-substitution" }
ros, jenkins, ros-kinetic you cannot do this. It's both not how tags are supposed to work, and doesn't solve the problem you're seeing. But, the Jenkins job still failed with the same error. The reason is that the buildfarm does not clone your source repository when it runs a binary job. Nor do source jobs. Bloom commits the tagged version from your source repository to your release repository and that repository is then fetched by the various jobs on the buildfarm. They only run though when they notice you've (re)released your package. To figure out whether you've done that, the relevant distribution.yaml is checked (for a newer version number). Right now, if the buildfarm needs to rebuild your package (because of a release of one of your dependencies for instance), it will fetch your current released version from your release repository (which still has the problem) and nothing will change. The only proper way to fix the dependency issue is to release your package again. Suggested steps: revert your changes to your 1.0.0 tag: let it point to whatever commit is was pointing to before you changed it. You should not change tags like that in any case follow the Releasing a new version of a catkin package tutorial. So (but make sure to follow the tutorial): update your changelog create a new tag run Bloom After you submit the PR and it gets accepted, the source job will fetch your new version (with the fix) and the binary jobs will start building your new version. Originally posted by gvdhoorn with karma: 86574 on 2021-01-17 This answer was ACCEPTED on the original site Post score: 0 Original comments Comment by qinyunchuan on 2021-01-17: Thanks for your reply. Thank you very much. But I am still a little confused. Why the Jenkins job runs everyday with the same error, with same code. And the we could do nothing except waiting for the PR to be acceped? Comment by gvdhoorn on 2021-01-17: It would help if you could link to your Jenkins jobs. Right now we're just guessing.
{ "domain": "robotics.stackexchange", "id": 35974, "lm_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, jenkins, ros-kinetic", "url": null }
experimental-physics, pressure, bernoulli-equation Title: Differential pressure sensor applications I have two differential sensors and in my experiment I wish to measure the air pressure from below and on top of the ball that is levitated by air. These are my 3 possible setups. Considering the 3 setups what is the best and most accurate way of measuring $P_1$ and $P_2$ ? Setup A Utilizes only one differential sensor that measures the dynamic pressure from above the ball and below the ball. Setup B Utilizes two differential sensors and a Pitot tube to measure static and dynamic pressure and get its difference. Setup C Utilizes two differential sensors, with a similar concept as that of a pitot tube and gets the difference between the dynamic and static pressure from the top and below the ball. Use setup "A" to measure differential pressure. Any drift in each pressure measurement will not be seen if you use one differential pressure cell, but any drift WILL be seen, and will be unpredictable, if you use two separate differential pressure cells to take your readings. Note - setup "A" is very commonly used in industry, where a LOT of differential pressure readings are taken every day (e.g., millions of readings). If you also need a static pressure reading at the same time that you are getting a differential pressure reading, use a separate pressure measuring device to get that reading.
{ "domain": "physics.stackexchange", "id": 57156, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "experimental-physics, pressure, bernoulli-equation", "url": null }
beginner, haskell, recursion, interpreter, brainfuck when (codePos /= (snd . bounds $ cs)) $ do case cs ! codePos of '+' -> tapeAtPos += 1 '-' -> tapeAtPos -= 1 '>' -> mTapePos += 1 '<' -> mTapePos -= 1 '[' -> branch (== 0) next ']' -> branch (/= 0) prev '.' -> lift (putChar $ chr value) ',' -> do { c <- lift getChar; mTape %= S.update tapePos (ord c) } _ -> return () mCodePos += 1 execCode tape = S.fromList $ replicate 30000 0 csFromString file = listArray (0, length file - 1) file main = readFile "example.bf" >>= execCode' tape . csFromString One more iteration of tuning for execCode' to make code more uniform which is good for readability and maintenance: tapeAtPos is made a self-contained compound lens, without reliance on tapePos and tapeAtPos is moved out of execState' body to global scope, and renamed to mTapeAtPos uniformly with other lenses value is renamed tapeAtPos as it corresponds to mTapeAtPos mTapeAtPos is used uniformly for both getting and updating the value everywhere including the getChar branch unsafeUse helper is used to get tapeAtPos uniformly with codePos. It is called unsafe because tapeAtPos may fail if mTapePos is out of range! lens API is used to read code uniformly with reading tape extra parenthesis/$ are removed from when condition M ... <- get is removed as it is not used anymore The code: mTapeAtPos f m = (mTape . ix (m ^. mTapePos)) f m unsafeUse traversal = (^?! traversal) <$> get
{ "domain": "codereview.stackexchange", "id": 10870, "lm_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, haskell, recursion, interpreter, brainfuck", "url": null }
The approach is correct, but the answer is wrong. There are 145 zeros from 1 to 751: 9 zeros from 1 to 99, 120 zeros from 100 to 699 (20 x 6) and 16 zeros from 700 to 759 Total: 9+120+16 = 145. - You are right - here is a Mathematica code to check With[{x = 751}, Count[Flatten[IntegerDigits /@ Table[x - n, {n, 0, x - 1}]], 0]] – Norbert Oct 17 '12 at 5:50 There's a nice algorithm for doing this calculation which is explained here. If $x$ is the number we're given, $f(x)$ is the number of zeros that appear in the range $1..x$. Using a simple program we can calculate $f(x)$ for some small values to spot a pattern. public int CountZerosInRangeOneTo(int end) { return Enumerable.Range(1, end) .Select(i => i.ToString()) .SelectMany(s => s.ToCharArray()) .Count(c => c == '0'); } For example: f(5 ) = 0 f(52 ) = 5 f(523 ) = 102 f(5237 ) = 1543 f(52378) = 20667 If $y$ is the new single digit number added to the end each time, it would appear the following is true: $f(10x + y) = 10 \cdot f(x) + x$ For example, if $x = 523$, $y = 7$, and $f(x) = 102$, then: $f(10 \cdot 523 + 7) = f(5237) = 10 \cdot f(x) + x = 10 \cdot 102 + 523 = 1543$ Fantastic. However, where this breaks down is when $x$ contains zeros itself. For example:
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.96741025335478, "lm_q1q2_score": 0.8123672523564706, "lm_q2_score": 0.83973396967765, "openwebmath_perplexity": 307.40823444877793, "openwebmath_score": 0.7271061539649963, "tags": null, "url": "http://math.stackexchange.com/questions/80918/find-the-total-number-of-zeros-in-given-range-of-decimal-numbers/80964" }
computer-architecture, operating-systems According to me, answer should be A,D. But according to some of my colleagues, answer is B,C. Having nuked the question, let's play jeopardy and try to figure out what question you and your colleagues are answering. Basically, to misquote a famous crook, you're having a disagreement over what the word "represents" represents. One thinks it is the memory representation in little-endian (although it is written wrong in the question, and honestly if the word "memory" was mentioned it wouldn't hurt for ease of comprehension) and the other thinks it's the integer itself (probably because the 0x values are written as integers not bytes). So you're both picking from a different column of my table above. We will have to wait for the end of the war between little endians and big endians to know what the peace treaty says about who's right. Another way to not fix the question would be: If the memory representation of a 2-byte unsigned integer on a little endian computer looks like it is 255 more than that on a big endian computer to a human reading the memory bytes in big endian order, which of the following choices represent(s) the unsigned integer? However, this reveals to all the rampant systemic endianness supremacy asserting that humans of the wrong endianness are lower-class citizens. This implicit endianness bias and oppression must stop! As of today, the DIE commitee dictates that everyone will switch to the more inclusive and safe middle-endianness, and both-endians colonizers will be sentenced to pay reparations to native middle-endians.
{ "domain": "cs.stackexchange", "id": 17819, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "computer-architecture, operating-systems", "url": null }
moveit, octomap, ros-kinetic, octomap-server Originally posted by Krebsileinchen on ROS Answers with karma: 51 on 2019-05-31 Post score: 0 Original comments Comment by S.Yildiz on 2019-06-03: Did you try to change the value from world to odom? Comment by Krebsileinchen on 2019-06-03: I actually don't have an /odom frame Comment by S.Yildiz on 2019-06-03: I can share you my experience: I had the similiar problem and when I changed the frame to odom it worked. So maybe you have to change the world frame to another frame Comment by S.Yildiz on 2019-06-03: And you could check, if you get proper point cloud data Comment by Krebsileinchen on 2019-06-03: I played around a bit with different frames but so far not successful. Did you work with the percepton pipeline or with the octomap server? I can display the point cloud I am trying to process but I don't see any points when trying to display /filtered_cloud or /octomap_point_cloud_centers For everyone who's interested: In the end I found the solution and it was very simple. I just increased the sensor_model/max_range to 50. Update 18.09.2019: Actually my answer given before was not my main problem as I found out today. At that point I had just lost track of the different things I tried. The real error was that at first I added the parameter definitions and especially the load config definition just to my main launch file starting the visualization. Instead it needs to be added (at least the load config) to the repective sensor_manager.launch file of the robot. Originally posted by Krebsileinchen with karma: 51 on 2019-06-03 This answer was ACCEPTED on the original site Post score: 0 Original comments Comment by gvdhoorn on 2019-06-03: Was this because the environment in the static cloud you have extends beyond the 5 m range initially configured? Comment by Krebsileinchen on 2019-06-05: the environment itself was not bigger but it was displaced from the world frame and therefore out of range
{ "domain": "robotics.stackexchange", "id": 33096, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "moveit, octomap, ros-kinetic, octomap-server", "url": null }
image-processing, cross-correlation, statistics Title: Normalized cross-correlation in detail I'm trying to implement a normalized cross-correlation algorithm but I don't get what in fact is this measure. What confuses is the wikipedia definition: $\frac{1}{n} \sum \frac{(f(x,y)- \overline{f})(t(x,y)- \overline{t}) }{\sigma_{f}\sigma_{t}}$ Which result is an scalar (AFAIK) But then adds other way to measure it: $\left \langle \frac{F}{\left \| F \right \|},\frac{T}{\left \| T \right \|} \right \rangle $ Where $F$ and $T$ are normalized vectors and $\left \langle . , . \right \rangle$ is the inner product. But the output will be a vector, isn't? Isn't supposed to give me a scalar as well? Am I getting something wrong? The idea is to implement this formula and use it with matrices with same dimensions. Thank you An individual inner product does produce a scalar, but often when a cross correlation is calculated multiple individual cross correlations (i.e. dot products) are calculated at different time offsets. These individual scalar results form a vector that is indexed by the relative time offset.
{ "domain": "dsp.stackexchange", "id": 1349, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "image-processing, cross-correlation, statistics", "url": null }
\begin{proof} Let $R \to A$ be a ring map. Let $M$ be an $A$-module. If $M$ is $R$-flat, then for all primes $\mathfrak q$ the module $M_{\mathfrak q}$ is flat over $R_{\mathfrak p}$ with $\mathfrak p$ the prime of $R$ lying under $\mathfrak q$. Conversely, if $M_{\mathfrak q}$ is flat over $R_{\mathfrak p}$ for all primes $\mathfrak q$ of $A$, then $M$ is flat over $R$. See Algebra, Lemma \ref{algebra-lemma-flat-localization}. This equivalence easily implies the statements of the lemma. \end{proof} There are no comments yet for this tag. There is also 1 comment on Section 28.24: Morphisms of Schemes. ## Add a comment on tag 01U4 In your comment you can use Markdown and LaTeX style mathematics (enclose it like $\pi$). A preview option is available if you wish to see how it works out (just click on the eye in the lower-right corner).
{ "domain": "columbia.edu", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.977713811213884, "lm_q1q2_score": 0.8060878038043736, "lm_q2_score": 0.8244619177503205, "openwebmath_perplexity": 169.1838262659287, "openwebmath_score": 0.9565424919128418, "tags": null, "url": "http://stacks.math.columbia.edu/tag/01U4" }
quantum-mechanics, quantum-spin, hydrogen where the integration should be (at least classicaly) along the current loop. Here, I get stuck. Does anyone know how to get the $\textbf{L}\cdot\textbf{S}$ factor from this approach? The problem here is that you're looking at the magnetic field $\textit{at the proton}$. Using this approach you can't derive the spin-orbit coupling that you want. Because of the symmetry of the system you would expect the magnetic fields at each particle to have the same magnitude, but the energy of spin-orbit coupling comes from the $\textit{electron's}$ spin interacting with the magnetic field. Usually self-interaction isn't included in these calculations. The important thing to note is from the rest frame of the nucleus there is no magnetic field due to the nucleus, ignoring contributions from the nuclear magnetic moment. You're actually very very close to another part of the hydrogen spectrum, which is the hyperfine structure. There will be another contribution to the energy of the hydrogen atom due to the nuclear spin interacting with the magnetic field from the electron. In the case of the hyperfine structure you need also to consider the magnetic field caused by the electron spin $\vec{\mu} \propto \vec{S}$, which, once combined with the calculation you're in the midst of doing, will yield another perturbation to the Hamiltonian $\propto \vec{I} \cdot \vec{J}$. To solve your problem I believe you'd need to use Dirac's equation.
{ "domain": "physics.stackexchange", "id": 17443, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "quantum-mechanics, quantum-spin, hydrogen", "url": null }
performance, programming-challenge, haskell, primes sieveSundaram :: Int -> [Int] sieveSundaram n = 2:(removeComposites [1..n'] (marked n')) where n' = quot (bound n) 2 pe_007 = last (take n (sieveSundaram n)) where n = 10001 main :: IO () main = do print pe_007 The first thing to try is enable compiler optimization level 2 by adding: {-# OPTIONS_GHC -O2 #-} to the start of your file. This reduced my execution time by 9%. Next I removed the limits to take advantage of Haskell's laziness. {-# OPTIONS_GHC -O2 #-} -- doesn't work import Data.List marked :: [Int] marked = [ i + j + 2*i*j | i <- [1..], j <- [i..]] removeComposites :: [Int] -> [Int] -> [Int] removeComposites [] _ = [] removeComposites (s:ss) [] = 2*s + 1 : removeComposites ss [] removeComposites (s:ss) (c:cs) | s == c = removeComposites ss cs | s > c = removeComposites (s:ss) cs | otherwise = 2*s + 1 : removeComposites ss (c:cs) sieveSundaram :: [Int] sieveSundaram = 2:(removeComposites [1..] marked) pe_007 = last (take n (sieveSundaram)) where n = 100001 main :: IO () main = do print pe_007 Unfortunately that doesn't work because marked ends up being [4,7,10,13,16,19,22,25..] which is just i=1 and j<-[1..]. To solve this I generated a list for each i and merged the lists together using a fold. {-# OPTIONS_GHC -O2 #-} -- compiled execution time for 100001 is 0.877s (about 27% better)
{ "domain": "codereview.stackexchange", "id": 12355, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "performance, programming-challenge, haskell, primes", "url": null }
&[(p_1\land p_2\land\cdots\land p_k\land p_{k+1})\to p_{k+2}]\land[p_{k+1}\to p_{k+2}]\\[0.5em] &\Downarrow\qquad \text{(since $a\land b\to a$)}\\[0.5em] &(p_1\land p_2\land\cdots\land p_k\land p_{k+1})\to p_{k+2}\\[0.5em] &\equiv \text{RHS}, \end{align} we obtain the right-hand side of $S(k+1)$, which completes the inductive step.
{ "domain": "bootmath.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.990440601781584, "lm_q1q2_score": 0.8418459627152889, "lm_q2_score": 0.8499711756575749, "openwebmath_perplexity": 199.96245207569135, "openwebmath_score": 0.8994497060775757, "tags": null, "url": "http://bootmath.com/what-exactly-is-the-difference-between-weak-and-strong-induction.html" }
java, performance, multithreading, n-queens public Karalienes(int n,int column, int places[]) { this.n = n; this.column = column; this.places = places; stack = new Stack<Karalienes>(); } public static void setMaxGSK(int sk) { this.maxThreads = sk; } private boolean arOk(int row, int column) { boolean ok = true; int tmpColumn = column-1; for(; tmpColumn>=1; tmpColumn--) { if ((places[tmpColumn]-row)==0) { ok = false; break; } int rowDiff = places[column] - places[tmpColumn]; if (rowDiff < 0) rowDiff = 0 - rowDiff; if (rowDiff == column-tmpColumn) { ok = false; break; } } return ok; } public void deliojam() { for(int i=1; i<=n ; i++ ) { //dirbam su row places[column] = i; if (arOk(i, column)) { if (column<n) { int gSk; synchronized (startedThreads) { gSk = startedThreads; } if (gSk < maxThreads) { Karalienes kar = new Karalienes(n, column+1, places.clone()); kar.start(); stack.add(kar); } else { column++; deliojam(); column--; } } if (column==n) { Karalienes.incVariantuSkaiciu(); } } } while (stack.size()!=0) { try { stack.pop().join(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } @Override public void run() { // TODO Auto-generated method stub Karalienes.incGijuSk(); deliojam(); Karalienes.decGijuSk(); }
{ "domain": "codereview.stackexchange", "id": 1584, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "java, performance, multithreading, n-queens", "url": null }
also a side of length a. Writing code in comment? Let the radius of the incircle be r. ⇒ Area of this circle = πr 2 = 154 (22/7) × r 2 = 154 ⇒ r 2 = 154 × (7/22) = 49 ∴ r = 7 cm Recall that incentre of a circle is the point of intersection of the angular bisectors. person_outlineTimurschedule 2011-06-24 21:08:38. Perimeter: Semiperimeter: Area: Altitude: Median: Angle Bisector : Circumscribed Circle Radius: Inscribed Circle Radius: Right Triangle: One angle is equal to 90 degrees. The length of the base of an isosceles triangle is 4 inches less than the length of one of the... What is the value of the hypotenuse of an isosceles triangle with a perimeter equal to #16 + 16sqrt2#? Physics. Let a be the length of the sides, A - the area of the triangle, p the perimeter, R - the radius of the circumscribed circle, r - the radius of the inscribed circle, h - the altitude (height) from any side.. Please give the answer in details. Radius of a circle inscribed. Given the side lengths of the triangle, it is possible to determine the radius of the circle. Thus, #s=2sqrt3# and the height of the triangle can be found through #a+h=2+1=3#. edit close. Equilateral triangle formulas. Now, radius of incircle of a triangle = where, s = semiperimeter. generate link and share the link here. Find the length of one side of an equilateral triangle inscribed in a circle of the measure of a radius is 10 radical 3? Equilateral triangles are the only triangles whose Steiner inellipse is a circle (specifically, it is the incircle). where r is the radius of incircle (due to M. Schreiber (1935), see [7], [13]). I think that's about as good as I'm going to be able to do. The segments into which one side is divided by the points of contact are 36 cm and 48 cm. around the world. Equilateral Triangle: All three sides have
{ "domain": "languageoption.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9678992932829917, "lm_q1q2_score": 0.8044627726874581, "lm_q2_score": 0.8311430520409023, "openwebmath_perplexity": 627.7715200771131, "openwebmath_score": 0.7700090408325195, "tags": null, "url": "http://languageoption.com/chov-tv-oid/txny1.php?1cbd7f=radius-of-incircle-of-equilateral-triangle" }
linear-programming, integer-programming Title: ILP and number of variables in constraints This question is about the time impact of the length (i.e. number of variables) of the constraints in an Integer Linear Programming formulation. Most people try to reach the minimum number of constraints/variables, but I couldn't find anything that considers the size of the constraints. In more concrete terms, I have some maximization problem for which I can make two different formulations $A$ and $B$. Both have $O(n^2)$ variables, $n$ being the size of the input. Formulation $A$ has $O(n^3)$ constraints, each having a constant number of variables (say each constraint is a summation over four variables). Formulation $B$ has $O(n^2)$ constraints, but many constraints are of linear size - i.e. they include summations over $O(n)$ variables. In terms of performance, does $B$ have an advantage over $A$ ? There are no hard rules for which formulation would be better especially for mixed-integer problems, however The time to solve an lp relaxation usually increases with the number of nonzeros in the constraint matrix, but Tighter lp relaxations usually reduce the number of lp relaxations that need to be solved. To take your example, suppose you have a variable $y$ that is 1 only if all variables $x_0, x_2, \ldots, x_{n-1}$ have value 1, and all values are binary. You could write a single constraint $$ny \le \sum_{i=0}^n x_i$$ or $n$ constraints $$y \le x_i, \forall i \in \{0, \ldots n-1\}$$ Both sets of constraints will have the same integer-feasible set, but the $n$ constraints have a much smaller continuous-feasible set, so it is probably be much faster to solve.
{ "domain": "cs.stackexchange", "id": 3994, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "linear-programming, integer-programming", "url": null }
milky-way Title: Are there any colored RAW photos of the Milky Way taken from space? We can get RAW versions for many ISS images, like those of airglow, e.g. ISS043-E-143486. But all the photos of the Milky Way taken from ISS that I found were posted on Twitter (e.g. this, Flickr or other social networks heavily tone-mapped, it's not possible to get the RAW sources, and apparently they are not in public domain as those obtainable from the NASA website. But maybe I've missed something, or some other missions than ISS have colored RAW photos of the Milky Way. Or, if there are any colored colorimetrically calibrated images taken in the visible spectrum from space, this would also suit my needs. I know there is Axel Mellinger's panorama, available as a FITS file from this page. But this one was made from Earth-based photos, so I'm not completely convinced of its hue correctness; besides, with the FITS data I failed to reproduce the hues from the JPEG preview like this one. So, are there any non-tone-mapped or RAW images of the Milky Way taken from space available to the general public? Among astronaut photographs https://eol.jsc.nasa.gov/SearchPhotos/photo.pl?mission=ISS044&roll=E&frame=45215 is a photo of airglow with the Milky Way in the background. A "RAW" image (actually NEF, Nikon's RAW file format) is available. This may be suitable for your requirements. Only a small part of the Milky Way is visible, and there is considerable motion blur on the whole image. It was taken from space, but through the glass of the ISS viewing dome.
{ "domain": "astronomy.stackexchange", "id": 6953, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "milky-way", "url": null }
physical-chemistry, terminology, units, filtering Title: What is a Herzberg? Whatman lists the flow rates for their filters in a unit called a 'Herzberg': What is this? I've been searching around and I did find information about Herzberg flow rate testers, for example this old paper on filtration flow rate measurement and this summary of filtration terminology, but I can't seem to find two sources that agree with eachother. The clearest looking description I found was that second link above, which states: Whatman quantifies liquid flow rate for its range of filters by using a Herzberg flow rate tester. Prefiltered deaerated water is applied to the test filter (effective area $\pu{10 cm2}$) at a constant hydrostatic head ($\pu{10 cm}$). The rate of the flow is measured in seconds per $\pu{100 mL}$. Flow rate can also be measured by the modified ASTM method which uses a quadrant folded filter held in a wire loop. It is not considered to be as reliable or consistent as the Herzberg test.
{ "domain": "chemistry.stackexchange", "id": 14286, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "physical-chemistry, terminology, units, filtering", "url": null }
human-biology, cell-biology Title: What kinds of cells does human saliva contain? I have heard that our saliva contains cells. What cell types can be found in human saliva? It contains white blood cells (leukocytes) and cells from the inner lining of the mouth (buccal epithelial cells). The DNA obtained from these cells is the basis of DNA profiling based on saliva samples. Source: Salimetrics
{ "domain": "biology.stackexchange", "id": 3404, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "human-biology, cell-biology", "url": null }
c++, object-oriented, rational-numbers fraction& fraction::operator -= (fraction const &two) { int subed_num = 0; int common_denom = 0; bool is_it_neg = false; if ((this->numerator * this->denominator) == 0) { this->numerator = two.numerator; this->denominator = two.denominator; return *this; } if ((two.numerator * two.denominator) == 0) { return *this; } if (!(this->is_neg) && !(two.is_neg)) { subed_num = ((this->numerator * two.denominator) - (two.numerator * this->denominator)); common_denom = (this->denominator * two.denominator); if (subed_num < 0) { subed_num *= -1; is_it_neg = true; } } if (this->is_neg && two.is_neg) { subed_num = (((this->numerator * -1) * two.denominator) + (two.numerator * this->denominator)); common_denom = (this->denominator * two.denominator); if (subed_num < 0) { subed_num *= -1; is_it_neg = true; } } if (this->is_neg && !(two.is_neg)) { subed_num = ((this->numerator * two.denominator) + (two.numerator * this->denominator)); common_denom = (this->denominator * two.denominator); is_it_neg = true; } if (!(this->is_neg) && two.is_neg) { subed_num = ((this->numerator * two.denominator) + (two.numerator *
{ "domain": "codereview.stackexchange", "id": 26679, "lm_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, rational-numbers", "url": null }
quantum-chemistry, valence-bond-theory \Phi_2 &=c_{3,1}\cdot s+ c_{3,2}\cdot p_x + c_{3,3} \cdot p_y &&= c_{3,1}\cdot s+ c_{3,2}\cdot -p_x + c_{3,3} \cdot -p_y \\ \end{align} I have some recollection that the wave functions zeroes out for particular quantum number values, but I can't remember how it all fits together with this equation. I couldn't find this formula online, so I'm hoping that it might make sense to someone here. Thanks for the help! What we call "Hybridization" is really just a mathematical transformation of an approximated wavefunction. Your basic summation formula describes how to build some sort of customized wavefunction by forming a linear combination of some set of "basis" orbitals; you will find this equation over and over if you look up "basis set expansion". Now, of course you can't just use any random coefficients $c_{ij}$ of your liking for this custom wavefunction; you have to adhere to some physical rules. Most importantly, the overall energy that the wavefunction represents must not change. I won't go into detail about the constraints, but if you are interested, google "unitary transformation".
{ "domain": "chemistry.stackexchange", "id": 14412, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "quantum-chemistry, valence-bond-theory", "url": null }
subset of binary space countable? I know that the set of all binary sequences is uncountable. Now consider the subset of this set, that whenever a digit is $1$, its next digit must be $0$. Is this set countable? I think it is not because it is like "half" of the set of binary sequences. By that I mean if I just delete the sequences with a $1$ followed by a $1$, then I'm left with the required sequence. But I'm not sure how to show this clearly. Can someone think of a bijection that would prove this? Or am I wrong? Please help. Thanks - If you insist to have a bijection, here is one. Your set $S$ is the set of all binary infinite words containing no factor $11$. Any such word can be uniquely written as an infinite word on the alphabet $\{0, 10\}$, that is, $S = \{0, 10\}^\omega$. For instance, $$0100100010010(100)^\omega = \color{blue}{0}\color{red}{10}\color{blue}{0}\color{red}{10}\color{blue}{0}\color{blue}{0}\color{red}{10}0\color{red}{10}(\color{red}{10}\color{blue}{0})^\omega$$ It follows that the map from $\{0,1\}^\omega \to S$ consisting to replace every $1$ by $\color{red}{10}$ is a bijection. No need of the Cantor-Bernstein-Schroeder theorem. - You can explicitly write an injective function from the set of all binary sequences to the set you are considering: just map every sequence to one with $0$ inserted in every other position. So no, this is definitely not countable.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9898303422461274, "lm_q1q2_score": 0.871839674692852, "lm_q2_score": 0.8807970795424087, "openwebmath_perplexity": 135.19430140655842, "openwebmath_score": 0.9511620998382568, "tags": null, "url": "http://math.stackexchange.com/questions/1671428/subset-of-binary-space-countable" }
java public final boolean male; public final LocalDate birthday; public final float weight; public final float height; public final int motherID; public Newborn( String name, int id, boolean male, LocalDate birthday, float weight, float height, int motherID ) { super(name, id); this.male = male; this.birthday = birthday; this.weight = weight; this.height = height; this.motherID = motherID; } private static LocalDate parseBirthday(String date) { return LocalDate.parse(date, birthdayFormat); } @Override public String toString() { return String.format( "%d %c %s %s %.1f %.1f %d", id, male ? 's' : 'c', name, birthday.format(birthdayFormat), weight, height, motherID ); } public static Newborn fromString(String line) { String[] arr = line.split("\\s+"); int id = Integer.parseInt(arr[0]); boolean male = !"c".equals(arr[1]); String name = arr[2]; LocalDate birthday = parseBirthday(arr[3]); float weight = Float.parseFloat(arr[4]); float height = Float.parseFloat(arr[5]); int motherID = Integer.parseInt(arr[6]); return new Newborn(name, id, male, birthday, weight, height, motherID); } public static Stream<Newborn> importFromFile(@NotNull Path path) throws IOException { return Files.lines(path) .map(Newborn::fromString); } public static Map<Integer, List<Newborn>> newbornsByMother(Collection<Newborn> newborns) { return newborns.stream() .collect(Collectors.groupingBy(n -> n.motherID)); } } Person.java package victor; public abstract class Person { public final String name; public final int id; public Person(String name, int id) { this.name = name; this.id = id; } }
{ "domain": "codereview.stackexchange", "id": 43110, "lm_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", "url": null }
I hope this helped! (1 vote) • Did you just assume that the hypotenuse is 2, or is there some way to tell that the hypotenuse is 2. • There is a way to tell. The Pythagorean Theorem says a² + b² = c², where c is the hypotenuse. That means one of the sides, lets say a, is equal to sqrt(c² - b²). Now we have been given an expression that looks just like that: sqrt(4 - x²), which can be rewritten as sqrt(2² - x²). That means that for this trig sub triangle, one side (the b side) is equal to x, the other side, the a side is equal to sqrt(2² - x²) which means the hypotenuse for this triangle must be 2.
{ "domain": "khanacademy.org", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9930961615201183, "lm_q1q2_score": 0.8401021835009205, "lm_q2_score": 0.8459424334245618, "openwebmath_perplexity": 899.2466152977103, "openwebmath_score": 0.8291401267051697, "tags": null, "url": "https://www.khanacademy.org/math/old-integral-calculus/integration-techniques/trig-substitution/v/introduction-to-trigonometric-substitution" }
c, console, unix /******************************************************************************* * Processes a file. * *******************************************************************************/ static void process_file(char** p_buffer, int* p_buffer_length, FILE* file) { while (!feof(file)) { process_line(p_buffer, p_buffer_length, file); } }
{ "domain": "codereview.stackexchange", "id": 12977, "lm_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, console, unix", "url": null }
optics, electromagnetic-radiation, refraction, variational-principle, wave-particle-duality \tag{02} \end{equation} You realize that on one hand you decrease the swimming distance by $$ BC-BD \approx CZ=\Delta x \cdot \sin\theta_{2} \tag{03} $$ so changing (decreasing) the swimming time by $$\Delta t_{2}=t_{2}^{\prime}-t_{2}=-\Delta x \cdot \dfrac{\sin\theta_{2}}{v_{2}} \tag{04} $$ On the other hand you increase the running distance by $$ AD-AC \approx DE=\Delta x \cdot \sin\theta_{1} \tag{05} $$ so changing (increasing) the running time by $$\Delta t_{1}=t_{1}^{\prime}-t_{1}=+\Delta x \cdot \dfrac{\sin\theta_{1}}{v_{1}} \tag{06} $$ So, balancing, the total time change is $$ \Delta t_{tot}=t_{tot}^{\prime}-t_{tot}=\left(t_{2}^{\prime}+t_{1}^{\prime} \right)-\left(t_{2}+t_{1}\right)=\Delta t_{2}+\Delta t_{1}= \Delta x \cdot\left(\dfrac{\sin\theta_{1}}{v_{1}}- \dfrac{\sin\theta_{2}}{v_{2}}\right) \tag{07} $$ This means that if $$ \left(\dfrac{\sin\theta_{1}}{v_{1}}- \dfrac{\sin\theta_{2}}{v_{2}}\right) > 0 \tag{08} $$
{ "domain": "physics.stackexchange", "id": 32727, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "optics, electromagnetic-radiation, refraction, variational-principle, wave-particle-duality", "url": null }
vba, excel ErrorProcessing 'fixed typo 'Order '------------ PutSomeOrder LastRow 'Main Areas creation '------------------- wsLot.Range("A9").Formula2R1C1 = "=UNIQUE(FILTER(REGISTER!R7C3:R65536C3,REGISTER!R7C3:R65536C3<>""""))" 'Lot assignement '--------------- n = IMPORTANT_OFFSET + RegisterNoError For k = 7 To n AreaNumber = wsLot.Cells(5, 1).value 'Assign this outside the loop, it is not modified in the loop or depend on k If wsReg.Cells(k, "B").value > 0 Then If wsReg.Cells(k, "B").value = wsReg.Cells((k - 1), "B").value Then wsReg.Cells(k, "AA").value = wsReg.Cells((k - 1), "AA").value Else For i = 9 To AreaNumber + 8 If wsReg.Range("C" & k).value = wsLot.Range("A" & i) Then wsReg.Cells(k, "AA").value = wsLot.Range("C" & i) Next i End If wsReg.Cells(k, "AB").value = wsReg.Cells(k, "H").value wsReg.Cells(k, "AC").value = wsReg.Cells(k, "V").value wsReg.Cells(k, "AD").value = wsReg.Cells(k, "AA").value & "_" & wsReg.Cells(k, "AB").value & "_" & wsReg.Cells(k, "AC").value End If Next k n = 8 + wsLot.Cells(5, "A").value
{ "domain": "codereview.stackexchange", "id": 38982, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "vba, excel", "url": null }
satisfiability, 3-sat Title: Is there such a thing as partial reduction? I am trying to reduce 3-sat to 2-sat. With my reduction, I can find one assignment that satisfies them both, but there are some assignments that satisfy only the 3-sat. Does it make my reduction invalid? Is 3-sat required to be equal-satisfiable to 2-sat to call it a reduction? For a reduction $f:\Sigma^{\ast}_{\Pi_{1}}\rightarrow \Sigma^{\ast}_{\Pi_{2}}$ from language $\Pi_{1}$ to $\Pi_{2}$ to be valid you have to prove that if $I\in \Pi_{1}$ then $f(I) \in \Pi_{2}$ and that if $f(I) \in \Pi_{2}$ then $I\in \Pi_{1}$. Mathematically, you don't have to show how to get the solution of one from the other, just that if a solution for one exists, then a solution for the other has to as well (in both directions). Practically of course, a reduction normally has a constructive way of doing this, i.e. if someone gave you the solution for either $I$ or $f(I)$, you would be able to produce the solution for the other. Now in your specific case, what you would need to show is that, given any 3-SAT instance, if there's a satisfying assignment for the 3-SAT instance, then there's a satisfying assignment for the 2-SAT instance it maps to and vice versa. However I don't see how you can say you've found an assignment for the formulae - the reduction should work for every possible 3-SAT instance (that's the whole point), so there's no way you can know enough about the input to solve it, because it's not a specific, concrete formula. Or to put it another way, if what you've got is a conversion between a specific boolean formula in 3-CNF to a specific boolean formula in 2-CNF, then you don't have a reduction from 3-SAT to 2-SAT, you only have a mapping between two particular formulae.
{ "domain": "cs.stackexchange", "id": 2090, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "satisfiability, 3-sat", "url": null }
php, library, laravel * {customer->address->postcode} * Would get the postcode of the customer who owns the order. * * @param string $routeName The route you want to build * @param Model $model The model to pull the data from * @param mixed[] $data Data to build into the route when it doesn't exist on the model * * @return string The built URL. */ public function routeFromModel(string $routeName, Model $model, array $data = []) { $router = $this->getRouter(); $urlGen = $this->getUrlGenerator(); $route = $router->getRoutes()->getByName($routeName); if (!$route) { throw new RouteNotFoundException("Route $routeName not found"); } $params = $route->parameterNames(); foreach ($params as $name) { if (isset($data[$name])) { continue; } $root = $model; // Split the name on -> so we can set URL parts from relationships. $exploded = collect(explode('->', $name)); // Remove the last one, this is the attribute we actually want to get. $last = $exploded->pop(); // Change the $root to be whatever relationship in necessary. foreach ($exploded as $part) { $root = $root->$part; } // Get the value. $data[$name] = $root->$last; } return rtrim($urlGen->route($routeName, $data), '?'); } } Laravel coupling What a shame that you decided to tie this to laravel. You can decouple the entire library from laravel framework and only provide a bundle for laravel. routeFromModel accepts Model, but it can actually work for any object. $route = $router->getRoutes()->getByName($routeName); if (!$route) { throw new RouteNotFoundException("Route $routeName not found"); }
{ "domain": "codereview.stackexchange", "id": 36757, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "php, library, laravel", "url": null }
c, strings, memory-management, beginner This was just a learning example, which I have never really used. In practice, I'd suggest working with a larger s (char s[1025], %1024[^\n] in scanf, and len - old_len == 1024 in the condition of the do...while loop) to reduce the number of realloc calls which can be very slow if the user gets unlucky. This also answers your last question: char-by-char might get very slow and is in no way better than chunks.
{ "domain": "codereview.stackexchange", "id": 4491, "lm_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, strings, memory-management, beginner", "url": null }
# Interval (mathematics) Interval (mathematics) In mathematics, a (real) interval is a set of real numbers with the property that any number that lies between two numbers in the set is also included in the set. For example, the set of all numbers x satisfying 0 ≤ x ≤ 1 is an interval which contains 0 and 1, as well as all numbers between them. Other examples of intervals are the set of all real numbers $\R$, the set of all negative real numbers, and the empty set. Real intervals play an important role in the theory of integration, because they are the simplest sets whose "size" or "measure" or "length" is easy to define. The concept of measure can then be extended to more complicated sets of real numbers, leading to the Borel measure and eventually to the Lebesgue measure. Intervals are central to interval arithmetic, a general numerical computing technique that automatically provides guaranteed enclosures for arbitrary formulas, even in the presence of uncertainties, mathematical approximations, and arithmetic roundoff. ## Notations for intervals The interval of numbers between a and b, including a and b, is often denoted [a,b]. The two numbers are called the endpoints of the interval. In countries where numbers are written with a decimal comma, a semicolon may be used as a separator, to avoid ambiguity. ### Excluding the endpoints To indicate that one of the endpoints is to be excluded from the set, the corresponding square bracket can be either replaced with a parenthesis, or reversed. Both notations are described in International standard ISO 31-11. Thus, in set builder notation, \begin{align} (a,b) &= &]a,b[ &= \{x\in\R\,|\,a Note that (a,a), [a,a), and (a,a] denote the empty set, whereas [a,a] denotes the set {a}. When a > b, all four notations are usually assumed to represent the empty set.
{ "domain": "en-academic.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9890130599601176, "lm_q1q2_score": 0.8085918344455658, "lm_q2_score": 0.8175744761936437, "openwebmath_perplexity": 461.1776734786433, "openwebmath_score": 0.8691118359565735, "tags": null, "url": "https://en-academic.com/dic.nsf/enwiki/31498" }
python, c++, programming-challenge vector<int> two_sum_solution(vector<int> &nums, int target) { vector <int> results; for (int i = 0; i < nums.size(); ++i) { int match = target - nums[i]; for (int j = i + 1; j < nums.size(); ++j) { if (nums[j] == match) { for (int index_match : { i, j }) results.push_back(index_match); } } } return results; } #endif //LEETCODE_TWO_SUM_H main.cpp #include <vector> #include "two_sum.h" using std::vector; int main() { vector<int> v1{2, 7, 11, 15}; vector<int> v = two_sum_solution(v1, 22); if (!v.empty()) { cout << "Indices:" << endl; for (auto i: v) cout << i << " "; } else (cout << "No matches found"); } Leetcode stats: Runtime: 384 ms, faster than 34.03% of C++ online submissions for Two Sum. Memory Usage: 9.3 MB, less than 12.99% of C++ online submissions for Two Sum. I am not an expert in C++ but I can give a feedback about the Python solution. Your current solution runs in \$O(n^2)\$. Basically, for each number n of the input nums, find target - n in nums. How to improved it? The second part of the algorithm can be improved from \$O(n)\$ to \$O(1)\$. Instead of looking up target - n in a list, you can use a dictionary: def two_sum(nums: list, target: int): num_index = {} for i, n in enumerate(nums): match = target - n if match in num_index: return num_index[match], i num_index[n] = i return -1
{ "domain": "codereview.stackexchange", "id": 39789, "lm_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, c++, programming-challenge", "url": null }
I'm sorry this is all just soooo confusing for me. Am I on the right path here? Please take a look at my drawings, this is also a hard part for me. I'm not entirely sure how to draw them. Can u please tell me which one would be correct? Thanks File size: 4.2 KB Views: 108 File size: 3.7 KB Views: 104 4. Sep 7, 2004 ### Staff: Mentor I believe they want the total x component--not just the component for one section. Your first diagram shows the sections properly, but the labels make no sense to me. Be sure to mark the starting point and the end point. The arrow connecting those two points is the displacement. Your second diagram is not to scale (your 42 pace section seems longer than your 52 pace section). But at least it has the journey start at the origin. I have no idea what you are calling A and B. So let me start over and see if I can help you out. Let's start by labeling each section of the journey. I'll call them A, B, and C: A: 52 paces due east B: 42 paces 26.6 degrees north of west C: 25 paces due north Now I want you to find the x and y components of each section. I'll do the first one: $A_x = + 52$, $A_y = 0$ You do the next two. Then add up all the x-components and y-components: they will be the x and y components of your net displacement from the starting point. This is what I think they are looking for. 5. Sep 7, 2004 ### BlackMamba Ok, so if I've done this correctly then. As you put it Ax = 52 paces Ay = 0 Then this is what I found for the next two. Bx = 0 By = 18.8 paces Cx = 0 Cy = 25 paces Is what I've found correct? If so then I would just add all the x components and then y components? The x components would give me the magnitude of the component of my displacment in the direction of due east and the y components would give me the magnitude of my displacement in the direction of due north? 6. Sep 7, 2004 ### Staff: Mentor
{ "domain": "physicsforums.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9752018362008347, "lm_q1q2_score": 0.8189101032828198, "lm_q2_score": 0.839733963661418, "openwebmath_perplexity": 966.4158795177543, "openwebmath_score": 0.6195828318595886, "tags": null, "url": "https://www.physicsforums.com/threads/addition-of-vectors.42116/" }
c, calculator, math-expression-eval #define ValType double #define ValType_IOSPECIF "%lf" typedef struct stack { ValType* data; size_t max; // such value when the stack size should be extend size_t size; } Stack; Stack* createEmptyStack(void); void push(Stack* s, ValType val); void deleteStack(Stack* st); static void resize(Stack* st); ValType pop(Stack* st); ValType peek(Stack* st); void printStack(Stack* st); #define MSG_MALLOC "ERROR! MALLOC RETURNS NULL!\n" #define MSG_REALLOC "ERROR! REALLOC RETURN NULL!\n " calculating.h #include <float.h> /* Errors processing */ typedef enum calcerr { NO_ERR, MATH_ERR, WRONGSYM_ERR, LACK_OPERAND, END_CALC } CalcErrors; #define MSG_WRONGSYM "ERROR! You entered the wrong symbol(s).\n" #define MSG_LACKOP "ERROR! The input format is not correct.\n" #define MSG_MATH "ERROR! Math error!\n" /* Operators, delimiters, other characters */ #define VAL 1 #define SUB '-' #define ADD '+' #define MUL '*' #define DIV '/' #define EQ '=' #define POW '^' #define OP_BRACE '(' #define CL_BRACE ')' #define DELIM_DOT '.' #define DELIM_COMMA ',' #define IS_DELIM(x) ((x) == DELIM_DOT || (x) == DELIM_COMMA) #define SPACE ' ' /* Priority of operators */ #define PRIOR_SUB 1 #define PRIOR_ADD 1 #define PRIOR_MUL 2 #define PRIOR_DIV 2 #define PRIOR_POW 3 #define PRIOR_OP_BR 0 #define PRIOR_CL_BR 0 #define PRIOR(x) getPriority(x)
{ "domain": "codereview.stackexchange", "id": 22419, "lm_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, calculator, math-expression-eval", "url": null }
gazebo Title: How to update graphic in the gui when pausing it Hi, In my application I want to use Gazebo as as assembly tool, so I can dynamically insert robots and change their orientations and joint angles without the interference of the simulation dynamics. After several days testing, I found there is no problem of inserting new models when the simulation paused. But when I set the joint angle or set the relative link position by the following piece of code in the world plugin, I have to hit the play button or open gzclient after I set the joint angle, those changes can be updated on the real robot in the gui graphics. currentWorld->GetModel(msg->stringmessage())->GetJoint("Front_wheel_hinge")->SetAngle(0,joint_angles[0]); or currentWorld->GetModel(msg->stringmessage())->GetLink("CircuitHolder")->SetRelativePose (linkpose); So I want to ask whether there is way to trigger gui graphics refresh when pausing the whole simulation? Thanks. Originally posted by EdwardC on Gazebo Answers with karma: 38 on 2014-04-18 Post score: 0 I figured it out later, the only way to do that is by adding a system plugin, and force it to happen in the event "rendering". Originally posted by EdwardC with karma: 38 on 2014-06-06 This answer was ACCEPTED on the original site Post score: 0
{ "domain": "robotics.stackexchange", "id": 3573, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "gazebo", "url": null }
nuclear-physics However, what I can say is that this fact about the absence of $A=5$ stable isotopes has important consequences. The Big Bang Nucleosynthesis – first three minutes when nuclei are created – essentially stalls once it reaches helium-4 nuclei. They can't absorb new protons/neutrons to become heavier and instead, the next reaction is the much rarer collision of two helium nuclei. One either has helium-3 plus helium-4 goes to lithium-7 plus positron plus photon; or beryllium-7 plus photon on the right hand side. Lithium-7 may absorb a proton to get back to 2 helium-4; beryllium-7 may absorb a neutron to become lithium-7. These processes are "everything" one may have in empty space. Inside stars, one has pressure and temperature which helps to overcome the binding energy and stars may produce heavier elements, too.
{ "domain": "physics.stackexchange", "id": 6463, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "nuclear-physics", "url": null }
energy, electricity, electrons, mass-energy Note also that the electron volt is a unit and your calculation just defines the electron volt in terms of SI-units joule (which is itself defined via other units). If you would redefine the volt, then your eV would also change - the mass of the electron however is independent of the definition of your units except the unit for "mass". Therefore, the only way that the two calculations could give the same result and it would not be pure coincidence would be because the volt was already defined via the electron mass. This is however not the case.
{ "domain": "physics.stackexchange", "id": 22532, "lm_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, electricity, electrons, mass-energy", "url": null }
lisp, common-lisp (defun equilateral-p (a b c) (= a b c)) (defun isoceles-p (a b c) (or (= a b) (= b c))) (defun right-triangle-p (a b c) (destructuring-bind (long-side &rest short-sides) (sort (list a b c) #'>) (= (expt long-side 2) (+ (expt (first short-sides) 2) (expt (second short-sides) 2))))) (defun status-message (message a b c) (format t "The shape ~d,~d,~d ~a ~%" a b c message)) (defun classify-triangle (a b c) (cond ((not (triangle-p a b c))) ((right-triangle-p a b c) 'right) ((equilateral-p a b c) 'equilateral) ((isoceles-p a b c) 'isoceles) (t 'triangle))) (let* ((a (read-side 1)) (b (read-side 2)) (c (read-side 3)) (triangle-type (classify-triangle a b c))) (format t "classify triangle says ~a ~%" triangle-type) (cond ((eq 'right triangle-type) (status-message "is a right triangle." a b c)) ((eq 'equilateral triangle-type) (status-message "is an equilateral triangle." a b c)) ((eq 'isoceles triangle-type) (status-message "is an isoceles triangle." a b c)) ((eq 'triangle triangle-type) (status-message "is a non-right, non-isoceles, non-equilateral triangle." a b c)) (t (status-message "is not a triangle." a b c))))
{ "domain": "codereview.stackexchange", "id": 458, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "lisp, common-lisp", "url": null }
programming-challenge, haskell, math-expression-eval, compiler, parsec Title: CodeWars - Three-pass compiler for arithmetic expressions I'm looking for feedback on my solution to the Tiny Three-Pass Compiler kata on CodeWars. The kata is to implement a compiler for an arithmetic language in three passes - parsing to an AST, constant folding, then generating code in a small assembly language. I'm looking for general stylistic review, as well as reducing some of the duplication in the pass2 and pass3 functions; I have a feeling that the Add/Sub/Mul/Div cases could probably be condensed somehow. Without further ado, the code: module TinyThreePassCompiler where import Data.Map.Strict (Map) import qualified Data.Map.Strict as Map import Data.Maybe (fromJust) import Text.Parsec import qualified Text.Parsec.Token as Tok -- count number of arguments declared, how identifiers map to argument numbers type CompilerState = (Int, Map String Int) type Parser a = Parsec String CompilerState a langDef :: Tok.LanguageDef CompilerState langDef = Tok.LanguageDef { Tok.commentStart = "" , Tok.commentEnd = "" , Tok.commentLine = "" , Tok.nestedComments = False , Tok.identStart = letter , Tok.identLetter = letter , Tok.opStart = oneOf "+-*/" , Tok.opLetter = oneOf "+-*/" , Tok.reservedNames = [] , Tok.reservedOpNames = [] , Tok.caseSensitive = True } lexer :: Tok.TokenParser CompilerState lexer = Tok.makeTokenParser langDef parens :: Parser a -> Parser a parens = Tok.parens lexer brackets :: Parser a -> Parser a brackets = Tok.brackets lexer identifier :: Parser String identifier = Tok.identifier lexer reservedOp :: String -> Parser () reservedOp = Tok.reservedOp lexer integer :: Parser Integer integer = Tok.integer lexer
{ "domain": "codereview.stackexchange", "id": 29605, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "programming-challenge, haskell, math-expression-eval, compiler, parsec", "url": null }
python, python-3.x Title: Python Service with USR1 kill signal handler I have a Python script that runs as a service, like this: import time import traceback while True: time.sleep(60) try: main() except Exception: # Print the traceback, but keep running traceback.print_exc() This runs every 60 seconds, and works great. What I want to do is have my code also listen for the USR1 kill signal, and if it triggers, run main() right away. This way, my code can monitor something for changes periodically, but it can also get informed when a change happened, so it can react right away without waiting for the time.sleep() to return. What I ended up with is this: from threading import Lock import signal import time import traceback MAIN_RUNNING = Lock() def run_main(): if MAIN_RUNNING.acquire(blocking=False): try: main() except Exception: traceback.print_exc() else: print("main() is already running - couldn't lock it") signal.signal(signal.SIGUSR1, lambda *_: run_main()) while True: time.sleep(60) run_main()
{ "domain": "codereview.stackexchange", "id": 41914, "lm_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 }
gazebo, ros-kinetic I cannot easily see the problem and don't have time to set this up this right now for debugging so my answer can be a bit unsatisfying. Originally posted by DamienJadeDuff with karma: 399 on 2016-12-21 This answer was ACCEPTED on the original site Post score: 0 Original comments Comment by DamienJadeDuff on 2016-12-21: Might be relevant: https://github.com/yujinrobot/kobuki_desktop/issues/22 Comment by DamienJadeDuff on 2016-12-21: Might be relevant: https://github.com/yujinrobot/kobuki_desktop/commit/b094822512da552fadf4d91da6ae9986e9112769 Comment by RobB on 2016-12-22: Yes, thanks. I've given up too - for the time being I'm using the laser sensor at close range to develop my algorithm. It seems to me that the biggest clue here is that others are reporting a bump sensor can be read straightforwardly in versions of ROS prior to kinetic. What could have changed?
{ "domain": "robotics.stackexchange", "id": 25926, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "gazebo, ros-kinetic", "url": null }
# Length of a module over different rings Given a regular local ring $(R,m)$ and a finitely generated $R$-algebra $S$, which is free as an $R$-module. Let $M$ be a left $S$-module of finite length, $\ell_S(M)=r<\infty$. Under what conditions is $\ell_R(M)<\infty$? If this is the case, can we compute $\ell_R(M)$ in terms of $\ell_S(M)$? For example if $S=M_n(R)$, then i think we have $\ell_R(M)=n\ell_S(M)$. If $S$ is commutative and local, with maximal ideal n, then according to Liu one has the following: $\ell_R(M)=[S/n:R/m]l_S(M)$. Are there general formulas for length and "restriction of scalars"? I'm especially interested in the case when $S$ is a maximal $R$-order in a division algebra. Literature tips are also appreciated.
{ "domain": "mathoverflow.net", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9890130573694069, "lm_q1q2_score": 0.817628750572075, "lm_q2_score": 0.8267117855317474, "openwebmath_perplexity": 164.91166366036356, "openwebmath_score": 0.9527660012245178, "tags": null, "url": "http://mathoverflow.net/questions/39230/length-of-a-module-over-different-rings" }
electromagnetic-radiation, antennas Title: Does Enamel need to be Removed From Magnet Wire for Yagi Antenna I am using 16AWG Magnet Wire to create a 15 element Yagi Antenna for the 2.4ghz range which should theoretically give me a little over 15db gain. The magnet wire I am using has an enamel coating on it. Do I need to remove the enamel coating in order for the antenna to work? Of course I am going to remove it at the place where I solder the coax cable on but do I need to do it for all the directors and the reflector? How much will this affect the quality of the signal gained? Insulation around the wire does not prevent it from working as an antenna. It can slightly affect the resonant length, but that's not the same thing. Ideally you would calculate the length taking into account the coating, but the reality of it is that you should cut your wires about 10% too long, and then carefully trim them to length while measuring the resonant frequency.
{ "domain": "physics.stackexchange", "id": 38162, "lm_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-radiation, antennas", "url": null }
python, python-3.x, datetime return next_lecture def launch_timer(time): call(["termdown", time.isoformat()]) if __name__ == "__main__": next_lecture = get_next_lecture() print(lecture) # launch_timer(next_lecture) Your algorithm seems good, but the while loop, and lecture_hour and lecture_minute variables make your code a lot more complicated. If we KISS then a simple algorithm is to just remove () from Lectures and iterate through it, since it is sorted. The first lecture that is after the current time is the lecture we want. This is nice and simple: import datetime LECTURES = [(0, 10, 15), (2, 12, 15), (3, 8, 15)] def _get_next_lecture(now): today = (now.weekday(), now.hour, now.minute) for lecture in LECTURES: if today < lecture: return lecture def get_next_lecture(now=None): if now is None: now = datetime.datetime.now() day, hour, minute = _get_next_lecture(now) return ( now.replace(hour=hour, minute=minute, second=0, microsecond=0) + datetime.timedelta(day - now.weekday()) ) From here we can see if the weekday is 4-6 then _get_next_lecture will return nothing and so will error. This is easy to solve, we just return the first lecture with +7 days. def _get_next_lecture(now): today = (now.weekday(), now.hour, now.minute) for lecture in LECTURES: if today < lecture: return lecture day, hour, minute = LECTURES[0] return day + 7, hour, minute With only 3 lectures there's not much point in optimizing further. However if you have more, here is some food for thought: You can use bisect to find where to insert into in \$O(\log n)\$ time.
{ "domain": "codereview.stackexchange", "id": 39406, "lm_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, datetime", "url": null }
The sine function is an odd function. In case you use a polynomial of some degree to approximate it, such polynomial p(x) may be an odd function too, so it can have the form x*q(x), being q(x) another polynomial. Thus, if x is 0, the evaluation of the p(x) polynomial will be exactly 0, and the algorithm does not need to compute q(x) to know that. The same may occur if the algorithm used is the CORDIC one. In any case, the algorithm used inside the calculator to compute sines is not the barebones CORDIC or polynomial approximation, but a more complex algorithm that: reduces the argument to a smaller range; converts it to radians (perhaps checking for some special cases here); checks some special cases; and, eventually, executes the barebones CORDIC/polynomial or Padé or whatever approximation. So I think that the answer to the question "how does the algorithm used in a calculator 'know' that it's exactly zero" is "because the algorithm used explicitly checks if the argument is 0 and, if so, returns a 0". Another example, how is that an integration algorithm knows that $$\int_a^af(x)dx=0$$?. Because, with a high probability, it explicitly checks if both limits are equal, being such the case it returns a 0. Regards. César - Information must flow. 01-25-2018, 01:11 PM (This post was last modified: 01-25-2018 01:13 PM by AndiGer.) Post: #18 AndiGer Member Posts: 220 Joined: Oct 2015 RE: sine of an angle in degree mode Have no real 15C at hand but Free 15C emulator for "bitten apple" Sine in DEG for 360, 720, ... gives me a multiplier of the previous result without another 360 degrees added. Don't know it uses original firmware. 01-26-2018, 05:43 AM Post: #19 cyrille de brébisson Senior Member Posts: 866 Joined: Dec 2013 RE: sine of an angle in degree mode Hello,
{ "domain": "hpmuseum.org", "id": null, "lm_label": "1. YES\n2. YES\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9603611574955211, "lm_q1q2_score": 0.8255876675908576, "lm_q2_score": 0.8596637433190939, "openwebmath_perplexity": 2229.863182343363, "openwebmath_score": 0.766549289226532, "tags": null, "url": "https://www.hpmuseum.org/forum/thread-10007.html" }
optics, geometric-optics, polarization Title: How to understand the polarization rotator using a PBS, a quarter-wave plate, and a mirror? In optics experiments, I often see the following optics configuration to rotate the polarization of an incident linearly-polarized laser beam. The final reflected beam has its polarization rotated by 90 degrees. My question is: Between the quarter plate and the mirror( reflecting surface), the following figure indicates the handness of the circular polarization does not change when it is reflected back. But from what I learned, the polarization should change its handness while being reflected by a mirror. (see, e.g. this question: https://physics.stackexchange.com/q...se-polarization-of-circularly-polarised-light) If the circular polarization changes its handness, then after the quaterplate it should become the same linear polarization as the incident laser beam, meaning that it should pass through the PBS again and not be reflected away. For the mathematical description of the process, I have included the Jones calculus below. Where could I be wrong in understanding its principle? Thanks! Here is how I use Jones calculus to describe the process: The problem is that you need to be careful with the fast axis of the quarter wave plate (QWP). Here is how your example works, using the same optical calculus software as I used in another answer here. The Jones calculus model for your example is here: The output Jones vectors are shown in the four dialog boxes under the simulation model. Note that the right handed coordinate system is such that the first QWP has its fast axis at +45 degrees, while the second QWP, which is simply a convenient way of dealing with the reflected ray from the mirror, has its fast axis at -45 degrees. This is because the reflected ray “sees” the QWP’s fast axis rotated 45 degrees the other way. The output is linearly polarized, as expected, and orthogonal to the incident ray’s linear polarization. The Jones calculus equation is this: Comparison with the simulation results in the first figure shows that the simulation results differ only due to round off error. If the fast axis has been kept at +45 degrees, the output Jones vector would have been this:
{ "domain": "physics.stackexchange", "id": 88112, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "optics, geometric-optics, polarization", "url": null }
$$\lim _{x\to 2}\left(\dfrac{6-x-4}{3-x-1} \cdot \dfrac{\sqrt{3-x}+1}{1} \cdot \dfrac{1}{\sqrt{6-x}+2}\right)$$ $$\lim _{x\to 2}\left(\dfrac{6-x-4}{3-x-1} \cdot \dfrac{\sqrt{3-x}+1}{\sqrt{6-x}+2}\right)$$ $$\lim _{x\to 2}\left(\dfrac{2-x}{2-x} \cdot \dfrac{\sqrt{3-x}+1}{\sqrt{6-x}+2}\right)$$ $$\lim _{x\to 2}\left(\dfrac{\sqrt{3-x}+1}{\sqrt{6-x}+2}\right)$$ Now we can evaluate the limit: $$\lim _{x\to 2}\left(\dfrac{\sqrt{3-2}+1}{\sqrt{6-2}+2}\right) = \dfrac{1}{2}$$ Taking this example, I would like to understand why rationalization was used. What did it change in the expression so the evaluation was possible? Especially, why multiplying by the numerator's and denominator's conjugate? I am still new to limits and Calculus, so anything concerning concepts I'm missing is appreciated. I still couldn't understand how a limit supposedly tending to $$\frac{0}{0}$$ went to be $$\frac{1}{2}$$, I really want to understand it. • See if using L'Hopital's rule work Oct 12, 2020 at 19:52 Rationalization is a standard way to manipulate such kind of limits when they lead to an indeterminate form.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9658995713428385, "lm_q1q2_score": 0.8285178484334552, "lm_q2_score": 0.857768108626046, "openwebmath_perplexity": 303.1602639828983, "openwebmath_score": 0.9132158160209656, "tags": null, "url": "https://math.stackexchange.com/questions/3858398/understand-how-to-evaluate-lim-x-to-2-frac-sqrt6-x-2-sqrt3-x-1" }
programming-challenge, haskell, graph Title: Project Euler # 95 in Haskell - kind-of finding longest cycle in a graph I am trying to solve Project Euler #95 in Haskell, though I have already solved it in Java (see). I found that writing imperatively, we can easily do the task this way: Pseudocode Define cache as an int array. Find all perfect numbers and store them in a HashSet. For each number create a new HashSet for terms (named terms) that have already occured while iterating. If the number is prime or perfect skip it (and set cache value to -1) Now iterate using sum of proper divisors, if we stumble upon a number that is out of bounds or has cache value -1 skip this too and set this number's cache value as -1 too. Iterate until we reach 1 or a perfect number or the number itself; keep adding to terms. If we reach the number, get the size of terms, otherwise (1 or perfect number) set cache value to -1. Keep record of number with maximum terms size. Now thinking of functionally writing this solution I find it quite difficult to maintain something as cache, I have to iterate for each number. Also, my mind was quite stuck to this imperative solution so the Haskell equivalent was not quite different or unique. How can I improve it? (It is also quite slower - 32s) 95.hs import Control.Arrow import qualified Data.IntSet as Set import Data.List import Data.Ord import Divisors lim :: Int lim = 1000000
{ "domain": "codereview.stackexchange", "id": 25984, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "programming-challenge, haskell, graph", "url": null }
java, performance, beginner public void draw(double originX, double originY, double scaleDownFactor, double arrowHeadSize) { if (getCoordinatesLength() != 2) { throw new IllegalArgumentException("dimention of the vector must be 3"); } double newX = getCoordinate(1) * scaleDownFactor; double newY = getCoordinate(2) * scaleDownFactor; double arrowHeadPointX = originX + newX; double arrowHeadPointY = originY + newY; StdDraw.line(originX, originY, arrowHeadPointX, arrowHeadPointY); double arrowHeadBaseX = arrowHeadSize * Math.sin(getDirection2D()); double arrowHeadBaseY = arrowHeadSize * Math.cos(getDirection2D()); double[] arrowHeadXCoordinates = {-arrowHeadBaseX + (originX + 0.95 * newX), arrowHeadBaseX + (originX + 0.95 * newX), arrowHeadPointX }; double[] arrowHeadYCoordinates = { arrowHeadBaseY + (originY + 0.95 * newY), -arrowHeadBaseY + (originY + 0.95 * newY), arrowHeadPointY }; StdDraw.filledPolygon(arrowHeadXCoordinates, arrowHeadYCoordinates); } public static void main(String[] args) { /* double[] coordinatesOfVectorA = {1,2}; double[] coordinatesOfVectorB = {0,1}; Vector vectorA = new Vector(coordinatesOfVectorA); Vector vectorB = new Vector(coordinatesOfVectorB); double originX = 0.5; double originY = 0.5; double scaleDownFactor = 0.1; double arrowHeadSize = 0.01;
{ "domain": "codereview.stackexchange", "id": 39468, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "java, performance, beginner", "url": null }
ros, pid, ros-kinetic Title: Tuning PID package strange behavior Hello everyone, I'm working with a self made differential drive robot prototype, using ROS Kinetic. The rover is equipped with a Raspberry Pi 3 where ROS runs, an Arduino 2 to read from the encoders (hall sensor) and to control two DC motors. The bot works fine with navigation, I managed to tune a smooth pid control using ros pid package but the problem that I've encountered is that the pid starts losing the settings over time; if in the first minutes it behave smoothly and with almost zero overshooting (except some spike caused by the noisy and cheap encoders), after some time it starts to detune alone without changing any parameters. Here are three pics attached to understand better (black line is the set point for both the motors, red for the left motor and cyan for the right one): minute [0.0 to 3.0] minute [18.0 to 20.0]
{ "domain": "robotics.stackexchange", "id": 34247, "lm_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, pid, ros-kinetic", "url": null }
c++, thread-safety, concurrency, queue, producer-consumer Update on Atomically Updating the Counters I’d previously suggested a data structure for the counters that did not work properly on some compilers. If you want to load or update two 64-bit counters with a single atomic operation, you need to declare a struct containing two counters as members, then wrap that in std::atomic. ICC 2021 is the best at optimizing atomic updates to this structure, compiling compare_exchange_weak to a lock cmpxchg16b instruction on x86_64-v4. Clang++ 13.0.0 can also make the same optimization, but only if you align your struct to 16-byte boundaries. G++ 11.2 cannot. The following code: #include <atomic> #include <cassert> #include <stddef.h> #include <thread>
{ "domain": "codereview.stackexchange", "id": 42602, "lm_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, concurrency, queue, producer-consumer", "url": null }
graphs, discrete-mathematics Title: Can Hall's theorem be applied to scheduling problems? If I have a scheduling problem, is it possible that Hall's theorem can be applied? I was thinking that the graph representation of the scheduling problem can be the preferences of the people / workers getting scheduled. Is there any such result or counter-claim? A Characterization of Open Shop Scheduling Problems Using the Hall Theorem and Network Flow, a thesis by Arunasri Chitti may provide what you need. The abstract reads: Open shop scheduling problems are combinatorial problems where jobs with certain processing requirements on a number of different machines must be arranged in such a way that objectives related to completion time are optimized. Such problems have applications over a wide spectrum including such as communications, routing and manufacturing. Many open shop problems are NP-hard but there are a number of special cases which possess polynomial solutions in the case of few machines or few jobs or when preemption of jobs is permitted. Many such solutions are based in the theory of matching or Hall’s theorem, or more generally network flow. The primary focus of this thesis is to describe a number of polynomial-time solutions which are constructed using these related concepts and methods. The paper discusses the problem of scheduling resources to needs in a reasonably optimized fashion, Open Shop Scheduling, and how a particular subset of those scheduling problems "are a number of special cases that do have polynomial solutions and those solutions often come from the theory of matching, network flow and Hall’s theorem, which are related concepts and methods." See What is an NP-complete in computer science as well as What are the differences between NP, NP-Complete and NP-Hard?. Also see the Wikipedia topics NP-hardness and NP-completeness. Scheduling in the context of the paper is defined as: Scheduling deals with the arrangement of a given set of jobs, on the given machine such that the provided resources are assigned to the jobs in an optimal way. Scheduling provides us the starting and the completion time for each operation or job. A Scheduling problems in the context of the paper is defined as: According to Peter Brucker [1], a Scheduling problem is defined as following: Given m machines Mj (j= 1, 2...m) and n jobs Ji (i= 1, 2…n), a schedule now is allocation of one or more time intervals for each job on one or more machines.
{ "domain": "cs.stackexchange", "id": 10311, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "graphs, discrete-mathematics", "url": null }
For what in does exist? Sketch the graphs of and on the same set of axes. The following definition which involves time and motion and particles is not a part of our official development and will not be used for proving any theorems. 10.30   Definition (Velocity.) Let a particle move on a number line in such a way that its coordinate at time is , for all in some interval . (Here time is thought of as being specified by a number.) If are points in with , then the average velocity of for the time interval is defined to be Note that is not necessarily the same as the distance moved in the time interval . For example, if then , but the distance moved by in the time interval is . (The particle moves from to at time , and then back to .) The instantaneous velocity of at a time is defined to be provided this limit exists. (If the limit does not exist, then the instantaneous velocity of at is not defined.) If we draw the graph of the function ; i.e., , then the velocity of at time is by definition slope of tangent to graph at . In applications we will usually express velocity in units like . We will wait until we have developed some techniques for differentiation before we do any velocity problems. The definition of velocity just given would have made no sense to Euclid or Aristotle. The Greek theory of proportion does not allow one to divide a length by a time, and Aristotle would no more divide a length by a time than he would add them. Question: Why is it that today in physics you are allowed to divide a length by a time, but you are not allowed to add a length to a time? In Newton's calculus, the notion of instantaneous velocity or fluxion was taken as an undefined, intuitively understood concept, and the fluxions were calculated using methods similar to that used in the section 10.1. The first rigorous'' definitions of limit of a function were given around 1820 by Bernard Bolzano (1781-1848) and Augustin Cauchy (1789-1857)[23, chapter 1]. The definition of limit of a function in terms of limits of sequences was given by Eduard Heine in 1872. Next: 11. Calculation of Derivatives Up: 10. Definition of the Previous: 10.2 Limits of Functions   Index Ray Mayer 2007-09-07
{ "domain": "reed.edu", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9873750525759487, "lm_q1q2_score": 0.8352624546788027, "lm_q2_score": 0.8459424334245618, "openwebmath_perplexity": 400.12178357334045, "openwebmath_score": 0.8696843981742859, "tags": null, "url": "http://people.reed.edu/~mayer/math111.html/header/node56.html" }
optics Suppose $\gamma<0$. $\chi$ is analytic on the upper half complex plane and by Cauchy's Integral Theorem, $$0 = \frac{1}{2\pi i}\oint_C \frac{\chi(\bar\omega)}{\bar\omega-\omega}\mathrm d\bar\omega,$$ where the contour $C$ runs along the real axis from $-R<0$ to $R>0$ with an infinitesimally small semicircle running clockwise around and above $\omega$, then describes the large semicircle circle counter-clockwise in the upper half complex plane with radius $R$. The clockwise integral around the small circle above $\omega$ approaches $-\frac{1}{2}\chi(\omega)$ while the integral on the large semicircle with radius $R$ approaches $0$ as $R\rightarrow\infty$ as the magnitude of the integrand is $O\big(\frac{1}{R^3}\big)$. Therefore $$\frac{1}{2}\big(\chi_r(\omega)+i\chi_i(\omega)\big) = \frac{1}{2\pi i}P\int_{-\infty}^\infty \frac{\chi_r(\bar\omega)+i\chi_i(\bar\omega)}{\bar\omega-\omega}\mathrm d\bar\omega.$$ Equating the real and imaginary parts of the equation, leads to the desired result.
{ "domain": "physics.stackexchange", "id": 18225, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "optics", "url": null }
is not asymmetric, and only if it is antisymmetric ;. Note: a relation R on a set a asymmetry: a relation is irre pm! What is an element which triplicates in every hour therefore every asymmetric relation, but is. Converse of part ( a ) not equal to element of R. that not... Antisymmetric too there are different relations like every asymmetric relation is antisymmetric, but ≥ is not asymmetric, is symmetric are in! The other with the previous result to conclude that every asymmetric relation are considered asymmetric... Acyclic relation is irre & pm ; exive that every acyclic relation is irre & pm exive. Vertices is connected by none or exactly one directed line a single compound is kept in antisymmetric... Short video, we define what an antisymmetric relation for a binary relation can characterized! If for every a element of is related to one another non-examples ¨ the divides. As asymmetric relation an element which triplicates in every hour nor irreflexive, so order... What an antisymmetric relation ; asymmetric relation are considered as asymmetric relation ; symmetry in mathematics ;.. Elements of a partial ordering demonstrate that every partial ordering demonstrate that every asymmetric relation is provide! Give examples of relations which are neither re & pm ; exive asymmetric relations are also asymmetric Contents! Here are binary relations may have ; exive, nor asymmetric ca n't symmetric. For others of asymmetric relation are considered as asymmetric relation is also irreflexive, so in order to asymmetric…... A element of R. that is in cookies suppose that your math teacher surprises the class by saying she in. Every partial ordering is antisymmetric, but ≥ is not antisymmetric set for a binary relation R on a.... Pair of vertices is connected by none or exactly one directed line like reflexive irreflexive. Turn reproduce exactly 3 other items for a binary relation every asymmetric relation is antisymmetric be,! Therefore every asymmetric relation is asymmetric if, and only if, it should be antisymmetric too mathematical of. About a Certain type of relation called an
{ "domain": "multifisio.es", "id": null, "lm_label": "1. Yes\n2. Yes\n\n", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9637799441350253, "lm_q1q2_score": 0.8229839799613926, "lm_q2_score": 0.853912747375134, "openwebmath_perplexity": 775.7287487590885, "openwebmath_score": 0.8121563792228699, "tags": null, "url": "http://multifisio.es/ecological-study-bplz/a7a798-every-asymmetric-relation-is-antisymmetric" }
java, combinatorics float mExpectationValue = mTotalSum / mNumberOfWays; System.out.println("Expectation value is " + mExpectationValue); int mStandardDeviationSum = 0; for (int i = 0; i < mOneDrawPartialSums.size(); i++) { mStandardDeviationSum += Math.pow( (mOneDrawPartialSums.get(i) - mExpectationValue), 2); } float mStandardDeviation = (float) Math.sqrt(mStandardDeviationSum / mNumberOfWays); System.out.println("Standard Deviation is " + mStandardDeviation); long endTime = System.nanoTime(); System.out.println("Took "+(endTime - startTime) + " ns"); } public class BallCombination { int[] mCombination; ArrayList<int[]> mFormedCombinations; public BallCombination() { this.mCombination = new int[BALLS_DRAWN]; for (int i = 0; i < BALLS_DRAWN; i++) { this.mCombination[i] = i + 1; } this.mFormedCombinations = new ArrayList<int[]>(); this.mFormedCombinations.add(this.mCombination); } public void print() { System.out.print("("); for (int i = 0; i < BALLS_DRAWN; i++) { System.out.print(this.mCombination[i]); if (i != BALLS_DRAWN - 1) { System.out.print(","); } } System.out.println(")"); }
{ "domain": "codereview.stackexchange", "id": 12958, "lm_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, combinatorics", "url": null }
electromagnetism Title: Electromagnetic fields inside perfect conductors Why are electromagnetic fields zero inside perfect conductors? I do not understand why we can make these assumptions in electrodynamics. SOLUTION: Firstly, we are going to analize the electric field. In the first conductor we can appreciate that the total charge distribution is electrically compensated ($\rho=0$). In consequence, the electric field will be completely null ($∇⋅\vec{D}=\rho=0$). Later on we apply an external electric field that will distribute the charges inside the conductor almost instantaneously ($\sigma=\infty$). This redistribution will cause another electric field that will cancel the previously applied field. We can conclude that the elctric field is zero unless we vary the magnetic field ($∇×\vec{E}=-\frac{∂\vec{B}}{∂t}$). The magnetic fields are defined by the following equations: $∇⋅\vec{B}=0$ $∇×\vec{H}=\vec{J}+\frac{∂\vec{D}}{∂t}=\vec{J}$ext$+\sigma \vec{E}+\frac{∂\vec{D}}{∂t}$ We know that $\vec{D}=0$, so the induced current densities ($\vec{J}$ind$=\sigma\vec{E}$) will be zero as well. In addition, we will assume that the external current densities ($\vec{J}$ext) applied in the conductor are also zero. Finally we know that $\frac{∂\vec{D}}{∂t}=0$. So we can rewrite the Maxwell equations into the following ones: $∇⋅\vec{B}=0$ $∇×\vec{H}=0$
{ "domain": "physics.stackexchange", "id": 61278, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "electromagnetism", "url": null }
thermodynamics Now we do calculation 2 over again. We start with $$G(x)=x\left(G^\circ_{(glu(aq))}+RT\ln\left(x\cdot\frac{55}{54+x}\right)\right) + (1-x)(G^\circ_{(glu(s))}+RT\ln(1)) + 54G^\circ_{pure}+54RT\ln\left(\frac{54}{54+x}\right)$$ Taking the derivative with respect to $x$, $$\frac{dG}{dx}=G^\circ_{(glu(aq))} + RT\ln\left(x\cdot\frac{55}{54+x}\right)+ xRT\left(\frac{1}{x}-\frac{1}{54+x}\right) - G^\circ_{(glu(s))} - 54RT\left(\frac{1}{54+x}\right).$$ $$=G^\circ_{(glu(aq))} - G^\circ_{(glu(s))} + RT\left(\ln\left(x\cdot\frac{55}{54+x}\right)+1-\frac{x+54}{x+54}\right)=G^\circ_{(glu(aq))} - G^\circ_{(glu(s))} + RT\ln\left(x\cdot\frac{55}{54+x}\right),$$ Now, we go back to our equation $\Delta_r G^\circ = \Delta_f G^\circ(Glucose(aq)) - \Delta_f G^\circ(Glucose(s))-0.99RT$, and make a substitution into the above expression to get
{ "domain": "chemistry.stackexchange", "id": 11754, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "thermodynamics", "url": null }
c#, excel, winforms, ms-word private void EP_RentRosterLocation_TB_Click(object sender, EventArgs e) { findTenantRosterExcelFile(sender, e); fillSheetSelectorListBox(); } private void EP_RentRosterSheetName_LISTBOX_SelectedIndexChanged(object sender, EventArgs e) { localPreferences.ExcelWorkSheetName = EP_RentRosterSheetName_LISTBOX.SelectedItem.ToString(); EP_SheetName_TB.Text = localPreferences.ExcelWorkSheetName; } private void EP_SheetName_TB_Click(object sender, EventArgs e) { fillSheetSelectorListBox(); } private void EP_SavePreferences_BTN_Click(object sender, EventArgs e) { // Make sure any previous edits to the tenant are saved // then reset all the models. Globals.Save(); Globals.ReInitizeAllModels(localPreferences); Globals.SavePreferences(); DialogResult = DialogResult.OK; Close(); } private void EP_Cancel_Button_Click(object sender, EventArgs e) { DialogResult = DialogResult.Cancel; Close(); } } } PrintMailboxListsDlg.cs This form allows the user to print and or save word documents created from the excel data. It also allows the user to override some of their preferences on a case by case basis. using System; using System.Collections.Generic; using System.Windows.Forms; namespace TenantRosterAutomation { public partial class PrintMailboxListsDlg : Form { private PrintSavePreference.PrintSave printSave; private bool addDateToFileName = false; private bool addDateToTitle = false; private string selectedBuildings; private MSWordInterface wordInteropMethods; public PrintMailboxListsDlg() { InitializeComponent(); wordInteropMethods = new MSWordInterface(Globals.Preferences); }
{ "domain": "codereview.stackexchange", "id": 42740, "lm_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#, excel, winforms, ms-word", "url": null }
c++, chess Title: Chess game in C++ I have written a chess game. No castling or en passant, pawn gets promoted to queen. Game isn't drawn after 50 moves. The AI is a naive minimax implementation. The chess AI algorithms can be improved, more tricks can be used. Alpha-beta pruning, negimax. But that is not my intent. My goal is not to make a great chess engine. I would love some feedback on my coding. How the same implementation can be better written. Idioms, conventions, anything that comes to your mind. I'm greatly thankful. #include <iostream> #include <string> #include <vector> #include <map> #include <algorithm> using namespace std; struct ChessBoard{ enum class Turn {white, black} turn; enum class Piece {king, queen, white_pawn, black_pawn, rook, bishop, knight}; static map<Piece,int> pieceValues; bool show_coordinates = false; struct Pos{ int x,y; Pos(const Pos &p, int dx=0, int dy=0){ *this = p; x+=dx; y+=dy;} Pos(int _x, int _y){ x=_x; y=_y; } bool operator<(const Pos & p) const { return (x < p.x) || (x==p.x && y < p.y); } bool operator==(const Pos & p) const { return x==p.x && y==p.y; } Pos(){x=-1;y=-1;} }; map<Pos,Piece> white_pieces, black_pieces; map<Pos,Piece> & moverPieces(){ return turn == Turn::white ? white_pieces : black_pieces; } map<Pos,Piece> & opponentPieces(){ return turn == Turn::white ? black_pieces : white_pieces; }
{ "domain": "codereview.stackexchange", "id": 27074, "lm_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++, chess", "url": null }
python, scikit-learn, clustering, k-means, plotting Title: Wrong Graph Plot using K-Means in Python This is my first time implementing a Machine Learning Algorithm in Python. I tried implementing K-Means using Python and Sklearn for this dataset. from sklearn.cluster import KMeans import numpy as np import pandas as pd from matplotlib import pyplot as plt # Importing the dataset data = pd.read_csv('dataset.csv') print("Input Data and Shape") print(data.shape) data.head() # Getting the values and plotting it f1 = data['Area'].values f2 = data['perimeter'].values f3 = data['Compactness'].values f4 = data['length_kernel'].values f5 = data['width_kernel'].values f6 = data['asymmetry'].values f7 = data['length_kernel_groove'].values X = np.array(list(zip(f1,f2,f3,f4,f5,f6,f7))) # Number of clusters kmeans = KMeans(n_clusters=7) kmeans = kmeans.fit(X) # Getting the cluster labels labels = kmeans.predict(X) # Centroid values centroids = kmeans.cluster_centers_ plt.scatter(X[:,0], X[:,1],cmap='rainbow') plt.scatter(centroids[:,0], centroids[:1], color="black", marker='*') plt.show() The graph doesn't seem to plot the data correctly. How can I debug this issue? Well, there are some issues:
{ "domain": "datascience.stackexchange", "id": 2210, "lm_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, scikit-learn, clustering, k-means, plotting", "url": null }
ros, mac, camera Title: How to use the Mac book pro's iSight camera in ROS for the webcam? I'm a ROS newbie and would like to use the internal camera called I believe iSight on my Mac Book Pro laptop to do some image processing development. I would like to know if anyone else has gone down this path and learn from their experinces. I'm running Parallels with Ubuntu 14.04 on my Mac. Thanks for any help, Phil. Originally posted by pbarile on ROS Answers with karma: 11 on 2016-05-19 Post score: 0 The iSight camera is a regular USB UVC webcam. You can tell Parallels to pass the camera through to the VM, and then use usb_cam to publish images from it in ROS. Originally posted by Dan Lazewatsky with karma: 9115 on 2016-05-20 This answer was ACCEPTED on the original site Post score: 0 Original comments Comment by pbarile on 2016-05-21: Dan, thanks for the help! I got further by installing the usb_cam package and then executing it. I'm getting the same 'CalibrationFile is missing' error that is described at the very bottom of this link: http://laukh.com/ros/usb_cam/. Can you tell me how/if I need to calibrate? I'm very confused. Comment by Dan Lazewatsky on 2016-05-22: If you want to calibrate your camera, you can use camera_calibration. Whether or not you need to do that depends entirely on your application. If you don't want to calibrate, you can ignore those messages.
{ "domain": "robotics.stackexchange", "id": 24697, "lm_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, mac, camera", "url": null }
Strategy 2: (by Andrei Rykhalski) Construct $X_k$ $\forall k=1, ..., n$ containing $k$ times each element $x\in X$. Build words of length $n$ from alphabet of size $nk$. Then find all possible distinct combinations of its elements of length n (exclude duplicates). In the simple example: $X_3=\{A,A,A,B,B,B,C,C,C\}$, $X_2=\{A,A,B,B,C,C\}$, $X_1=\{A,B,C\}$. • Haven't tried to solve the problem such way but perhaps this helps: you may construct sets $X_k$ for each $k = 1..n$ containing each element of $X$ $k$ times and then find all possible distinct combinations of its elements of length $n$. Feb 13 '15 at 15:47 • @AndreiRykhalski If I understand you well, $X_3=\{AAA, BBB, CCC\}$ and $X_2= \{AAB, AAC, ABA, ACA, BAA, CAA, BBA, BBC, BAB, BCB, ABB, CBB, ...\}$, and $X_1 = \{ABC, ABB, ACB, ...\}$. The issue is, $ABB\in X_2$ and $ABB\in X_1$. Feb 13 '15 at 15:57 • Nope, $X_3 = \{A,A,A,B,B,B,C,C,C\}, X_2 = \{A,A,B,B,C,C\}$. So you are building words of length $n$ from alphabet of size $nk$ and after that need to exclude duplicates. Feb 13 '15 at 16:02
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9845754501811438, "lm_q1q2_score": 0.8426500210733381, "lm_q2_score": 0.8558511396138365, "openwebmath_perplexity": 447.62093942352533, "openwebmath_score": 0.8809651136398315, "tags": null, "url": "https://math.stackexchange.com/questions/1146690/number-of-elements-in-cartesian-power-with-a-maximum-constraint" }
ros, c++, cmake, catkin-workspace Originally posted by Kiwi on ROS Answers with karma: 1 on 2018-01-16 Post score: 0 Original comments Comment by Javier V. Gómez on 2018-01-16: I think you are missing this: include_directories(${catkin_INCLUDE_DIRS}) which will tell the compiler to look for include files also in the include folders of the packaged that you found in find_package. I'm assuming this is the CMakeLists.txt of package B. Thus, the install(.. part makes no sense. Why would you want to install something from INSIDE package B? Do you have a layout like B/include/A? Also, what do you expect ${A} do contain? This variable should not be set anywhere in here. The same holds for the add_library call. Why do you, in package B want to build a package in A. The answer you cite is correct, so please follow this. In pkg A: compile the library install the library and Header files of pkg A (actually, not even required) Export the include path and the library with the catkin_package call (check out the template when you create a new package) In pkg B: set up the build_depend to pkg A find_package package A add include_directories(${catkin_INCLUDE_DIRS}) include the Header in your package B code link against the ${catkin_LIBRARIES} Originally posted by mgruhler with karma: 12390 on 2018-01-16 This answer was ACCEPTED on the original site Post score: 0
{ "domain": "robotics.stackexchange", "id": 29755, "lm_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, c++, cmake, catkin-workspace", "url": null }
Theorem 6. For $A\in\mathbb{C}^{n\times n}$, \notag \begin{aligned} \mu_1(A) &= \max_j \biggl( \sum_{i\ne j} |a_{ij}| + \mathrm{Re}\, a_{jj} \biggr ),\\ \mu_{\infty}(A) &= \max_i \biggl( \sum_{j\ne i} |a_{ij}| + \mathrm{Re}\, a_{ii} \biggr ),\\ \mu_2(A) &= \lambda_{\max}\Bigl( \frac{A+A^*}{2} \Bigr), \qquad (4) \end{aligned} where $\lambda_{\max}$ denotes the largest eigenvalue of a Hermitian matrix. Proof. We have
{ "domain": "nhigham.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.991152646485103, "lm_q1q2_score": 0.8056755910693365, "lm_q2_score": 0.8128673155708975, "openwebmath_perplexity": 476.1456446145442, "openwebmath_score": 0.9996046423912048, "tags": null, "url": "https://nhigham.com/2022/01/18/what-is-the-logarithmic-norm/" }
quantum-gate, linear-algebra, deutsch-jozsa-algorithm Title: How to factor the output of a CNOT acting on the input $|-,+\rangle$ I am trying to implement the Deutsch oracle in classical computer, using direction from this talk. There is this slide where they show how the CNOT gate modify 2 Hadamard transformed Qubits: While I understand the math, I'm having trouble implementing the last part, where the resulting tensor product is factored into 2 qubits: $ \frac{1}{2} \begin{pmatrix} 1\\ -1\\ 1\\ -1 \end{pmatrix} = \begin{pmatrix} \frac{1}{\sqrt2}\\ \frac{1}{\sqrt2}\\ \end{pmatrix} \otimes \begin{pmatrix} \frac{1}{\sqrt2}\\ \frac{-1}{\sqrt2}\\ \end{pmatrix} $ In the talk, they say the control qubit is supposed to stay the same, so it is simple to derive the target qubit. However, in this case, the control qubit is modified, while the target qubit is not. So should I implement this by using 2 different calculation for each case (control/target qubit stay the same)? If so, how do I choose which calculation to use? Or is there a better way to do this, using just a single calculation? There are really two different questions here. How can you figure out that a given output can be written as tensor product of two vectors?
{ "domain": "quantumcomputing.stackexchange", "id": 986, "lm_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, linear-algebra, deutsch-jozsa-algorithm", "url": null }
quantum-mechanics, classical-mechanics, hamiltonian-formalism, hamiltonian Title: Deriving the quantum Hamiltonian from the expression of classical energy I am currently learning about the Dirac formalism in quantum mechanics, but don't quite understand how we derive the expression of the quantum Hamiltonian, given the value of energy in classical mechanics. The specific example that came up in class was that of the harmonic oscillator, for which the classical energy is $$E = \frac{p^2}{2m} + \frac{1}{2}m\omega^2x^2$$ My teacher then concluded that $$\hat{H} = \frac{\hat{p}^2}{2m} + \frac{1}{2}m\omega^2\hat{x}^2$$ Why is that? The only way I see to show this is by looking at a stationary wave function $\psi (x)$ and using the associated Schrödinger equation. We get get that, by writing $V(x) = \frac{1}{2}m\omega^2x^2$, $$E\psi(x) = \frac{-\hbar^2}{2m}\frac{d^2\psi(x)}{dx^2} + V(x)\psi = \hat{H}\psi(x)$$ By identifying known expressions for $\hat{p}$ and $\hat{x}$, we can find the desired expression for the Hamiltonian. However, I do not feel like this method is very satisfying, as it requires to return to wave functions, and doesn't use the Schrödinger equation in the Dirac formalism. I am getting a feeling that teachers will eagerly replace $x$ by $\hat{x}$ and p by $\hat{p}$ when going from classical mechanics to quantum mechanics.
{ "domain": "physics.stackexchange", "id": 67907, "lm_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, classical-mechanics, hamiltonian-formalism, hamiltonian", "url": null }
computability, computing-over-reals, topology, model-theory Definitions, constructions, and theorems in intuitionistic real analysis are automatically translated to definitions, constructions and theorems about computable reals when we interpret them in the effective topos. For instance, the theorem "every uniformly continuous map $f : [0,1] \to \mathbb{R}$ attains its supremum" is intuitionistically valid. When we interpret it in the effective topos we get the corresponding version for computable maps on computable reals which are computably uniformly continuous. You also ask about the "divergence" between real analysis and its computable version. The answer is that results which rely on the law of excluded middle or the axiom of choice (although countable choice is ok) are not intuitionistic, and therefore cannot be validated in the effective topos. However, we should note that (contrary to popular opinion) most analysis can be done intuitionistically. The effective topos is just one of many realizability toposes. When we interpret intuitionistic analysis in other realizability toposes we get alternative models of real number computatability, including computation with oracles which you allude to. The "relative Kleene function realizability topos" (whatever that is) gives the so called Type II computability on reals in which computable maps operate on all reals, not just the computable ones. I tried to explain this once in the notes "Realizability as the Connection between Computable and Constructive Mathematics", and before that in my Ph.D. thesis.
{ "domain": "cstheory.stackexchange", "id": 2796, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "computability, computing-over-reals, topology, model-theory", "url": null }
¹ If it is a discrete-time stochastic process. Continuous-time stochastic process are distributions of functions rather than time series. • It is unclear whether you are making a distinction between a model and a dataset or whether you are trying to make some other point. It is also unclear what you take a stochastic process to be. (All you have said is that it is "not even" a "discrete-time stochastic process.") These uncertainties in your exposition might add to the confusion rather than resolving it. – whuber Dec 5 '14 at 21:51 • @whuber: I edited my answer to clarify some aspects, but I think you also misunderstood some the “not even” sentence. – Wrzlprmft Dec 5 '14 at 22:04 I appreciate all contributed discussions/comments on the subject of Time series vs Stochastic process. Here is my understanding of the difference: Time series is a phenomenon observed, recorded as a series of numbers that is indexed with the time at observation; it is most likely a series of observations of a real life phenomenon such as stock prices on the New York Stock Exchange. On the other hand, stochastic process is as always understood as a mathematical representation (not a production) of the time-series. • Stochastic processes are more general than time series. For example Markov chains are stochastic processes that are not time series. – Michael R. Chernick Apr 9 '18 at 6:32 • @Michael Chernick: Aren't Markov Chain consistent with the definitions: "a set of random variables indexed by integers t" and "a stochastic process indexed by integers"? Which parts of these definitions Markov Chains do not satisfy or are you disagreeing with these definitions? – ColorStatistics Dec 31 '18 at 16:15
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.953966096291997, "lm_q1q2_score": 0.8182816958440416, "lm_q2_score": 0.8577681104440172, "openwebmath_perplexity": 405.4000099315177, "openwebmath_score": 0.7544431090354919, "tags": null, "url": "https://stats.stackexchange.com/questions/126791/is-a-time-series-the-same-as-a-stochastic-process/126830" }
salesforce-apex Record types aren't always available for all users, when doing logic on Record types by Name I usually add a Formula to retrieve the name (one less query and I can control the permissions) Don't add queries in for loops, you could / would hit SOQL limits very very quicly I haven't proven that this will work but here is an example of what you should do: trigger SetCaseEntitlementOnInsert on Case (before insert) { System.debug('SetCaseEntitlementOnInsert executed'); // 1) Loop through the Case(s) to be inserted. // 2) Get the Entitlement for each based on the RecordType. // 3) Retrieve the Entitlement. // 4) Assign the Entitlement to the Case // Assuming you create a custom field with a Formula to retrieve RecordType.Name with API name RecordTypeName__c // Collection of Entitlement Names Set<String> theEntitlementNames = new Set<String> { 'Priority 1', 'Priority 2', 'Priority 3', 'Priority 4' }; // Query the Entitelments List<Entitlement> theEntitlements = [SELECT Id, Name FROM Entitlement WHERE Name IN :theEntitlementNames]; // If we have Entitlements if (!theEntitlements.isEmpty()) { // Map the Entitlement Ids by Name Map<String, Id> theEntitlementIdsByName = new Map<String, Id>(); for (Entitlement theEntitlement : theEntitlements) { theEntitlementIdsByName.put(theEntitlement.Name, theEntitlement.Id); }
{ "domain": "codereview.stackexchange", "id": 29746, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "salesforce-apex", "url": null }
java, generics, lambda Title: Generic Timing Class I have written a class which can time functions, and I'd like to have it reviewed. I'm interested in everything (better naming and commenting, accuracy of measurement, usability, structure, use of lambda, etc.). import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.function.Consumer; import java.util.function.Function; import java.util.function.IntFunction; /** * A timing class. */ public class Timing { private List<TimingObject> functionsToTime; private int amount = 1_000_000; public Timing() { functionsToTime = new ArrayList<>(); } /** * adds a new function which will be timed. * * @param <R> return type of functionToTime (irrelevant) * @param <T> input type of functionToTime (same as return type of * inputConverter) * @param functionToTime a function expecting input of type T, returning * output of any type (R) * @param inputConverter converts the loop variable to type T and passes it * to functionToTime * @param name name of the function (used for output) */ public <R, T> void add(Function<R, T> functionToTime, IntFunction<T> inputConverter, String name) { functionsToTime.add(new TimingObject(functionToTime, inputConverter, name)); } /** * sets how often the given functions should be run when timed. * * @param amount amount */ public void setAmount(int amount) { this.amount = amount; } /** * performs the actual timing for all given functions. */ public void time() { for (TimingObject timingObject : functionsToTime) { time(timingObject); } }
{ "domain": "codereview.stackexchange", "id": 9799, "lm_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, generics, lambda", "url": null }
javascript, html, node.js, angular.js Title: Angular front end of chat web app I'm using the MEAN stack to make a small chat app, which will soon support braided messaging. This is my first Angular app so I am not sure how I'm doing on the front end portion in terms of keeping it neat and organized appropriately (might be too monolithic). I have not used any directives, and my HTML feels like it could be split up which seems like something directives would help do. Additionally, I only have one controller and don't fully understand when you would use multiple controllers, so I wonder if that's too monolithic as well. Those are my specific concerns but also would love other feedback because I imagine there is tons to improve! public/views/index.html <nav class="navbar navbar-default"> <div class="container-fluid"> <div class="navbar-header navbar-right"> <a class="navbar-brand">{{ selected_user.username }}</a> </div> </div> </nav> <div class="container-fluid"> <div id="margin-fixer-grid-wrapper"> <div class="row"> <div id="convo-list-pane" class="col-sm-2"> <div class="row"> <div class="col-sm-12"> <h3>Convos</h3> </div> </div>
{ "domain": "codereview.stackexchange", "id": 18822, "lm_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, node.js, angular.js", "url": null }
javascript, html, dom, data-visualization, d3.js ///////////////////////////////////////////////// // DONUT ///////////////////////////////////////////////// var widthDonut = 400; var heightDonut = 200; var radiusDonut = Math.min(widthDonut, heightDonut) / 2; var colorDonut = d3.scaleOrdinal() .range(["#98abc5", "#8a89a6", "#7b6888", "#6b486b", "#a05d56", "#d0743c", "#ff8c00"]); var arcDonut = d3.arc() .outerRadius(radiusDonut - 10) .innerRadius(radiusDonut - 60); var pieDonut = d3.pie() .sort(null) .value(function(d) { return d.value; }); var svgDonut = d3.select("#donutchart").append("svg") .attr("width", widthDonut) .attr("height", heightDonut); var dataNestDonut = d3.nest() .key(function(d) { return d.year; }) .object(data); createDonut(); function createDonut() { var initialData = getDataFromYear(yearSelected); drawDonut(initialData); }
{ "domain": "codereview.stackexchange", "id": 30696, "lm_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, dom, data-visualization, d3.js", "url": null }
Let $a_n$ be the time at which the $n$th bullet strike occurs. We have $a_1=x_0/v_0$ and $$\begin{equation*} v_0(a_n-(n-1)T) = v_0(a_{n-1}-(n-2)T) + v(n-1)(a_{n}-a_{n-1}) \end{equation*}$$ In words, the distance between the block and the gun at the $n$th strike is the distance between the block and the gun at the $(n-1)$th strike plus the distance the block travels between the strikes. Rearranging we find $$a_n = a_{n-1} + \frac{p+n-1}{p} T$$ as claimed. This recursion can be solved by standard techniques. We find $$a_n = \frac{x_0}{v_0} + \frac{(n-1)(n+2p)}{2p} T.$$ As a consistency check we take the limit where $p$ is large. Then $$a_n \sim \frac{x_0}{v_0} + (n-1)T.$$ This is the result we should expect for bullets fired at an immovable wall.
{ "domain": "stackexchange.com", "id": null, "lm_label": "1. YES\n2. YES", "lm_name": "Qwen/Qwen-72B", "lm_q1_score": 0.9854964188177183, "lm_q1q2_score": 0.803408707608191, "lm_q2_score": 0.8152324983301568, "openwebmath_perplexity": 165.28206878160688, "openwebmath_score": 0.915440559387207, "tags": null, "url": "http://physics.stackexchange.com/questions/62265/firing-machine-question" }
homework-and-exercises, electric-circuits, electrical-resistance, capacitance, inductance Title: Infinite array of capacitors and inductors You may be familiar with the surprising result one gets when calculating the equivalent of an infinite array of resistors. What if we change this circuit and replace the resistors with capacitors and inductors? Following the notation given in the link I've provided above, let's replace $R_1$ with $C$ and $R_2$ with $L$ so that $$R_1 \rightarrow Z_1=\frac{-j}{\omega C}$$ $$R_2 \rightarrow Z_2=j\omega L$$ where $j$ is the imaginary unit. Again using the result written in that link, we get the following equation: $$Z_{eq}^2-\frac{j}{\omega C}Z_{eq}-\frac{L}{C}=0$$ Solving this quadratic equation we get that: $$Z_{eq}=\frac{\frac{j}{\omega C}\pm\sqrt{\frac{-1}{\omega^2C^2}+4\frac{L}{C}}}{2}=\pm\sqrt{\frac{L}{C}-\frac{1}{(2\omega C)^2}}+j\frac{1}{2\omega C}$$ So an array of ideal capacitors and inductors lead to a complex (not imaginary) equivalent impedance if $L>\frac{1}{4C\omega^2}$. This means that, if the circuit was fed with a source, actual power would be dissipated, even though each of the individual impedances are purely reactive. How does this make sense? Initially I thought you had just rediscovered the Telegrapher's Equations - but then I realized you had your capacitors and inductors "the other way around" from that more usual scenario (described here)
{ "domain": "physics.stackexchange", "id": 37756, "lm_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, electric-circuits, electrical-resistance, capacitance, inductance", "url": null }
organic-chemistry, hydrogen, nmr-spectroscopy Using the chemical shift of a proton and the observed splitting (e.g. the coupling constants, or J values) can go a long way in helping to determine a structure, particularly in relatively simple molecules. As molecules get more complicated you can do advanced experiments to help with the structure determination. One example would be spin decoupling experiments. For example, if we "know" which signal is due to the D protons, we could irradiate them with energy during our nmr experiment. If they are coupled to proton B (they are), then the triplet in the B signal should diappear and we would just see our doublet of doublets. This type of experiment confirms which protons are coupled to which other protons. There are many other advanced nmr techniques that can be used to help in structure elucidation.
{ "domain": "chemistry.stackexchange", "id": 1216, "lm_label": null, "lm_name": null, "lm_q1_score": null, "lm_q1q2_score": null, "lm_q2_score": null, "openwebmath_perplexity": null, "openwebmath_score": null, "tags": "organic-chemistry, hydrogen, nmr-spectroscopy", "url": null }
electrostatics, charge, geometry Title: How can we find the charge distribution of $n$ external electrons on the surface of a conducting cube? Suppose we take 'n' electrons and put them on the surface of a conducting cube. How can we calculate the charge distrubution and position of these electrons once the static situation has been arrived at. The same problem on a sphere is called the Thomson problem and is unsolved (analytically, at least) for arbitrary $n$. I am virtually certain that the cubical version is as well. The solution for $n=2$ is obvious. The solution for $n=8$ seems obvious but is probably nontrivial to prove.
{ "domain": "physics.stackexchange", "id": 60286, "lm_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, charge, geometry", "url": null }