text stringlengths 1 1.11k | source dict |
|---|---|
homework-and-exercises, electromagnetism, magnetic-fields, magnetostatics
My assumption was correct. Because the current is $\hat{a_{z}}$ directed, the $\vec{H}$ field will be $\hat{a_{\phi}}$ directed, and therefore, we can equate $\frac{J_{0}\rho}{2}\hat{a_{\phi}}$ to $(\frac{\partial{A_{\rho}}}{\partial{z}} - \frac{\partial{A_{z}}}{\partial{\rho}})\hat{a_{\phi}}$. Because the current density is only in a single direction, we should expect the vector potential to be along the same axis, albeit in the opposite direction. Therefore we would have that $\vec{A} = -\frac{J_{0}}{2}\int_{0}^{\rho}\rho\prime d\rho\prime \hat{a_{z}}$. | {
"domain": "physics.stackexchange",
"id": 47705,
"lm_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, electromagnetism, magnetic-fields, magnetostatics",
"url": null
} |
genetics, microbiology, bacteriology
Now there are even more novel ways of production of extracellular DNA like in Neisseria gonorrhoeae secretion of chromosomal DNA occure via new type IV secretion system (Hamilton et al 2005). Not just experiments, mathematical models also shows novel role of such process in gene-level selection (Draghi and Turner 2006). I haven't touched upon uptake of these DNA, which itself has lot of literature and unique mechanisms like this. | {
"domain": "biology.stackexchange",
"id": 4744,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "genetics, microbiology, bacteriology",
"url": null
} |
# Prove that: $\frac1{20}\le \int_{1}^{\sqrt 2} \frac{\ln x}{\ln^2x+1} dx$
I'm interested in proving the following integral inequality:
$$\frac1{20}\le \int_{1}^{\sqrt 2} \frac{\ln x}{\ln^2x+1} dx$$
According to W|A the result of this integral isn't pretty nice, and involves the exponential integral.
-
Let $f(x) = \dfrac{\ln(x)}{\ln^2(x) + 1}$. $f(x)$ is concave in $[1,\sqrt{2}]$.
Hence, the area of $f(x)$ from $1$ to $\sqrt{2}$ i.e. the area under the blue curve is greater than the area of the triangle between the two points at which the blue curve and the red curve intersect i.e. \begin{align} \int_1^{\sqrt{2}} f(x) dx & \geq \dfrac12 \times (\sqrt{2} - 1) \times (f(\sqrt{2}) - f(1)) = \dfrac{\sqrt{2}-1}2 \times \dfrac{\ln(\sqrt{2})}{\ln^2(\sqrt{2})+1}\\ & = \dfrac{(\sqrt{2}-1)\ln(2)}{\ln^2(2)+4} \approx 0.06408 > \dfrac1{20} \end{align}
-
That's a nice solution! Thanks! – Chris's sis the artist Jun 22 '12 at 7:40 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9835969660413473,
"lm_q1q2_score": 0.8087027278653753,
"lm_q2_score": 0.8221891239865619,
"openwebmath_perplexity": 695.1797628470932,
"openwebmath_score": 0.9940284490585327,
"tags": null,
"url": "http://math.stackexchange.com/questions/161549/prove-that-frac120-le-int-1-sqrt-2-frac-ln-x-ln2x1-dx/161553"
} |
matrix, graph, combinatorics, r, bioinformatics
"match.arg" 0.02 0.07 0.00 0.00
"nrow" 0.02 0.07 0.00 0.00
"Rattribnames<-" 0.02 0.07 0.00 0.00
"Rattribnames" 0.02 0.07 0.00 0.00
"sort.list" 0.02 0.07 0.00 0.00
"split" 0.02 0.07 0.00 0.00
"split.default" 0.02 0.07 0.00 0.00
"validGraph" 0.02 0.07 0.00 0.00
"validityMethod" 0.02 0.07 0.00 0.00
"validObject" 0.02 0.07 0.00 0.00 | {
"domain": "codereview.stackexchange",
"id": 22190,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "matrix, graph, combinatorics, r, bioinformatics",
"url": null
} |
navigation, move-base
The content of dwa_local_planner_params.yaml is listed below:
DWAPlannerROS:
acc_lim_th: 3.2
acc_lim_x: 2.5
acc_lim_y: 2.5
max_vel_x: 0.65
min_vel_x: 0.0
max_vel_y: 0.1
min_vel_y: -0.1
max_trans_vel: 0.65
min_trans_vel: 0.1
max_rot_vel: 1.0
min_rot_vel: 0.4
sim_time: 1.7
sim_granularity: 0.025
goal_distance_bias: 32.0
path_distance_bias: 24.0
occdist_scale: 0.01
stop_time_buffer: 0.2
oscillation_reset_dist: 0.05
forward_point_distance: 0.325
scaling_speed: 0.25
max_scaling_factor: 0.2
vx_samples: 3
vy_samples: 10
vtheta_samples: 20
sim_period: 0.1
xy_goal_tolerance: 0.2
yaw_goal_tolerance: 0.17
rot_stopped_vel: 0.01
trans_stopped_vel: 0.01
Could someone tell me why ? Thank you!
Originally posted by scopus on ROS Answers with karma: 279 on 2015-05-18
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 21713,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "navigation, move-base",
"url": null
} |
java, quiz
// this method can be used as a safe way to get an int value from the user
public static int saveIntInput(int min, int max) {
int number = 0;
boolean inputAccepted = false;
while(!inputAccepted) {
System.out.print("Input: ");
try {
String userInput = input.nextLine();
number = Integer.parseInt(userInput);
if (number > max || number < min) {
System.out.println("Please enter a valid argument.");
} else {
inputAccepted = true;
}
} catch (NumberFormatException e) {
System.out.println("Please enter a valid argument.");
}
}
return number;
} | {
"domain": "codereview.stackexchange",
"id": 30503,
"lm_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, quiz",
"url": null
} |
signal-detection, snr, matched-filter, linear-chirp, radar
Edit2: After some thinking I've concluded it as follows: No matter what the signal modulation or bandwidth, peak SNR at matched filter output is same for input pulses of same energy. However, input noise power is proportional to the bandwidth of signal which gets filtered on matched filter and that's what we call matched filter gain. Correct me if I'm wrong. It's often said that pulse compression gives you a gain proportional to the time-bandwidth product (otherwise known as the pulse compression ratio, or $PCR$). This is a really misleading statement, and it had me confused enough to sit down and think about it for awhile. I thought I'd share some of my findings that I pieced together from both reading the internet and from my own DSP simulations.
The claim | {
"domain": "dsp.stackexchange",
"id": 9997,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "signal-detection, snr, matched-filter, linear-chirp, radar",
"url": null
} |
php, sql
Use implode() instead of conditionally appending seperators
I see a few places like the block from select() below, where array elements are appended to the query property and then commas are added if end of the list hasn't been reached: | {
"domain": "codereview.stackexchange",
"id": 31025,
"lm_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, sql",
"url": null
} |
gazebo, simulation, simulator-gazebo, param-server, sensor
Title: Sensor Camera on Gazebo: Could not find parameter robot_description on parameter server
hi all,
i'm trying to create a sensor camera on gazebo, but i have this message on the terminal when i run the launch file:
[ERROR] [1323711066.531080823]: Could not find parameter robot_description on parameter server
[ERROR] [1323711066.531205567]: Could not generate robot model
[ERROR] [1323711066.531238167]: Failed to extract kdl tree from xml robot description
[robot_state_publisher-4] process has died [pid 2161, exit code 255].
log files: /home/mauro/.ros/log/0edc0fb2-24e7-11e1-ba97-0016ea548718/robot_state_publisher-4*.log
i created a launch file:
<launch>
<node name="gazebo" pkg="gazebo" type="gazebo"
args="$(find my_erratic)/worlds/my_world.world" output="screen" respawn="false" />
<include file="$(find my_erratic)/launch/my_camera.launch" />
</launch> | {
"domain": "robotics.stackexchange",
"id": 7611,
"lm_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, simulation, simulator-gazebo, param-server, sensor",
"url": null
} |
% ====================== YOUR CODE HERE ======================
% Instructions: First, for each feature dimension, compute the mean
% of the feature and subtract it from the dataset,
% storing the mean value in mu. Next, compute the
% standard deviation of each feature and divide
% each feature by it's standard deviation, storing
% the standard deviation in sigma.
%
% Note that X is a matrix where each column is a
% feature and each row is an example. You need
% to perform the normalization separately for
% each feature.
%
% Hint: You might find the 'mean' and 'std' functions useful.
%
mu = mean(X); % mean value
sigma = std(X); % standard deviation
X_norm = (X - repmat(mu,size(X,1),1)) ./ repmat(sigma,size(X,1),1);%新数据=(原数据-均值)/标准差
end</span>
theta = theta - alpha / m * X' * (X * theta - y); | {
"domain": "csdn.net",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9693242000616579,
"lm_q1q2_score": 0.8332928825127084,
"lm_q2_score": 0.8596637559030337,
"openwebmath_perplexity": 4764.266934631085,
"openwebmath_score": 0.4752386510372162,
"tags": null,
"url": "http://blog.csdn.net/ZHE123ZHE123ZHE123/article/details/51565690"
} |
ros, rviz, robot-model
Originally posted by dgossow with karma: 1444 on 2013-05-19
This answer was ACCEPTED on the original site
Post score: 2
Original comments
Comment by TommyP on 2013-05-19:
Yes, it stopped working in a recent rviz update but I do not know exactly when. I will check the unit property.
Comment by TommyP on 2013-05-19:
Changing the unit definition of meter from 0.01 to 1.0 solved the problem with my old Collada files. The Wings3d export to Collada works OK. I am still interested in alternative conversion paths which could give nicer handling of material properties.
Comment by dgossow on 2013-05-19:
The tools you use have parameters that control the scaling, they should do the job without manual adjustments.
Comment by TommyP on 2013-05-19:
That means that I have to learn the tools... And I really thought my original format was unit less. So it was really a surprise for me that units are added in some formats. | {
"domain": "robotics.stackexchange",
"id": 14217,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, rviz, robot-model",
"url": null
} |
the Germans ever use captured Allied aircraft against the Allies? 2cli2@ilstu.edu 3kishan@ecs.syr.edu. With Example 2: … This section focuses on "Relations" in Discrete Mathematics. 0000000636 00000 n Nearly all areas of research be it Mathematics, Computer Science, Actuarial Science, Data Science, or even Engineering use Set Theory in one way or the other. 0000004494 00000 n K. A. Ross and C. R. B. Wright, Discrete Mathematics (Fifth … Theorem – … If $$R$$ is an equivalence relation on the set $$A$$, its equivalence classes form a partition of $$A$$. From Wikipedia, the free encyclopedia In the mathematics of binary relations, the composition relations is a concept of forming a new relation R ; S from two given relations R and S. The composition of relations is called relative multiplication in the calculus of relations. What is the correct way to say I had to move my bike that went under the car in a crash? startxref 0000004982 00000 n The textbook for this course is Keneth H. Rosen: | {
"domain": "caece.net",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.966410494349896,
"lm_q1q2_score": 0.825230247508156,
"lm_q2_score": 0.8539127548105612,
"openwebmath_perplexity": 1225.8404414427655,
"openwebmath_score": 0.5750621557235718,
"tags": null,
"url": "http://convr2012.caece.net/tall-wingback-lhjfdq/d7c465-powers-of-relations-discrete-mathematics"
} |
ros, actionlib-tutorials, rosjava, android
File "/home/steve/ROS_DIR/rosjava_core/rosjava_bootstrap/src/main/python/rosjava_bootstrap/maven.py", line 105, in _map_package_dependencies
_map_exports(rospack, dependency, export_operator, _transtive_dependency_scope_check, scope)
File "/home/steve/ROS_DIR/rosjava_core/rosjava_bootstrap/src/main/python/rosjava_bootstrap/maven.py", line 86, in _map_exports
package_directory = roslib.packages.get_pkg_dir(package)
File "/opt/ros/electric/ros/core/roslib/src/roslib/packages.py", line 220, in get_pkg_dir
raise InvalidROSPkgException("Cannot locate installation of package %s: %s. ROS_ROOT[%s] ROS_PACKAGE_PATH[%s]"%(package, rperr.strip(), ros_root, ros_package_path)) | {
"domain": "robotics.stackexchange",
"id": 7920,
"lm_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, actionlib-tutorials, rosjava, android",
"url": null
} |
cosmology, astronomy, galaxies, gravitational-waves, ligo
For a concrete visual demonstration, I randomly picked a galaxy not too different from Andromeda (a bit dimmer at absolute g-band magnitude of $-20.2$) at $z = 0.122$. This is SDSS object J003530.92+153322.6, an image of which is below. | {
"domain": "physics.stackexchange",
"id": 28417,
"lm_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, astronomy, galaxies, gravitational-waves, ligo",
"url": null
} |
average rate as: Taboga, Marco ( 2017 ) theory and mathematical statistics Third! Mathematically define the exponential distribution is often concerned with the amount of time ( beginning now ) until earthquake! Define the exponential distribution is one exhibiting a random arrival pattern in the following sense: 1 \beta. Which half of the exponential distribution continuously and independently at a constant average rate also a Weibull distribution where math... Full sample case, the amount of time until some specific event occurs life is the sample mean value... Is one exhibiting a random arrival pattern in the chapter on reliability ( chapter 8 ) amount of exponential distribution mean! Expectation of independent exponential random variables used to model the time elapsed between events in a process. As the time elapsed between events in a Poisson process of rate ». Probability distribution used to model the reliability of electronic systems, which many times leads to its in! Kotz, | {
"domain": "ibizasailing.net",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9697854120593483,
"lm_q1q2_score": 0.82999195900592,
"lm_q2_score": 0.8558511488056151,
"openwebmath_perplexity": 679.9590414879955,
"openwebmath_score": 0.8454276919364929,
"tags": null,
"url": "https://ibizasailing.net/aatwy2/69a78e-exponential-distribution-mean"
} |
logic, induction
This has been studied quite a bit, but success of general purpose automatic theorem provers is somewhat limitied in the presence of induction, for the following reasons: | {
"domain": "cs.stackexchange",
"id": 6333,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "logic, induction",
"url": null
} |
python, programming-challenge, time-limit-exceeded, complexity
I timed the above code and it took just 0.0276817503901 seconds on the same input. What is it that I'm doing wrong? if a == N+1:
counters = [maximum]*N #array initializer
Looks \$O(N)\$ to me, making your total time complexity \$O(Nm)\$ worst case. The other guy has 2 separate loops, one \$O(m)\$ the next \$O(n)\$, for a total time complexity of \$O(m+n)\$ or \$O(max(n,m))\$.
Take home message:
Ditch the \$O(N)\$ array initializer, it's not worth it. Use 2 separate passes, like the other guy did. | {
"domain": "codereview.stackexchange",
"id": 23690,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, programming-challenge, time-limit-exceeded, complexity",
"url": null
} |
ruby, ruby-on-rails, html5
private
def grid_bounds(position, grid_size, min, max)
half_size = grid_size / 2
min_pos = position - half_size
max_pos = position + half_size
if min_pos < min
(min..[min + grid_size, max].min)
elsif max_pos > max
([max - grid_size, min].min..max)
else
(min_pos..max_pos)
end
end
end | {
"domain": "codereview.stackexchange",
"id": 17080,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ruby, ruby-on-rails, html5",
"url": null
} |
python, multithreading
Preferably do logging to a file as well, not just the console or you could miss error messages. The Python docs have a lot of details, which take some time to assimilate but I feel like every Python programmer should get acquainted with this module and use it extensively and not just for debugging purposes.
The requests module has its own exception class, these are the exceptions you may want to handle. It is even possible to recover gracefully from transient network errors using urllib3 Retry capabilities as described here.
Regarding the HTTP status code: you normally always expect a 200 response. Sometimes 201 is used in APIs that create resource objects. Checking for 500 does not suffice, you could for example stumble on 502, 503, and others + the 4xx class errors such as 404.
So any response other than 200 should normally be treated as an error. | {
"domain": "codereview.stackexchange",
"id": 45558,
"lm_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, multithreading",
"url": null
} |
mathematical-physics, differential-geometry, topology, algebraic-geometry
the corresponding point on sheet 2. A second rotation by $2\pi$ so that $z \to e^{4\pi i} z$ however, does bring us back to the same point. On such a surface, $f(z)$ becomes a totally well-defined function since $z$ and $e^{2\pi i}z$ are distinct points. | {
"domain": "physics.stackexchange",
"id": 26781,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "mathematical-physics, differential-geometry, topology, algebraic-geometry",
"url": null
} |
Bourne. If you love it, our example of the solution to eigenvalues and eigenvectors of 3×3 matrix will help you get a better understanding of it. Ready-to-use formulas for the inverse of 2x2 and 3x3 matrices. In order for MINVERSE to calculate an inverse matrix, the input array must contain numbers only and be a square matrix, with equal rows and columns. Linear Algebra and Its Applications, 4th Edition, Follow Singapore Maths Tuition on WordPress.com, My All 2020 Mathematics A to Z: Wronskian, PSLE 2020 Results and PSLE Cut Off Point 2020. Easy Trick To Multiply Matrices Cool Shortcut Matrix Precalculus. The determinant of a non square matrix does not exist, only determinants of square matrices are defined mathematically. Step 1: Matrix of Minors. The Relation between Adjoint and Inverse of a Matrix. And so, taking into consideration the formula for the determinant of a square matrix with dimensions 2x2, we can see that equation 3 yields: At this point you may have noticed that | {
"domain": "fluencyuniversity.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9848109489630493,
"lm_q1q2_score": 0.8051562957482302,
"lm_q2_score": 0.8175744761936437,
"openwebmath_perplexity": 226.92872746800123,
"openwebmath_score": 0.723311722278595,
"tags": null,
"url": "http://fluencyuniversity.com/m9o4am/b437h.php?cc98e9=inverse-of-a-3x3-matrix-shortcut"
} |
species-identification, botany
Title: Shrub in open gravel field
Location: Gravelly open field. East of Toronto.
Date: August 4, 2022
Description: Shrub; alternating leaves; 8 feet tall; trunk is 1.5 inches wide at the base.
Tip: It's possible to zoom in on the photos by clicking them a couple of times Almost certainly Hawthorn (Crataegus) genus. This is a fairly common genus of flowering and fruiting shrubs to small trees that produce white flowers in the spring and small red apple-shaped (pome) fruit in autumn. Species are found wild all over the Northern Hemisphere and are invasive in a number of countries in the Southern Hemisphere.
They are characteristically quite thorny (as you can see in your photos 2 and 3), with the spikes being actually short stems. Leaves arise from the short spurs off stems and several species have deeply lobed and/or serrated leaves (leaves have both in your photos).
There are quite a few species, but which one this is, I don't know. | {
"domain": "biology.stackexchange",
"id": 12007,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "species-identification, botany",
"url": null
} |
Iterating all the elements can be done by using iteri function. The following example prints out all the elements on the screen.
Mat.iteri (fun i j a -> Printf.printf "(%i,%i) %.1f\n" i j a) x;;
If you want to create a new matrix out of the existing one, you need mapi and map function. E.g., we create a new matrix by adding one to each element in x.
Mat.map ((+.) 1.) x;;
We can take some rows out of x by calling rows function. The selected rows will be used to assemble a new matrix.
Mat.rows x [|0;2|];;
R0 1 2 3 4 5 6
R1 13 14 15 16 17 18
- : Owl_dense_real.mat =
Similarly, we can also select some columns as below.
Mat.cols x [|3;2;1|];;
C0 C1 C2
R0 4 3 2
R1 10 9 8
R2 16 15 14
R3 22 21 20
- : Owl_dense_real.mat =
Iterating rows and columns are similar to iterating elements, by using iteri_rows, mapi_rows, and etc. The following example prints the sum of each row.
Mat.iteri_rows (fun i r ->
Printf.printf "row %i: %.1f\n" i (Mat.sum r)
) x;; | {
"domain": "ocaml.xyz",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9817357248544007,
"lm_q1q2_score": 0.8181045276495404,
"lm_q2_score": 0.8333245973817158,
"openwebmath_perplexity": 3206.399961367396,
"openwebmath_score": 0.3930170238018036,
"tags": null,
"url": "https://ocaml.xyz/chapter/matrix.html"
} |
python, beginner, python-3.x, calculator, tkinter
Button(master,text="0",width=3,command=lambda:self.action(0)).grid(row=4, column=0)
Button(master,text=".",width=3,command=lambda:self.action('.')).grid(row=4, column=1)
Button(master,text="(",width=3,command=lambda:self.action('(')).grid(row=2, column=4)
Button(master,text=")",width=3,command=lambda:self.action(')')).grid(row=2, column=5)
Button(master,text="√",width=3,command=lambda:self.squareroot()).grid(row=3, column=4)
Button(master,text="x²",width=3,command=lambda:self.square()).grid(row=3, column=5)
#Main
root = Tk()
obj=calc(root) #object instantiated
root.mainloop()
When I was learning Python, I found The Zen of Python quite helpful.
Formatting
I agree about renaming self.e to self.textbox. Descriptive names are generally better, unless this results in an overly long and unwieldy name. In addition to that there are a few more formatting issues. (You may find the PEP 8 Style Guide helpful) | {
"domain": "codereview.stackexchange",
"id": 32680,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, beginner, python-3.x, calculator, tkinter",
"url": null
} |
$\displaystyle \left[\begin{matrix}1 &0 &3\\ 0 &1 &4\\ 0 & 0 &0\end{matrix}\left|\begin{matrix}3\\ 5\\ 2\end{matrix}\right]$
The last row there is a contradiction, because if you multiply every variable by zero, you're going to get zero, which is not equal to 2.
In any case, the important thing in your case is that there is a solution. Getting back to the original question, what does this tell you?
Since there is a solution, then that means that b is a linear combination of the 3 matrices listed.
How would I write that out, though? In the example my professor gave us, we ended up with something like x1 = 3, x2 = 4, which implied that 3(a1) + 4(a2) = b, and so b was a linear combination. But since this has infinite solutions, would I just write "infinite solutions - b is a linear combination" ?
10. Well, I'd gather together all the info you have. You started with
(x1)(a1) + (x2)(a2) + (x3)(a3) = b.
You got it down to
x1 = 2 - 5(x3)
x2 = 3 - 4(x3). | {
"domain": "mathhelpforum.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9724147185726374,
"lm_q1q2_score": 0.8060723000624934,
"lm_q2_score": 0.8289388104343892,
"openwebmath_perplexity": 366.61068745750936,
"openwebmath_score": 0.7553537487983704,
"tags": null,
"url": "http://mathhelpforum.com/advanced-algebra/156631-linear-combinations-matrices.html"
} |
organic-chemistry, reaction-mechanism, nucleophilic-substitution, elimination, c-c-addition
and it is treated with alcoholic KOH.
I know that a hydrogen in $\alpha$-position to the carbonyl group will be abstracted, leaving a carbanion. My query lies in deciding what pathway will the substrate follow from hereon. I see three options: An E1cB elimination of the bromide, aldol condensation by nucleophilic addition to the carbonyl group and SN2 with the 1 degree bromide.
Which pathway will be favored and why?
I'd be glad if someone could specify the conditions for one pathway being predominantly favored over another (even if I haven't provided information regarding that, like temperature, solvent, etc) or some empirical data on one pathway being faster or slower. Any degree of help will be appreciated, thank you.
Edit: The answer in the book where this question is from says that nucleophilic addition should predominate (providing neither justification nor data), which contradicts my guess that elimination would dominate because of it being an internal mechanism. | {
"domain": "chemistry.stackexchange",
"id": 9729,
"lm_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, reaction-mechanism, nucleophilic-substitution, elimination, c-c-addition",
"url": null
} |
python, python-3.x
return raw_response.json()
def split_races(races):
track_names = list(
set(
[
race['G_track']
for race in races
]
)
)
return {
track_name: [
race['N_time']
for race in races
if race['G_track'] == track_name
]
for track_name in track_names
}
def write_all_races_to_sheet(worksheet, races):
races_split = split_races(races=races)
track_names = races_split.keys()
racing_data = get_racing_data(track_names=track_names)
favourites = get_relevant_favourites(
favourites=racing_data['yrs']['Fav']
)
write_meeting_to_sheet(
worksheet=worksheet,
favourites=favourites,
row=0,
start_column=16
)
set_this_year_all_formulas(
row=2,
worksheet=worksheet,
number_of_favourites=len(favourites)
)
return favourites | {
"domain": "codereview.stackexchange",
"id": 38941,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, python-3.x",
"url": null
} |
python, beginner, python-3.x, tkinter
self.scale_iterartions = tk.Scale(
self,
variable=self.iterations,
orient=tk.HORIZONTAL,
from_=self.ITERATIONS_MIN,
to=self.ITERATIONS_MAX,
resolution=self.ITERATIONS_RESOLUTION,
label="Iterations:"
)
self.scale_timer = tk.Scale(
self,
variable=self.timer,
orient=tk.HORIZONTAL,
from_=self.TIMER_MIN,
to=self.TIMER_MAX,
resolution=self.TIMER_RESOLUTION,
label="Timer:"
)
self.checkbutton_doubleclick = tk.Checkbutton(self, variable=self.doubleclick, text="Doubleclick")
self.button_start = tk.Button(self, text="Start", command=self.start)
self.label_error = tk.Label(self, foreground="red") | {
"domain": "codereview.stackexchange",
"id": 32592,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, beginner, python-3.x, tkinter",
"url": null
} |
For a point $(x,y)$ on the parabola we have that
$$d^2=(y-0)^2+\left(x-\frac32\right)^2=y^2+x^2-3x+\frac94=x^2-x+\frac94$$
and the minimum is attained for $x=\frac12$ thus at the point $(\frac12,1)$ and therefore
$$d=\sqrt{1^2+1^2}=\sqrt 2$$
• Note that there are two points – $(\frac 12, 1)$ and $(\frac 12, -1)$ – where the same minimum distance is attained, see the image in José's answer. – Paŭlo Ebermann Jun 11 '18 at 21:09
• @PaŭloEbermann Yes of course by symmetry, indeed the distance for y positive or negative is the same $$d=\sqrt{(y-0)^2+\left(x-\frac32\right)^2}=\sqrt{(-y-0)^2+\left(x-\frac32\right)^2}$$ – user Jun 11 '18 at 21:13 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9790357542883923,
"lm_q1q2_score": 0.8262034821135036,
"lm_q2_score": 0.843895106480586,
"openwebmath_perplexity": 176.8516805152871,
"openwebmath_score": 0.9972216486930847,
"tags": null,
"url": "https://math.stackexchange.com/questions/2815493/shortest-distance-between-parabola-and-point"
} |
sql, datetime, sql-server
Here I took the liberty of aliasing the returned columns to make them a little easier on the eye for the end user, as well as capitalising keywords.
There is no agreed upon standard to SQL, so feel free to re-lowercase everything, but conventionally SQL is written with keywords in ALL CAPS
Performance Increases
The query I walked through above should perform better than the one in the question as it avoids the sub-select.
I would make sure that the ReaderData table is properly indexed, this can and will drastically speed up queries and make sure that the statistics on the table are up to date. | {
"domain": "codereview.stackexchange",
"id": 12927,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "sql, datetime, sql-server",
"url": null
} |
homework-and-exercises, newtonian-mechanics, mathematical-physics, oscillators, differential-equations
$$
\sum F=m\ddot{x}=-mg\cos\theta - 2k\sin(\theta)(x-x_i)\cos(\frac{\pi}{2}-\theta)
\\
m\ddot{x} + 2kx\sin^2(\theta) = 2kx_i\sin^2(\theta) - mg\cos(\theta)
$$
Now, I don't know whether I should continue to solve it like an in-homogeneous differential equation because I feel like I'm over-complicating this just to solve for the frequency. Also, the only "variables" here are $\ddot{x}$ and $x$. Everything else are constants, including the trig functions. Any help on how to move forward on this problem or another way of solving this would be high appreciated. Thank you The last equation is just inhomogeneous differential equation for the simple harmonic motion. So use,
$$x(t)=x_{inhm}(t)+Asin(\omega t)+Bcos(\omega t)$$
for further calculations. | {
"domain": "physics.stackexchange",
"id": 67041,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises, newtonian-mechanics, mathematical-physics, oscillators, differential-equations",
"url": null
} |
Volume Patterns for Pyramids. Side length of base 4. - BL touch automatic leveling & direct drive are available as optional add-on. Oblique pyramid, regular pyramid, right regular pyramid, volume, surface area, tetrahedron, area of a regular polygon this page updated 19-jul-17 Mathwords: Terms and Formulas from Algebra I to Calculus. Volume of a hemisphere, formula and examples. Volume counting has been simplified, no longer quantified by repetitions per body part, but rather sets per muscle group or movement pattern. This Volume of Pyramid Video is suitable for 6th - 11th Grade. A pyramid with a triangular base and is called a tetrahedron. org are unblocked. They might take a very long time to load on some computers. March 2, 2019 March 2, 2019 Craig Barton. Cone - This is similar to the pyramid, the area of the circle being the base area. The volume of a pyramid (also any cone) is =, where b is the area of the base and h the height from the base to the apex. I think I need the volume | {
"domain": "pe64853.de",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9766692332287863,
"lm_q1q2_score": 0.8201423244467436,
"lm_q2_score": 0.8397339616560072,
"openwebmath_perplexity": 566.7055802940213,
"openwebmath_score": 0.6127729415893555,
"tags": null,
"url": "http://emuy.pe64853.de/volume-of-pyramid.html"
} |
digital-communications, ofdm, ifft
Title: Alamouti code after or before IFFT block in OFDM We are trying to implement Alamouti STBC on underlying ofdm signal. We were thinking as to where to write alamouti coder block.
I thought we could write it after the cyclic prefixer block as we get a symbol after the IFFT and cyclic prefixer. we could take two such symbols,send both of them at one time instant and then conjugate them and send them on the next time instant.
But then we saw a few block diagrams where alamouti coder is used before IFFT block and after ofdm symbol mapper. when I searched why that's the case, there were reasons that said for OFDM to be effective, symbols should be assigned to subcarriers in frequency domain to mitigate multipath effects and not in time domain. The points that I don't understand are: | {
"domain": "dsp.stackexchange",
"id": 5479,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "digital-communications, ofdm, ifft",
"url": null
} |
• $$S_2=\{(+1),(-1+3),(3)\}$$ $$\implies$$ $$a_2$$ is an anchor element.
• $$S_3=\{(+1),(-1+3),(3),(-3+7),(+1-3+7),(-1+7),(7)\}$$ $$\implies$$ $$a_3$$ is an anchor element.
• $$\dots$$ proceed via induction to show every $$a_n$$ is an anchor element.
Since $$\mathcal A(\{2^n-1\})$$ exists and covers the entire $$\{2^n-1\}$$, the $$\{2^n-1\}$$ is an alt-basis.
Example $$2$$. The $$\mathcal A(\{n\})=\{1\}$$ does not cover the entire $$\{n\}$$, hence $$\{n\}$$ is not an alt-basis.
It is not hard to see that $$\max S_n = n \lt 2^n-1\implies a_n$$ is not an anchor element, for every $$n\gt 1$$.
Example $$3.$$ We construct an alt-basis where every $$2$$nd element is an anchor element.
$$A=\begin{cases} 2^n-1, & n\text{ is even} \\ 2^n+2^{n-1}-1, & n\text{ is odd} \end{cases}$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.986777180969715,
"lm_q1q2_score": 0.8519751476343344,
"lm_q2_score": 0.8633916187614823,
"openwebmath_perplexity": 1235.820987497876,
"openwebmath_score": 0.9273799061775208,
"tags": null,
"url": "https://math.stackexchange.com/questions/3593728/aternating-sum-of-an-increasing-sequence-of-positive-integers"
} |
haskell, complex-numbers
rotate_ccw :: Gaussian -> Gaussian
rotate_ccw (a :+ b) = (negate b :+ a)
-- Rotate a gaussian integer counterclockwise.
-- Equivalent to multiplying by -i.
flip_x :: Gaussian -> Gaussian
flip_x (a :+ b) = (negate a :+ b)
-- Flips on imaginary axis.
-- Analogous to conjugate.
flip_y :: Gaussian -> Gaussian
flip_y = conjugate
-- Alias for conjugate.
-- See conjugate.
swap_x_y :: Gaussian -> Gaussian
swap_x_y (a :+ b) = (b :+ a)
-- Utility function, swaps real and imaginary axes.
toComplex :: Num p => Gaussian -> Complex.Complex p
toComplex (a :+ b) = (fromInteger a Complex.:+ fromInteger b)
-- Converts a Gaussian to any complex number (Num p => Complex p)
-- Fully qualified operators to avoid clashing. | {
"domain": "codereview.stackexchange",
"id": 35841,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "haskell, complex-numbers",
"url": null
} |
c, stack
Title: FIFO, FILO, LIFO and LILO integer stacks in C One of my current side projects includes a stack-based interpreter written in C for a programming language I'm designing, SSBL. Since the entire language is stack-based, I needed a way to create and store stacks. Currently there are three separate stack types:
One that stores an array of unsigned chars.
One that stores an array of unsigned shorts.
One that stores an array of unsigned longs.
Each individual stack can also be created with a certain in-out type, which includes:
FIFO (first in, first out)
FILO (first in, last out)
LIFO (last in, first out)
LILO (last in, last out)
Here's the code:
ssbl_stack.h
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <stdlib.h>
#define STACK_SIZE 65535
#define STACK_MEMSET 0
typedef enum
{
FIFO,
FILO,
LIFO,
LILO
} SSBL_StackIO;
typedef struct
{
SSBL_StackIO m_IO;
unsigned short m_Count;
unsigned char m_Elements[STACK_SIZE];
} SSBL_StackUint8; | {
"domain": "codereview.stackexchange",
"id": 25739,
"lm_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, stack",
"url": null
} |
c#, error-handling, generics, type-safety, state
Also, this illustrates that there need be no asynchrony in a task! A task is just the concept of "I'll provide a value or an exception in the future if I don't already have it now". If you already have it now, great; you can use tasks to represent your "failable" concept, and await them like any other task. | {
"domain": "codereview.stackexchange",
"id": 25621,
"lm_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#, error-handling, generics, type-safety, state",
"url": null
} |
python, performance, parsing, xml, mongodb
Title: Import huge XML data set into MongoDB while parsing data I am currently working with the Stack Exchange Data Dump - to be more precise - with the dumped Posts.xml data set from Stack Overflow.
What am I trying to achieve?
I want to read the whole data set and import each row (a post on Stack Overflow) as a document into an MongoDB database.
What am I doing right now?
I am using the iterparse() function from lxml to iterate over each row, without building a DOM. Every row contains attributes which hold the actual data. As every attribute is a String, I need to parse some attributes into Integers, Dates and Lists. This is done by the attrib_to_dict() function. The resulting Dictionary is simply inserted into the database collection.
What is the problem? | {
"domain": "codereview.stackexchange",
"id": 38302,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, performance, parsing, xml, mongodb",
"url": null
} |
c++, matrix, mathematics
Title: C++ matrix calculator I wrote a program that is able to perform calculations with matrices:
main.cpp (Just for test purposes)
#include <iostream>
#include <vector>
#include "matrix.hpp"
int main() {
std::cout << "Width (matrix 1):\n";
int width = getDimension();
std::cout << "Height (matrix 1):\n";
int height = getDimension();
std::vector<std::vector<double>> matrix(height, std::vector<double> (width));
//Now, the user has to enter the matrix line by line, seperated by commas
for(int i = 1; i <= height; i++) {
getUserInput(matrix, i, width);
} | {
"domain": "codereview.stackexchange",
"id": 37405,
"lm_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++, matrix, mathematics",
"url": null
} |
where is … Linear least squares does not restrict the solution to a linear curve-fit, but it requires that the unknown coefficients appear linearly in the equation. Ordinary least squares estimation. Hence we can compute. Carl Friedrich Gauss is credited with developing the fundamentals of the basis for least-squares analysis in 1795at the age of eighteen. They are connected by p DAbx. This article demonstrates how to generate a polynomial curve fit using the least squares method. Preprocess Online Parameter Estimation Data in Simulink. Hence if x data for x and find y between b and y. Of fundamental importance in statistical analysis is finding the least A general and flexible factor graph non-linear least square optimization framework. We have already spent much time finding solutions to Ax = b . The least squares regression line is one such line through our data points. We start with a collection of points with coordinates given by (x i, y i). Imagine you have some points, and | {
"domain": "magnetic-messages.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9822877044076955,
"lm_q1q2_score": 0.814256407422686,
"lm_q2_score": 0.82893881677331,
"openwebmath_perplexity": 690.3906100687715,
"openwebmath_score": 0.5047479867935181,
"tags": null,
"url": "http://www.dev.magnetic-messages.com/n3759/page.php?14400a=online-least-squares"
} |
python
and this is my error in terminal :
Traceback (most recent call last):
File "/home/adelleodel/ros/src/my_package/nodes/ZMP_tracker_command.py", line 26, in <module>
from my_package.msg import Skeleton
ImportError: No module named my_package.msg
Traceback (most recent call last):
File "/home/adelleodel/ros/src/my_package/nodes/ZMP_skelplot2.py", line 47, in <module>
from mocap.srv import *
ImportError: No module named mocap.srv
[tracker_command-1] process has died [pid 5382, exit code 1, cmd /home/adelleodel/ros/src/my_package/nodes/ZMP_tracker_command.py __name:=tracker_command __log:=/home/adelleodel/.ros/log/43be4ef4-8959-11e5-8b17-0185f2817c5b/tracker_command-1.log].
log file: /home/adelleodel/.ros/log/43be4ef4-8959-11e5-8b17-0185f2817c5b/tracker_command-1*.log | {
"domain": "robotics.stackexchange",
"id": 22978,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python",
"url": null
} |
ros-kinetic, actionlib
moveit_msgs::ExecuteTrajectoryActionGoal goal;
//goal.goal.trajectory.joint_trajectory = trajectory;
//goal.goal_time_tolerance = ros::Duration(1.0);
ac.sendGoal(goal);
//if (ac.waitForResult(goal.trajectory.points[goal.trajectory.points.size()-1].time_from_start + ros::Duration(5)))
//{
// ROS_INFO("Action server reported successful execution");
//return true;
//} else {
//ROS_WARN("Action server could not execute trajectory");
//return false;
//}
}
i can't figure out what's the problem of my code,.when i catkin_make the code, the output of the terminal is:
/home/lkj/catkin_ws/src/move_group_test/src/cartesian.cpp: In function ‘bool executeTrajectory(const JointTrajectory&)’: | {
"domain": "robotics.stackexchange",
"id": 27762,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros-kinetic, actionlib",
"url": null
} |
safety
Can you use dry air to remove excess water from other materials (such as acids)? In theory, this may be possible and will depend on the relative hygroscopicity of the drying agent and the material to be dried; you need to be sure that the air you are supplying your wet material with is dry enough to receive water and not simply supply more. Purge drying (passing dry air over a desiccant) is another form of regenerating industrial desiccants, but is not as effective as heating. Sulfuric acid is itself used as a desiccating agent as it is very hygroscopic. I don't know the relative hygroscopicity of NaOH and H2SO4/CH3COOH, but there is no way I would ever consider passing air from one container directly into the other chamber. This is a very hazardous setup, and is fraught with much danger. Heating an acid solution in a suitably ventilated environment under controlled conditions is still, to my knowledge, the most effective way to increase the concentration of the solution. | {
"domain": "chemistry.stackexchange",
"id": 2037,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "safety",
"url": null
} |
Writing Compound Inequalities Using Interval Notation – Ex 1 Writing Compound Inequalities Using Interval Notation – Ex 2 Writing Compound Inequalities Using Interval Notation – Ex 3 Absolute Value: Evaluating Numbers. Compound inequalities is when there is two inequality signs. One-Step Linear Equation Card FRONT BACK Two-Step Linear Equation Card FRONT BACK Multi-Step Linear Equation Card FRONT BACK property 2. Compound Inequality (con’t)• AND means the solution must work in BOTH inequalities• Example: x > 3 AND x < 8 • 5 is a solution because 5 > 3 AND 5 <8 • 2 is not a solution. Content on this page requires a newer version of Adobe Flash Player. She spends the rest of the money on earrings. A compound inequality contains at least two inequality symbols. SYSTEM of INEQUALITIES WORD PROBLEMS. Vocabulary A compound inequality consists of two separate inequalities joined by and or or. It provides the students with more practice to distinguish between "and", and "or". The foldable | {
"domain": "eastwolf-customs.de",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9802808753491772,
"lm_q1q2_score": 0.8014526275435109,
"lm_q2_score": 0.8175744806385542,
"openwebmath_perplexity": 1027.076080382449,
"openwebmath_score": 0.4408482015132904,
"tags": null,
"url": "http://wqcc.eastwolf-customs.de/compound-inequalities-notes.html"
} |
• @sat091 Any further doubt? – Robert Z Aug 16 at 10:10
• sorry for the late response, but I have one question, In the second integral where $v$ from $|u-2|$ to $1$, the limits for $v$ should be reversed, From the graph I have drawn the line $v=1$ is above the two lines $v+u=2$ and $u-v = 2$,therefore I think the limits should be reversed, Can you please check this again ? thanks for the help. – sat091 Aug 16 at 20:11
• @sat091 I think it is correct. Note that in the original integral $1+x\leq 1$ for $x\in [-1,1]$ but $1+x\geq 1$ for $x\in [0,1]$. – Robert Z Aug 16 at 20:22
Hint
In that specific case, you don’t need to change the variables. Just develop $$\cos(x+y)$$ using usual trigonometric formula and use $$e^{y-x}=e^ye^{-x}$$.
You then have to integrate maps with $$x,y$$ as separated variables. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.972830769252026,
"lm_q1q2_score": 0.8229588301405616,
"lm_q2_score": 0.8459424353665381,
"openwebmath_perplexity": 175.34975084852366,
"openwebmath_score": 0.9646354913711548,
"tags": null,
"url": "https://math.stackexchange.com/questions/3324825/how-to-change-the-limits-of-given-integral"
} |
java, queue
Node<T> currentNode = this.head;
this.head = currentNode.previous;
return currentNode.data;
}
public T peek() {
if (this.isEmpty()) {
throw new IllegalStateException("Unable to peek empty queue");
}
return this.head.data;
}
}
while (currentNode.previous != null) {
currentNode = currentNode.previous;
}
currentNode.previous = nodeToInsert;
You can avoid this iteration if you track the location of the tail element.
tail.previous = nodeToInsert;
tail = tail.previous;
Of course, you have to maintain the tail in other places as well.
private Node<T> tail;
public void enqueue(T data) {
Node<T> nodeToInsert = new Node<>(data, null);
if (isEmpty()) {
head = nodeToInsert;
} else {
tail.previous = nodeToInsert;
}
tail = nodeToInsert;
} | {
"domain": "codereview.stackexchange",
"id": 26737,
"lm_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, queue",
"url": null
} |
For more accurate presentation and details, I will recommend Chapter 2, Irreducible polynomials, of the book Polynomials by Victor V. Prasolov. You can find other irreducible criterion there too.
As achille hui points out, by Gauss's "content lemma" irreducibility of the monic integer polynomial $x^{105} - 9$ over the rationals $\mathbb{Q}$ is equivalent to its irreducibility over the integers $\mathbb{Z}$.
A simple condition that often suffices is Eisenstein's criterion:
Suppose we have an integer polynomial $$f(x) \equiv a_n x^n + a_{n-1} x^{n-1} + \ldots + a_0$$ and a prime integer $p$ such that:
• $p$ does not divide $a_n$,
• $p$ does divide each $a_i$ for $i \lt n$, and
• $p^2$ does not divide $a_0$.
Then the polynomial $f(x)$ is irreducible over the integers. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.977022632097108,
"lm_q1q2_score": 0.8183736592927945,
"lm_q2_score": 0.837619961306541,
"openwebmath_perplexity": 131.98689812716714,
"openwebmath_score": 0.9293939471244812,
"tags": null,
"url": "https://math.stackexchange.com/questions/2568627/find-minimal-polynomial-over-mathbbqx"
} |
c#, performance, strings, .net, formatting
startIndex += rowLength;
}
}
}
else
multiLine.Append(line.Substring(0, line.Length) + Environment.NewLine);
} | {
"domain": "codereview.stackexchange",
"id": 18229,
"lm_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#, performance, strings, .net, formatting",
"url": null
} |
stabilizer-code, stim, surface-code
Instead of thinking of a Bernoulli distribution as returning 1 with probability $a$, think of it as returning 0 with probability $a^\prime = 1-2a = \overline{2a}$ and returning a 50/50 random result with probability $2a = 1 - a^\prime = \overline{a^\prime}$. This works as long as $a < 50\%$. The benefit of this switch in perspective is that now, when you xor Bernoulli distributions together, the result is random if any one of them triggered their random case and otherwise it is 0. So you can derive that $p^\prime = (a^\prime)^4$. Meaning $\overline{2p} = \overline{2a}^4$ and so $\overline{2p}^{1/4} = \overline{2a}$ giving $a = (1 - (1 - 2p)^{1/4})/2$.
In general, to convert from a repeated-$k$-times Bernoulli into repeated-$m$-times Bernoulli, while preserving the probability-of-xor-being-1, you do
$$p_m = (1 - (1 - 2p_k)^{k/m})/2$$
Note that, if $k \cdot p_k = m \cdot p_m$ is small, this is well approximated by
$$p_m \approx p_k \cdot k/m$$ | {
"domain": "quantumcomputing.stackexchange",
"id": 4810,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "stabilizer-code, stim, surface-code",
"url": null
} |
fluid-dynamics, vectors, aerodynamics
Title: Which of the following shows correct triangle law of vector addition? This here shows an aerofoil of an axial flow compressor with velocities $V_a$ = air velocity and $V_e$ = velocity of blade.The resultant or relative velocity with which air strikes the aerofoil is $V_r$ . As per what I have learned Fig (ii) is the correct option.
but some texts show these. | {
"domain": "physics.stackexchange",
"id": 66673,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fluid-dynamics, vectors, aerodynamics",
"url": null
} |
noise, digital-communications, information-theory
\end{align}
Now
$$\lim_{x\to0}(1+x)^{1/x}=e$$
So now it becomes
$$C_∞=\lim_{B\to\infty} C=\frac{S}{N_0}\log_2e=1.44\frac{S}{N_0}$$
so here channel capacity does not become infinite; that means, it's bounded.
But what happens if we increase the signal to noise ratio without bound? Will that give unbounded capacity? Is it possible?
After searching I got this but don't know how is this is possible; can some one justify this? There's a problem in the derivation for $C_\infty$. | {
"domain": "dsp.stackexchange",
"id": 5640,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "noise, digital-communications, information-theory",
"url": null
} |
You would get 161,051 which is equal to 11^5 8 hours ago | No yet... So you would get 161,051 which is 11 to the power of 4 ( 14641 ) points using! Account I have read and agree to InterviewBit ’ s Terms and Privacy Policy: 1 1... Over, so you would get 161,051 which is 11 to the array... 14641 ) expression ( 1 + x ) n.Complicated stuff, right have to carry over, so would! 1653 he wrote the Treatise on the Arithmetical triangle which today is known as the Pascal 's triangle with successive! The nth row of Pascal ’ s Terms and Privacy Policy java 100 % n! Eight rows of Pascal ’ s triangle not need to calculate all the rows and use... 3 return: [ 1,3,3,1 ] NOTE: Could you optimize your algorithm to only... Would get 161,051 which is 11 to the row [ 1, 5, and the first eight rows Pascal! Value n as Input and prints first n lines of the Pascal triangle per the number each... Sum of the ways this can be done: binomial Theorem each row is name. Each row is required to return the numbers in | {
"domain": "onepany.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9805806546550656,
"lm_q1q2_score": 0.8016977216331255,
"lm_q2_score": 0.8175744828610095,
"openwebmath_perplexity": 737.2924914774785,
"openwebmath_score": 0.6564574837684631,
"tags": null,
"url": "http://onepany.com/set-wiki-hstjwjt/0eb2d0-kth-row-of-pascal%27s-triangle"
} |
organic-chemistry, stereochemistry, molecular-structure, chirality, symmetry
Both molecules that you show here are chiral, as you correctly pointed out.
2-bromobutan-2-ol belongs to point group C1 as it has no symmetry other than the identity (which is the C1 axis that every molecule has and that corresponds to a rotation by 360° that of course brings the molecule back to the same initial position). Being the C1 axis the only element, C1 molecules are defined asymmetric.
The other two chiral point groups (Cn and Dn) are dissymmetric.
trans-1,2-dimethylcyclobutane has a C2 axis that allows you to rotate the molecule by 180° (which is 360°/2, that's why it corresponds to a 2-fold rotation axis) obtaining a situation that is equivalent to the initial one: | {
"domain": "chemistry.stackexchange",
"id": 15839,
"lm_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, stereochemistry, molecular-structure, chirality, symmetry",
"url": null
} |
cc.complexity-theory, graph-algorithms, complexity-classes, descriptive-complexity, finite-model-theory
every $\#\mathsf{NC}^1$-circuit can be interpreted as
counting the number of proof-trees of a $\mathsf{NC}^1$-circuit.
Thus the corresponding circuit outputs $1$ iff
the input structure satisfies the $\mathsf{MSO}$ formula.
From the above it seems that log-space is at least in logspace-uniform $\mathsf{NC}^1$ In fact, the circuit depends on the input structure, not only on the input structure size. We take a tree-decomposition of the graph with additional colours and turn it into a convolution tree. The evaluation of the formula on this tree is reduced to computing the value of the convolution tree. To compute the value of the tree, it is turned into an arithmetic circuit. Hence we do not get one circuit for each input size as required for $NC^1$, but rather one circuit for each single input. | {
"domain": "cstheory.stackexchange",
"id": 2314,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "cc.complexity-theory, graph-algorithms, complexity-classes, descriptive-complexity, finite-model-theory",
"url": null
} |
machine-learning, python, perceptron
I have some working code for a multi-class perceptron
First let's generate some artificial data with 2 features. Each distribution of points is going to be Gaussian with a given mean and variance described as a list of lists for each dimension under the variable params.
def gen_data(params, n):
dims = len(params[0])
num_classes = len(params)
x = np.zeros((n*num_classes, dims))
y = np.zeros((n*num_classes,))
for ix, i in enumerate(range(num_classes)):
inst = np.random.randn(n, dims)
for dim in range(dims): x[ix*n:(ix+1)*n,dim] = np.random.normal(params[ix][dim][0],
params[ix][dim][1], n)
y[ix*n:(ix+1)*n] = ix
return x, y
params = [[[ 5,1], [ 5,1]],
[[ 0,1], [ 0,1]],
[[2, 1], [ 2,1]],
[[-2, 1], [ 2,1]]]
n = 300
x, y = gen_data(params, 300)
plt.scatter(x[:,0], x[:,1])
plt.show() | {
"domain": "datascience.stackexchange",
"id": 3167,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "machine-learning, python, perceptron",
"url": null
} |
energy-conservation, mass-energy, antimatter
used to block off an outisde and an inside when it moves if, there becomes more new outside between where it used to be and where it is now than old inside that was destroyed.
Specifically, imagine a shell of surface area $5m^2$ with some matter on it that then compresses to a smaller more compact shell of surface area of $4m^2$ with the same matter on it. There used to be a certain volume between the two surfaces when the matter was on the surface of area $5m^2.$
And then latter when the same matter is on the surface of surface area of $4m^2$ the curvature between the two surfaces is different and now has more volume between the surfaces.
So yes, the infalling matter has more energy now, but there is also more space. And to things far away (outside that surface of area $5m^2$) everything looks the same, since matter moving faster (more energy) connects up to the same type of curvature when it is on a more compact surface. | {
"domain": "physics.stackexchange",
"id": 23788,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "energy-conservation, mass-energy, antimatter",
"url": null
} |
javascript, react.js
class TogglePanel extends React.Component {
render() {
return(
<div className="panel panel-default">
<div className="panel-heading">
<h2 className="customerName panel-title">
<TogglePill onClick={this.toggleBody.bind(this)} ref="bodyToggle"/>
{this.props.title}
</h2>
</div>
<div className="panel-body" ref="panelBody" style={{display: "none"}}>
{this.props.children}
</div>
</div>
);
}
toggleBody() {
let body = this.refs.panelBody
let toggle = this.refs.bodyToggle | {
"domain": "codereview.stackexchange",
"id": 19198,
"lm_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, react.js",
"url": null
} |
python, design-patterns
class BaseSource(object):
def __init__(self, db, args):
self.args = args
self.db = db
def alerts(self):
raise NotImplementedError
def _data(self, mapping, source):
"""
This method do the parsing based on data source.
"""
for entry in self._raw_data():
yield converter(source, mapping, entry)
class NagiosSource(BaseSource):
def __init__(self, *args, **kwargs):
...
super().__init__(*args, **kwargs)
def _raw_data(self):
"""
The logic to get the data from Nagios.
"""
def alerts(self):
mapping = mappings.nagios
return self._data(mapping, "nagios")
class ZabbixSource(BaseSource):
def __init__(self, *args, **kwargs):
...
super().__init__(*args, **kwargs)
def _raw_data(self):
"""
The logic to get the data from Zabbix.
""" | {
"domain": "codereview.stackexchange",
"id": 39091,
"lm_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, design-patterns",
"url": null
} |
matrix, common-lisp
//;;MakeFirstTransp make a first transpositiion like '(1 2 3 ... )
//;;which has number of element equal matrix degree:
(defun MakeFirstTransp (matrixDegree transp)
(if (= matrixDegree 0) transp
(MakeFirstTransp (- matrixDegree 1) (cons matrixDegree transp))
)
)
//;;Transpositions make all transpositions of matrix using MakeTranspositions:
(defun Transpositions (matrixDegree)
(MakeTranspositions (MakeFirstTransp matrixDegree nil) 1 matrixDegree)
)
//;;GetCol return elemnt number col in row (row belong to matrix):
(defun GetCol (col rowVector)
(if (= col 1) (car rowVector)
(GetCol (- col 1) (cdr rowVector))
)
)
//;;GetElem return element a[row][col] which belong to matrix:
(defun GetElem (row col matrix)
(if (= row 1) (GetCol col (car matrix))
(GetElem (- row 1) col (cdr matrix))
)
) | {
"domain": "codereview.stackexchange",
"id": 45136,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "matrix, common-lisp",
"url": null
} |
black-hole, galaxy, milky-way, radio-astronomy
centre of CO–0.40–0.22. This point-like continuum source (CO–0.40–0.22*) has a wide-band spectrum consistent with 1/500 of the Galactic SMBH (Sgr A*) in luminosity. Numerical simulations around a point-like massive object reproduce the kinematics of dense molecular gas well, which suggests that CO–0.40–0.22* is one of the most promising candidates for an intermediate-mass black hole. An earlier paper on the object (Oka et al. (2015)) explains that CO-0.40-0.22 is a "high-velocity compact cloud". The first discovery of such an object was two decades ago (Oka et al. (1998)), when CO 0.02-0.02 was found. The naming convention used for that object was
"CO" + Galactic longitude + Galactic latitude | {
"domain": "astronomy.stackexchange",
"id": 2458,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "black-hole, galaxy, milky-way, radio-astronomy",
"url": null
} |
c++, c++11, event-handling
// Needs to be called once for dispatching to start
// It is possible to register callbacks and post events before this function has been called
void start()
{
std::unique_lock<std::mutex> lock(mutex_);
running_ = true;
thread_ = make_unique<std::thread>(&dispatcher<BaseEvent>::worker, this);
// do not return until thread is ready for processing events
condition_.wait(lock, [this]() { return !ready_; });
}
// Stops processing of events and joins dispatching thread
// Depending on timing, events already queued may still be executed. The queue is not cleared
// after stopping, so it is possible to use stop()/start() sequences to pause execution
// After stop() returns it is ensured that no callbacks will be executed
void stop()
{
{
std::unique_lock<std::mutex> lock(mutex_);
running_ = false;
}
condition_.notify_one();
thread_->join();
}
using callback_t = std::function<void(BaseEvent const &)>; | {
"domain": "codereview.stackexchange",
"id": 19160,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, c++11, event-handling",
"url": null
} |
We can say more from this: $a^x=\log_a x\implies a^{a^x}=x$ but also $x=a^x$ hence $a^{a^x}=\log_a x\implies a^{a^{a^x}}$ and so on.
Hence we are searching for $a,x$ such that the sequence $x,a^x,a^{a^x},\cdots$ is a constant, $a\in\Bbb R^+\setminus\{1\},x\in \Bbb R^+$.
As it is shown here we have that $e^{-e} \leq a \leq e^{\frac{1}{e}}$ for $a^{a^{.^{.^{.}}}}$ to converge, hence, by taking the sequence and taking the $1/x$ power of it we get $x^{\frac1x}\in[e^{-e},e^{\frac1e}]$, by guessing $e$ we can find that $x=e,a=e^{\frac1e}$ works. But $x=e$ is not the only $x$ that works. Take any $x$ such that $x^{\frac1x}\in[e^{-e},e^{\frac1e}]$ it can be shown that $x,a=x^{\frac1x}$ are tuple that answer the condition of the post.
Edit, I realized that I made a mistake.
[$(a^{a^{...^x}})^{1/x}=(a^{a^{...^x}/x})\ne (a^{a^{...}})$, although it is interesting to see that if you continue with the logic of the mistake and find the $x$s where the 2 function "kiss" you get correct answer] | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9748211575679041,
"lm_q1q2_score": 0.8305016166079678,
"lm_q2_score": 0.8519528019683106,
"openwebmath_perplexity": 162.8139081100835,
"openwebmath_score": 0.7699070572853088,
"tags": null,
"url": "https://math.stackexchange.com/questions/2861455/for-what-a-would-the-graphs-of-y-ax-and-y-log-a-x-be-tangent"
} |
general-relativity, cosmology, spacetime, differential-geometry, metric-tensor
And so there is another interesting model for a general relativity with space and time on different footing, this one with a view toward quantum gravity: Hořava–Lifshitz gravity. This model is written in terms of spatial metric, lapse function and shift vector of the ADM formalism. However, instead of starting with Einstein-Hilbert action, the model achieves power-counting renormalizability by using different scaling for space and time. The resulting theory is explained in original paper: | {
"domain": "physics.stackexchange",
"id": 48032,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "general-relativity, cosmology, spacetime, differential-geometry, metric-tensor",
"url": null
} |
ros, navigation, odometry, encoders, robot-pose-ekf
Another way is to publish encoder ticks only if there is a change in the encoder position then deltas are never zero, right?
No, you will have same problem! The best you can do un order to be sure about results is to run your code and drive your robot at minimal speed. If detected speeds are constant all is fine. If output is not stable... you have to think about possible fixes.
Originally posted by afranceson with karma: 497 on 2015-04-20
This answer was ACCEPTED on the original site
Post score: 1
Original comments
Comment by Naman on 2015-04-20:
Thanks @afranceson! Another way is to publish encoder ticks only if there is a change in the encoder position then deltas are never zero, right? Also, How can I use incremental encoders to get the number of pulses in a given time instead of a number or counter? | {
"domain": "robotics.stackexchange",
"id": 21467,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, navigation, odometry, encoders, robot-pose-ekf",
"url": null
} |
vba, excel
'
Columns("A:A").ColumnWidth = 7
Columns("B:B").ColumnWidth = 6
Columns("C:C").ColumnWidth = 17.14
Columns("D:D").ColumnWidth = 13.57
Columns("E:E").ColumnWidth = 2.71
Columns("F:F").ColumnWidth = 21.43
Columns("G:G").ColumnWidth = 16.43
Columns("H:H").ColumnWidth = 7.86
Columns("I:I").ColumnWidth = 13.43
Columns("J:J").ColumnWidth = 25.14
Columns("K:K").ColumnWidth = 39.29
Columns("L:L").ColumnWidth = 34.14
Columns("M:M").ColumnWidth = 23.14
Columns("N:N").ColumnWidth = 5.57
Columns("O:O").ColumnWidth = 17.14
Columns("P:P").ColumnWidth = 17.14
Columns("Q:Q").ColumnWidth = 8.14
Columns("R:R").ColumnWidth = 17.71
Columns("S:S").ColumnWidth = 22.57
Columns("T:T").ColumnWidth = 20.43
Columns("U:U").ColumnWidth = 15.57
Columns("V:V").ColumnWidth = 13.43
Columns("W:W").ColumnWidth = 13.43
Columns("X:X").ColumnWidth = 10.86
Columns("Y:Y").ColumnWidth = 8.57 | {
"domain": "codereview.stackexchange",
"id": 17383,
"lm_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
} |
c++, c++11, datetime, regex
// main class which would fetech/parse the current time and provide to the client
class CurrentDateTime
{
public:
CurrentDateTime();
~CurrentDateTime() = default;
int GetDay() const { return dt.day; }
int GetMonth() const { return dt.month; }
int GetYear() const { return dt.year; }
int GetHour() const { return dt.hour; }
int GetMin() const { return dt.min; }
int GetSecond() const { return dt.second; }
std::string GetDayStr() const { return dt.daystr; }
private:
DayTime<std::string> ParseDateTime(const std::string&);
void StrToNumber(const DayTime<std::string>&);
int GetMonth(const std::string&);
DayTime<int> dt;
}; | {
"domain": "codereview.stackexchange",
"id": 10420,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, c++11, datetime, regex",
"url": null
} |
lambda-calculus, term-rewriting-systems, lisp
Of course the usual $\lambda$ calculus can be directly written in these systems. For example the $\beta$ rule:
$$\mathrm{app}(\mathrm{abs}(x.y(x)),z)\rightarrow y(z) $$
A pretty decent overview of the definitions and basic results is given by Nipkow and Prehofer here. | {
"domain": "cstheory.stackexchange",
"id": 4324,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "lambda-calculus, term-rewriting-systems, lisp",
"url": null
} |
c#, algorithm
items.Add(new SelectListItem() { Text = "2", Value = "2" });
items.Add(new SelectListItem() { Text = "3", Value = "3" });
items.Add(new SelectListItem() { Text = "4", Value = "4" });
items.Add(new SelectListItem() { Text = "5", Value = "5" });
items.Add(new SelectListItem() { Text = "6", Value = "6" }); | {
"domain": "codereview.stackexchange",
"id": 12833,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, algorithm",
"url": null
} |
python, linux
def _setup_logger() -> None:
"""Set up the logger.
When the log level is below WARNING (i.e. INFO or DEBUG), the line number of the logging statement is printed as
well.
"""
try:
level_name: str = environ["LOGLEVEL"]
except KeyError:
level_name = "WARNING"
level: int = logging.getLevelName(level_name.upper())
if level < logging.WARNING:
logging.basicConfig(format="%(levelname)s:%(lineno)d: %(message)s", level=level)
else:
logging.basicConfig(format="%(levelname)s: %(message)s", level=level)
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
sys.exit(EXIT_INTERRUPT)
def _show_version() -> None:
"""Print version information to STDOUT.
The value of `VERSION` is set during compile time by the PKGBUILD using `build()`.
"""
print(f"pacdef, version: {version('pacdef')}")
class Pacdef:
"""Class representing the main routines of pacdef.""" | {
"domain": "codereview.stackexchange",
"id": 43854,
"lm_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, linux",
"url": null
} |
• What if $N=2^i$? – Steve Kass Jul 17 '18 at 18:48
• @Sasha Kozachinskiy Consider a case with 4 stones. If Alice picks 3 stones, bob picks the last one and wins. If she takes 2 stones, Bob picks the last 2 and wins. If she takes a single stone, Bob takes the 2nd one, forcing her to take the 3rd stone, which again leaves Bob as the victor, taking the 4th stone. – Praneet Srivastava Jul 17 '18 at 18:50
• @Sasha Kozachinskiy: Thank you. The strategy is well explained. But I couldn´t quite follow your proof by induction. Could you explain it in (some) more detail please? – RandyR Jul 17 '18 at 23:22
• @RandyR, rewrote the answer to avoid induction. – Sasha Kozachinskiy Jul 18 '18 at 7:46
• @Sasha Kozachinskiy: Thank you so much for taking the extra trouble. I would never have been able to formulate this in such a clear manner! – RandyR Jul 18 '18 at 8:22 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9790357542883923,
"lm_q1q2_score": 0.8071776976380913,
"lm_q2_score": 0.8244619199068831,
"openwebmath_perplexity": 323.3628409450104,
"openwebmath_score": 0.8843736052513123,
"tags": null,
"url": "https://math.stackexchange.com/questions/2854780/alice-and-bob-picking-game"
} |
quantum-mechanics, electrons, atomic-physics, coulombs-law, binding-energy
Title: Why electrons in orbitals have negative energy? The potential energy of electron is negative so;
kinetic $+$ potential $= \ \ -$energy ;
but the kinetic energy gets lower as an electron is farther from nucleus; needs less acceleration to orbit
I understand that you need energy to get the electron out of the orbit ;(the kinetic energy keeps it from going towards the proton)
But it was derived from :
Total Energy $=$ kinetic energy $+$ potential energy
How people understood that before the negative conventions? i.e ; how did they think about energy levels , intuitively? When an electron returns to a smaller distance from the nucleus, it emits electromagnetic radiation. It loses energy, so its energy content is lower than in the free state. To gain that, (EM) energy must be absorbed by the electron. So the electron in the free state has a higher energy content than in the bound state. | {
"domain": "physics.stackexchange",
"id": 86397,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, electrons, atomic-physics, coulombs-law, binding-energy",
"url": null
} |
operating-systems
but I cannot clearly understand the difference between Buffering and Spooling.
Can anyone explain the difference between them in simple and easily understandable terms.
Also in couple of the links mentioned above, it is written as :
The main difference between buffering and spooling is that the latter allows the I/O of one job to overlap the computation of another. Buffering only allows the I/O of a job to overlap with its own computation. | {
"domain": "cs.stackexchange",
"id": 4654,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "operating-systems",
"url": null
} |
computability, reductions, undecidability, halting-problem, semi-decidability
Extra question: Would the other way around be possible? H reduced to L?
I think yes. Well both undecidable, compatible, this part is clear to me. But now we are reducing a semi-decidable language to a non semi-decidable language,which should be "harder". In theory in the lecture when A<B, what we learned is that on the left side of the reduction (A) is max as "hard" as the right side of the reduction (B).
--Edit--
Specified in the title many-one Reduction. As Nathaniel pointed out, there are 2 types of reduction (which I wasn´t aware of) and what I needed in this question was the many-one Reduction. It depends on the reduction. | {
"domain": "cs.stackexchange",
"id": 21660,
"lm_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, reductions, undecidability, halting-problem, semi-decidability",
"url": null
} |
species-identification, herpetology, snake
Title: Help identifying snake? (Southern California) I just got home after a brief, surprise thunderstorm ... to find a pretty good size snake lounging in the breezeway at the garage side door. (Presumably, it was seeking shelter from the rain?)
Could anyone please identify this type of snake?
Is it poisonous?
And in any case, is it likely to bite if it felt disturbed or provoked?
Thank you very much in advance!
Diameter: ~~4cm (~~1.5")
Length: ~~1m (~2-3'+) [though hard to say, since it's only been seen curled up]
Location: Southern California, mountainous desert region (~3K' altitude) | {
"domain": "biology.stackexchange",
"id": 11443,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "species-identification, herpetology, snake",
"url": null
} |
quantum-field-theory, symmetry-breaking, effective-field-theory
The theory of a Goldstino (a supersymmetric companion of a Goldstone boson) which arises when you break $\mathcal{N}=1$ SUSY spontaneously. The EFT of a consistent interacting Goldstino $\psi$ starts with operators of dimension-8 (dim-6 operators are forbidden by the non-linear realization of supersymmetry)
$$
\mathcal{L} = i\bar{\psi}\gamma^\mu \partial_\mu \psi + (\bar\psi\gamma^\mu\partial_\mu\psi)^2 + ...
$$ | {
"domain": "physics.stackexchange",
"id": 50842,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-field-theory, symmetry-breaking, effective-field-theory",
"url": null
} |
• "...larger than $\delta$ infinitely often" is another way to put it. Dec 11 '15 at 12:59
There is a general rule of predicate logic called the negation law, which says that when you take the negation ("antithesis") of a universal statement, this is logically equivalent to an existential statement of the negation of the condition. In logical symbols, for any statement $P(x)$ about a quantifier $x$ the negation law says:
$$\sim (\forall x) \text{ } P(x) \equiv (\exists x) \sim P(x).$$
The negation of the condition for convergence in probability is:
$$\sim (\forall \epsilon > 0) \text{ } \lim \limits_{n \rightarrow \infty} \mathbb{P}(|X_n - X| > \epsilon) = 0.$$
Applying the negation law, this is logically equivalent to:
$$(\exists \epsilon > 0) \text{ } \lim \limits_{n \rightarrow \infty} \mathbb{P}(|X_n - X| > \epsilon) \neq 0.$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9780517424466174,
"lm_q1q2_score": 0.8085669044283578,
"lm_q2_score": 0.826711787666479,
"openwebmath_perplexity": 125.10265768923836,
"openwebmath_score": 0.9599637985229492,
"tags": null,
"url": "https://stats.stackexchange.com/questions/186237/what-is-the-antithesis-of-converges-in-probability"
} |
symmetry, topological-phase
My main concern is how to compute this deformation for a specific Hamiltonian, say $H$, with open or periodic boundary conditions. For the SPT phases specifically, this deformation should preserve symmetry constraints, so in principle, my question should boil down to finding an operator $U$ which satisfies $H' = U^{-1} H U$, where $H'$ is the Hamiltonian describing the deformed system. What are the different possibilities to write $U$? Would the exponential of a generator of the symmetry be an option? Answers with an example Hamiltonian are very appreciated. One simple way to deform an SPT Hamiltonian without breaking the symmetry is to add terms which respect the symmetry. For example, the 1D ZXZ cluster state is an SPT phase with Hamiltonian
$$H_0=-\sum_i Z_iX_{i+1}Z_{i+2}.$$ | {
"domain": "physics.stackexchange",
"id": 86576,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "symmetry, topological-phase",
"url": null
} |
homework-and-exercises, newtonian-mechanics, projectile, drag
$$ m \frac{d^2}{d^2 t} \left(
\begin{array}{}
x\\
y\\
\end{array}
\right) =
m \left(
\begin{array}{}
\phantom{-}0\\
-g\\
\end{array}
\right) -
k \sqrt{u_x^2 + u_y^2} \left(
\begin{array}{}
u_x\\
u_y\\
\end{array}
\right),$$
$$ \frac{m}{\Delta t ^2} \left(
\begin{array}{}
x(t+ \Delta t) - 2 x(t) + x(t-\Delta t) \\
y(t+ \Delta t) - 2 y(t) + y(t- \Delta t) \\
\end{array}
\right) \approx
m \left(
\begin{array}{}
\phantom{-}0\\
-g\\
\end{array}
\right) -
k \sqrt{u_x(t)^2 + u_y(t)^2} \left(
\begin{array}{}
u_x(t)\\
u_y(t)\\
\end{array}
\right).$$
Rearrange the formula for $x(t + \Delta t)$ and $y(t + \Delta t)$ to obtain an approximation for the current position. In this case you will have to store two arrays for two different time steps (e.g. $x(t)$ and $x(t - \Delta t)$) in order to update the third one ($x(t + \Delta t)$, it can be stored in $x(t - \Delta t)$ and you can swap pointers then) as well as arrays for the velocities. So for a 2D case 6 different arrays. | {
"domain": "physics.stackexchange",
"id": 62318,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises, newtonian-mechanics, projectile, drag",
"url": null
} |
ros2, ros-crystal
Title: Ros2 install / Unable to locate package
Hi together,
I have some trouble installing ROS2 on Lubuntu 18.04 on a Asus Think Board.
I tried the installation manual at https://index.ros.org/doc/ros2/Installation/Crystal/Linux-Install-Debians/ for crystal and also for dashing. Both of them don't work for me and I get
E: Unable to locate package ros-crystal-ros-base
Here is my Terminal in-&output:
tinker@ELAR-Systems:~$ sudo locale-gen en_US en_US.UTF-8
[sudo] password for tinker:
tSorry, try again.
[sudo] password for tinker:
Generating locales (this might take a while)...
en_US.ISO-8859-1... done
en_US.UTF-8... done
Generation complete. | {
"domain": "robotics.stackexchange",
"id": 33452,
"lm_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, ros-crystal",
"url": null
} |
c#, validation, asp.net-mvc, exception
private IActionResult HandleResult(IResult result)
{
if (result.IsSuccessful)
{
return new OkResult();
}
if (result.BrokenRules?.Any() == true)
{
return new BadRequestObjectResult(new {result.BrokenRules});
}
if (result.HasConcurrencyError)
{
return new BadRequestObjectResult(new {Message = CommonResource.Error_Concurrency});
}
if (result.HasNoPermissionError)
{
return new UnauthorizedResult();
}
if (result.HasNoDataFoundError)
{
return new NotFoundResult();
}
if (!string.IsNullOrEmpty(result.ErrorMessage))
{
return new BadRequestObjectResult(new {Message = result.ErrorMessage});
}
return new BadRequestObjectResult(new {Message = CommonResource.Error_Generic});
}
} | {
"domain": "codereview.stackexchange",
"id": 28842,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, validation, asp.net-mvc, exception",
"url": null
} |
entanglement, mathematics
A valid $|\Omega⟩$ would be $\frac{1}{\sqrt 2}(|0_Q+_H⟩+|1_Q−_H⟩)$. Another valid $|\Omega⟩$ would be $\frac{1}{\sqrt 2}(|0_Q0_H⟩+|1_Q2_H⟩)$. Both the $|\Omega⟩$'s are perfectly good examples of maximally mixed states! I'm not sure "how do I know how to choose the kets?" is the right question.
You're right that any maximally entangled state can be constructed by applied local unitaries on some (non-unique) $|\Omega⟩$. "Ill-defined" is not the right term here; it's just "non-uniquely defined". The point is that any maximally entangled state is of the form $(I\otimes U)|\Omega⟩$ and can be expressed as some (constrained) combination of (non-unique) basis states of some (non-unique) subspace $\Bbb C^d\otimes \Bbb C^d$ of $H_A\otimes H_B$.
Perhaps you were confused because you were thinking $|\Omega\rangle$ is some unique state. That's certainly not the case! The description of $|\Omega⟩$ simply provides the mathematical structure that we expect of a legitimate maximally entangled state. | {
"domain": "quantumcomputing.stackexchange",
"id": 1163,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "entanglement, mathematics",
"url": null
} |
condensed-matter, symmetry, topological-order, topological-phase
Sorry if my question seems a bit vague, I lack understanding on the topic and would very much appreciate a general awnser. I think the first helpful fact to clarify is that there are two different kinds of topological phases: there are so-called Symmetry Protected Topological (SPT) Phases (displaying 'symmetry protected topological order') and there are (intrinsic) Topological Phases (displaying '(intrinsic) topological order'). As some quick examples: topological insulators and topological superconductors are example of the former, whereas the quantum Hall states and various spin liquids are examples of the latter. | {
"domain": "physics.stackexchange",
"id": 30144,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "condensed-matter, symmetry, topological-order, topological-phase",
"url": null
} |
java, optimization, primes
Title: Sum of the digits is prime or not Puzzle Description:
A number is called lucky if the sum of its digits, as well as the sum
of the squares of its digits is a prime number. How many numbers
between A and B are lucky?
How can I improve performance of the following code?
import java.util.Scanner;
public class lucky_num {
public static void main(String[] args) {
lucky_num sr = new lucky_num();
Scanner scanner = new Scanner(System.in);
int no_cases = scanner.nextInt();
for (int i = 0; i < no_cases; i++) {
System.out.println(sr.solve(scanner.nextLong(), scanner.nextLong()));
}
}
private int solve(long l, long m) {
int count = 0;
for (long i = l; i <= m; i++) {
if (logic(i)) {
count++;
}
}
return count;
}
private boolean logic(long i) {
return (isSUM(i) && isSUMsq(i));
} | {
"domain": "codereview.stackexchange",
"id": 6895,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, optimization, primes",
"url": null
} |
electromagnetic-radiation, electromagnetic-induction
This field then cuts a conducting circular loop normally. The loop has two protruding wires. Will the protruding wires emit EM waves? I figured that the changing magnetic field will induce an emf in the loop and hence, current. However, will the wires emit EM waves? If so, will the EM waves have a specific emission frequency? So, there is a current in the open loop and from that you may be very tempted to say that there is necessarily an alternating voltage, which would give you AC currents into the protruding wires. However these last two ideas are not correct. | {
"domain": "physics.stackexchange",
"id": 28211,
"lm_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, electromagnetic-induction",
"url": null
} |
neural-networks, backpropagation, feedforward-neural-networks
Syntax
$A^{[k]}$ - this means we are indexing by layer (eg $\alpha^{[k]}$ is the activation for k-th layer)
$m$ - is the number of examples in the batch
$n_k$ - denotes the number of neurons in the k-th layer
$L$ - the number of layers (so $n_L$ is the number of neurons in last layer)
$\Theta$ - The set of all weights (notice no superscript)
Backprop
In the case of neural networks the cost is a scalar function of inputs and parameters. To get backprop started calculate the scalar by matrix derivative of the cost with respect to the activations of the last layer call this matrix $dA^{[L]}$. Observe:
$dA^{[L]} = \frac{\partial J(\Theta,X)}{\partial A^{[L]}}$
Next, we calculate scalar-by-matrix derivative of $Z^{[L]}$. Doing this one realizes:
$dZ^{[L]} = \frac{\partial J(\Theta,X)}{\partial Z^{[L]}} = dA\odot\alpha'^{[L]}(Z^{[L]})$
Where $\odot$ denotes element wise (Hadamard) product.
With the above one can make use of the matrix definitions for back propagation: | {
"domain": "ai.stackexchange",
"id": 3332,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "neural-networks, backpropagation, feedforward-neural-networks",
"url": null
} |
javascript, jquery, html, css
if (prevItem == item) {
if (prev.hasClass('Green'))
SetGroupingDetails(this, item, "#009933", "Green");
else
SetGroupingDetails(this, item, "#cc9900", "Orange");
} else {
if (prev.hasClass('Orange'))
SetGroupingDetails(this, item, "#009933", "Green");
else
SetGroupingDetails(this, item, "#cc9900", "Orange");
}
} else
SetGroupingDetails(this, item, "#009933", "Green");
});
#tblExport body {
font: normal medium/1.4 sans-serif;
}
#tblExport {
border-collapse: collapse;
width: 100%;
}
#tblExport th,
td {
padding: 0.25rem;
text-align: left;
border: 1px solid #ccc;
}
#tblExport th {
background: #bfbfbf;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table id="tblExport">
<thead>
<tr>
<th>
Item No.
</th>
<th>
Item Name
</th>
</tr>
</thead>
<tbody> | {
"domain": "codereview.stackexchange",
"id": 18778,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, jquery, html, css",
"url": null
} |
optics, visible-light, reflection
Title: 2 Mirrors at 90 degrees In such a case (where the observer is directly behind the object) would the observer be able to see the object? I don't see how it is possible to still see the object, given that the light ray would have to be reflected off the crease for this to work.
I am assuming that the ray of light cannot be reflected on the crease. Yes. The observer can see the object in the mirrors on either side of the crease. The crease itself is an infinitely thin line (if the mirrors touch) which will only obscure an object if it is infinitely small.
In the picture below, you can see the reflection of the yellow ball. There is a line down the middle where the crease is, but the ball is still perfectly visible. | {
"domain": "physics.stackexchange",
"id": 91352,
"lm_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, visible-light, reflection",
"url": null
} |
genetics, molecular-biology, rna, splicing
Title: Splicing and “the dominance of RNA-world” This is a paragraph from my textbook.
The significance of such complexities is now beginning to be
understood. The split-gene arrangements represent probably an ancient
feature of the genome. The presence of introns is reminiscent of antiquity,
and the process of splicing represents the dominance of RNA-world. In
recent times, the understanding of RNA and RNA-dependent processes
in the living system have assumed more importance. | {
"domain": "biology.stackexchange",
"id": 7082,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "genetics, molecular-biology, rna, splicing",
"url": null
} |
javascript, d3.js
// introduce the bars
// var plot = d3.select("#svgPlotTOPbarChart")
var sel = plot.selectAll("rect")
.data(TOPbarData);
sel.enter()
.append("rect")
.attr({
x: function(d, i) {
return xScale(d.dt);
},
y: function(d) {
return yScale(d.amount);
},
width: (basics.width / TOPbarData.length - basics.barPaddingFine),
height: function(d) {
return basics.height - yScale(d.amount);
},
fill: colorChosen,
'class': "bar"
}); | {
"domain": "codereview.stackexchange",
"id": 26774,
"lm_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, d3.js",
"url": null
} |
ros
The top line unsubscribes everything and the bottom one makes all new ones. As you can see, each subscription has a callback method of bag. In that method, I was hoping to just be able to write the message to a bag, independent of the topic. I didn't realize until now that rosbag.Bag.write() requires both the message and the topic.
So, what's the easiest way of getting the message publisher's topic type? In addition, is there any easier way of doing what I've described?
Thanks for your help!
-lourd
Originally posted by lourd on ROS Answers with karma: 13 on 2013-08-01
Post score: 1
Original comments
Comment by lindzey on 2013-08-01:
Duplicate of http://answers.ros.org/question/68434/get-topic-name-in-callback/ ??
Make bag take two arguments, the topic name and the message, and then change that code to:
map(lambda x: x.unregister(), SUBSCRIPTIONS)
SUBSCRIPTIONS = map(lambda topic: rospy.Subscriber(topic, AnyMsg, lambda msg: bag(topic, msg)), TOPICS) | {
"domain": "robotics.stackexchange",
"id": 15140,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros",
"url": null
} |
python
Keep separate tasks separate. Your current solutions have two levels of
operation: (1) line processing, where you do some parsing and some top-level
calculations; and (2) game processing, where you again combine parsing with
calculation. It usually results in more flexible, maintainable, and readable
code to separate the tasks in a sharper way. For example: read input; parse input into meaningful data; make calculations; communicate results.
When feasible, make data declarative rather than cryptic. For example, you
parse each pick into a two-element tuple and your code has to make repeated use
of things like pick[0][1]. That demands a lot of mental overload for a reader
of your code (meaning yourself). Much better is to unpack that data into more
readable parts, which can be done with something as simple as n, color = pick.
Modeling the data. This problem seems well suited to a couple of
dataclasses: one to represent a game, and one to represent a draw of cubes. | {
"domain": "codereview.stackexchange",
"id": 45211,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python",
"url": null
} |
from samples. Is the nth-term test not applicable in this case? Can you clarify?. The calculator will generate all the work with detailed explanation. If ($\displaystyle \lim_{n \rightarrow \infty} a_n eq 0$), then the series ($\displaystyle \sum_{n=0}^\infty a_n$) diverges. Equations and terms. Integral Test Let X1 n=1 a nbe a series with positive terms, and let f(x) be the function that results when n is replaced by xin the formula for a n. This leaves us with an expression with nothing in the denominator. DIFFGEOM48 1. On this page, we explain how to use it and how to avoid one of the most common pitfalls associated with this test. Do not sell my info. Nearly every calculus book begins with the same example, and it’s so darn fine that I will bow to peer pressure and use it as well. The key idea is to apply the classical inequality x>=log(1+x) (valid for x>-1) with x=1/k and sum over k, 1<=k<=n-1. What is important to point out is that there is an nth-term test for sequences and an | {
"domain": "schuetzen-wuerm.de",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9845754456551737,
"lm_q1q2_score": 0.8536621196061944,
"lm_q2_score": 0.8670357598021707,
"openwebmath_perplexity": 572.843145363113,
"openwebmath_score": 0.7924398183822632,
"tags": null,
"url": "http://mdnu.schuetzen-wuerm.de/nth-term-test-for-divergence-calculator.html"
} |
python, matrix, graph
Title: Converting a List of arcs into Adjacency list representation for graph using dictionary I was reading up on implementing Graphs in Python and I came across this Essay at python.org about graphs, so I decided to implement it, but with weighted edges.
I start with arcs and their cost using list of lists and then iterate through it building a dictionary (Adjacency list format) that represents the Undirected Weighted Graph. I am looking for suggestions on how to improve the following code. Here I need to check every time if a vertex already exists in the dictionary using an if x in dict.keys() statement, which takes linear time for each node.
data=[['A','B',5],
['A','C',4],
['B','C',2],
['B','D',3],
['C','D',10],
['E','F',1],['F','C',6]]
graph={} | {
"domain": "codereview.stackexchange",
"id": 16366,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, matrix, graph",
"url": null
} |
reinforcement-learning, deep-rl, reward-functions, reward-design, card-games
In theory you could also pre-calculate the immediate reward from placing the card in each position, making that part of the state (another 25 features). That is so the agent is not trying to predict this value - it is hard for the NN, but easy for the game engine and not "cheating" at the game by e.g. peeking at the next card. That should allow the NN to use more of its capacity for planning ahead and statistically gambling on what might be available in future, which is perhaps the more interesting aspect of this game. | {
"domain": "ai.stackexchange",
"id": 3310,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "reinforcement-learning, deep-rl, reward-functions, reward-design, card-games",
"url": null
} |
java
Title: Finding the perfect numbers between 1 - 1000 This code was made to find all the perfect numbers between 1 and 1000. A perfect number, is a number where all of it's divisors add up to that number.
For example:
6 is divisible by 3,2, and 1 and3+2+1 = 6. Therefore 6 is a perfect number.
public class Perfect {
public static void main(String[] args) {
final int LIMIT = 1000;
boolean isPerfect = false;
int i;
for(i = 2; i < LIMIT; i++) {
isPerfect = isNumPerfect(i);
if(isPerfect) {
System.out.println(i + " is a perfect number");
}
}
}
public static boolean isNumPerfect(int i) {
boolean isPerfect = false;
int sum = 1;
int x;
for(x = 2; x <= i / 2; x++) {
if(i % x == 0) {
sum += x;
}
}
if(sum == i) {
isPerfect = true;
}
return isPerfect;
}
} | {
"domain": "codereview.stackexchange",
"id": 17489,
"lm_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
} |
java, tree
It provides a concrete representation what came from the database. It is a datastructure only with no logic. It abstracts from the raw resultset where you access columns via column names or indices.
A RawNode is used as a datastructure to communicate with the database through the DAOs in both ways. A RawNode object is a value object. It has no assertion to consistency. You may check the values for consistency (e.g. Java Validation API) and get a list of constraint violations. But the current state of the object may be inconsistent. OR-Mapper can do validations but as they are not able to enforce business rules I would not rely on this.
Equality of these type of objects should be checked either be on all values or on none.
Node (business object)
Equality of a business object is checked on a global unique id. | {
"domain": "codereview.stackexchange",
"id": 24326,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, tree",
"url": null
} |
electromagnetism, classical-mechanics, atomic-physics, history
Title: After the plum-pudding model failed, why did physicists conclude that electrons were in orbit After the plum-pudding model failed, physicists concluded that atoms had nuclei that were relatively dense and positively charged. But the rejection of the plum-pudding model posed many conceptual challenges for physicists of the early 20th century because it was hard to reconcile alternative models of the atom with classical mechanics and Maxwell's equations.
One challenge was with the configuration of electrons in atoms. If electrons were in orbit around the nucleus, it was logically assumed that electrons must accelerate and Maxwell's equations predict that an accelerating charge releases electromagnetic radiation. This causes the electrons to loose energy and move towards the nucleus. | {
"domain": "physics.stackexchange",
"id": 71550,
"lm_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, classical-mechanics, atomic-physics, history",
"url": null
} |
rosdep, ros-kinetic, bloom-release
Originally posted by tfoote with karma: 58457 on 2019-09-19
This answer was ACCEPTED on the original site
Post score: 1
Original comments
Comment by HLaloge-LC on 2019-09-20:
Thanks, I think I'll go with an underlay. However, my dependency already have release scripts for bloom (https://github.com/orocos-gbp/rtt_ros_integration-release), so i thought it would be easier to use that.
Comment by gvdhoorn on 2019-09-20:
Using the current release repository would be possible too.
It would just mean more manual work.
An underlay would essentially come down to:
create underlay ws
put copy of pkg in underlay ws
(install all dependencies)
build underlay
source underlay
build your regular workspace
done. | {
"domain": "robotics.stackexchange",
"id": 33792,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "rosdep, ros-kinetic, bloom-release",
"url": null
} |
ros, catkin-make, turtlebot, turtlebot-arm
Originally posted by William with karma: 17335 on 2013-09-06
This answer was ACCEPTED on the original site
Post score: 1
Original comments
Comment by cdrwolfe on 2013-09-06:
Thanks this has worked, I also needed to repeat the same process for the package turtlebot_kinect_arm_calibration. I'm not sure if this will have any unknown effects but I guess I will find out :)
Comment by fergs on 2013-09-20:
Note that not all these packages actually work -- I never got around to making calibration or demos work, I only got as far as moveit integration updates, which are now I believe out of date given changes to the kinematics plugin format.
Comment by cdrwolfe on 2013-09-23:
ok, thanks fergs. I've been looking at this and the clam packages just to get a better idea of the pick and place stuff, and different kinds of ros control / communication | {
"domain": "robotics.stackexchange",
"id": 15445,
"lm_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, catkin-make, turtlebot, turtlebot-arm",
"url": null
} |
astronomy
Title: Do all the individual stars that we can see in the night sky belong to Milky Way? I was wondering if all the stars that we can see with the unaided eye as distinct point sources are from our own galaxy?
In other words, can we see stars from the Andromeda Galaxy or other galaxies without telescopes? Yes, everything that appears as a point like star is in the Milky Way. The most nearby stars outside of the Milky Way are in the dwarf galaxies that are Milky Way satellites, such as the Large and Small Magellanic Clouds. These appear as fuzzy little blobs to the naked eye, just as Andromeda does.
The only exception to this that I can think of is when a supernova occurs in a nearby galaxy. The most recent supernova visible to the naked eye was 1987A, which occurred in the Large Magellanic Cloud. Supernovae in Andromeda could also be visible to the naked eye as point sources. | {
"domain": "physics.stackexchange",
"id": 18856,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "astronomy",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.