text stringlengths 1 1.11k | source dict |
|---|---|
quantum-field-theory, special-relativity, spin-statistics, quantum-statistics
Title: Spin statistics
I have a very intrinsic question about quantum field theory and even more general, why in 3+1-dimensional spacetime, we have only two statistics for particles to obey? Therefore why we have only two commutator or anticommutator relationships.
How we can test something like that in other dimensions and extract the relationships for every dimension of spacetime? Expanding @ACuriousMind comment as an answer:
By the Spin-Statistics Theorem the symmetry group of Lorentz-Invariant QFT is the lorentz group $SO^+(1,3)$ of which $SL_2(C)$ is the universal covering group. The irreducible representations of the symmetry group of the theory, are related naturaly to the way the wavefunction changes under exchange of the positions of the particles that make up the state $\psi$ (Statistics).
As such the connection between the symmetry group (and its representations) and the wave-function statistics is made. | {
"domain": "physics.stackexchange",
"id": 17462,
"lm_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, special-relativity, spin-statistics, quantum-statistics",
"url": null
} |
Functions can be accomplished using lin-ear. Step-By-Step this website uses cookies to ensure you get the best experience change of variable least. The difference between the given function and the approximation [ a, b ] can be using! Such as one of the methods for finding such a function solve the least method! Approximation in function spaces such as a least-squares solution ( two ways ) in section 10.7, least-squares! The given function and the approximation approximation accuracy of the RBF are affected by its parameter... Rbf is especially suitable for scattered data approximation and least square approximation of a function dimensional function.. | {
"domain": "ac.th",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9875683498785867,
"lm_q1q2_score": 0.8960328289423238,
"lm_q2_score": 0.9073122169746364,
"openwebmath_perplexity": 896.7067055485361,
"openwebmath_score": 0.710901141166687,
"tags": null,
"url": "http://centrallab.msu.ac.th/2f1iaj16/lhcbx.php?aea000=least-square-approximation-of-a-function"
} |
for $\lvert z\rvert \geqslant 3$, so we need to find the number of zeros of $f(z) = z^4 + 3iz^2 + z - 2 + i$ in the half-disk $D = \{z\in \mathbb{C} : \lvert z\rvert < 3,\, \operatorname{Im} z > 0\}$.
It remains to find a suitable function $g$ such that $\lvert f-g\rvert < \lvert f\rvert + \lvert g\rvert$ on $\partial D$ and the number of zeros of $g$ in $D$ is easy to determine.
On the circle $\lvert z\rvert = 3$, the dominating component of $f$ is the monomial $z^4$, so that needs to be included in $g$. One might be tempted to try $g(z) = z^4$, but that alone doesn't work, since it has a zero (of multiplicity four) on $\partial D$. We need to include some other term to avoid that. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9770226347732858,
"lm_q1q2_score": 0.8077161268983554,
"lm_q2_score": 0.8267117855317474,
"openwebmath_perplexity": 102.38132552812928,
"openwebmath_score": 0.8733842968940735,
"tags": null,
"url": "https://math.stackexchange.com/questions/1570590/determining-the-number-of-zeros-in-the-upper-half-plane"
} |
linear-systems, impulse-response, stability, differential-equation
As an example I'll show how to arrive at the values of $c_1$ and $c_2$ for the causal solution $(3)$. Define $f(t)=c_1e^{-2t}+c_2e^{t/2}$. With $y_c(t)=f(t)u(t)$, the derivatives of $y_c(t)$ are
$$\begin{align}y_c'(t)&=f'(t)u(t)+f(t)\delta(t)=f'(t)u(t)+f(0)\delta(t)\\y_c''(t)&=f''(t)u(t)+f'(t)\delta(t)+f(0)\delta'(t)=f''(t)u(t)+f'(0)\delta(t)+f(0)\delta'(t)\end{align}$$
We need to satisfy the differential equation $y_c''(t)+\frac32 y_c'(t)-y_c(t)=\delta(t)$. Consequently, the term $f(0)\delta'(t)$ must vanish:
$$f(0)=c_1+c_2=0$$
Furthermore, the coefficients associated with the Dirac delta impulses must add up to $1$:
$$f'(0)+\frac32 f(0)=1$$
This results in the requirement $$-2c_1+\frac12 c_2+\frac32 (c_1+c_2)=1$$
which leads to $c_1=-\frac25$ and $c_2=\frac25$.
In exactly the same way you can derive the coefficients of the stable solution $(4)$, which results in $c_1=c_2=-\frac25$. | {
"domain": "dsp.stackexchange",
"id": 9489,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "linear-systems, impulse-response, stability, differential-equation",
"url": null
} |
economic-geology, stratigraphy, petroleum, carbon
A team of geologists working for the Australian Government's Bureau of Mineral Resources reports in the journal Nature that it has discovered oil formed from the decayed remains of organisms that lived 1.4 billion years ago, when the earth was young. After the group drilled a 1,100-foot-deep test hole beneath the McArthur Basin in northern Australia, the oldest oil of its kind ever found bubbled to the surface.
Tiny amounts of oil as old as 3.2 billion years have been found more recently. | {
"domain": "earthscience.stackexchange",
"id": 440,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "economic-geology, stratigraphy, petroleum, carbon",
"url": null
} |
beginner, rust
pub struct Request<'a> {
pub start: &'a str,
pub destination: &'a str,
pub time: &'a str,
pub time_kind: &'a str,
}
impl<'a> Request<'a> {
pub fn reserve(&self, timetable: HashMap<Stations, &[&str]>) -> bool {
let st = Stations {
start: self.start,
destination: self.destination,
};
let times = timetable.get(&st);
let default: &[&str] = &[];
let result = match times {
Some(r) => r,
None => default,
};
for t in result {
if *t == self.time {
return true;
}
}
false
} | {
"domain": "codereview.stackexchange",
"id": 35795,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "beginner, rust",
"url": null
} |
python, object-oriented, role-playing-game, adventure-game, battle-simulation
else:
if (tuple[0] in list[access]) and (tuple[1] in list[access]):
(method[access])()
break
elif sentence_type == 'simple':
if tuple[0] == 'player':
if (tuple[1] in list[access]) and (tuple[2] in list[access]):
(method[access])()
break
elif tuple[1] in list[access]:
(method[access])()
break
else:
if (tuple[0] in list[access]) and (tuple[1] in list[access]):
(method)[access]()
break
elif (tuple[1] in list[access]) and (tuple[2] in list[access]): | {
"domain": "codereview.stackexchange",
"id": 36850,
"lm_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, object-oriented, role-playing-game, adventure-game, battle-simulation",
"url": null
} |
ros, navigation, planner
Title: Waypoint Navigation: Simplified Local Planner
Hello,
I was wondering if anyone has written such a behaviour for a robot navigation or any hint on how to implement it.
1- The robot gets the waypoints from the global planner
2- Starting from the first waypoint, the robot rotates towards the next waypoint
3- The Robot moves on a straight line and stops at the next waypoint
4- The robot rotates towards the next waypoint
5- The Robot moves on a straight line and stops at the next waypoint
6- Goto 4
Assuming that there is enough distance between the waypoints.
Thanks
Originally posted by ROSCMBOT on ROS Answers with karma: 651 on 2014-11-05
Post score: 2
Original comments
Comment by Nazeer on 2015-03-03:
Am looking for same as you asked, did you find the answer yet?
Can you let me know if you knew something about it please ?
I have a version of this idea that works, but currently does no collision detection.
https://github.com/DLu/simple_local_planner | {
"domain": "robotics.stackexchange",
"id": 19962,
"lm_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, planner",
"url": null
} |
homework-and-exercises, newtonian-mechanics, waves, newtonian-gravity, string
Title: The 1D wave equation with gravity and the catenary I'm in the middle of writing a PDEs assignment and I thought I'd use the wave equation for a horizontal string with gravity. Easy I thought: $u_{tt} = c^2u_{xx} - g$. We solved it without gravity. Then added gravity: I set up the question on what the steady solution looks like, and I got a parabola.
But wait, I know that it's a catenary, not a parabola. So... confusion ensues.
My mental picture now is that the equation $$u_{tt} = c^2u_{xx} - g$$ is appropriate in the small deflection limit, and the catenary resembles a parabola in that limit. Am I correct on that, and as the deflection gets bigger, what is the (first) correction that comes in? TL;DR The "leading-order" correction to the ODE is
$$\frac{d^2y}{dx^2}=\frac{\mu}{T_0}g(1+2k^2x^2)^3$$ | {
"domain": "physics.stackexchange",
"id": 88781,
"lm_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, waves, newtonian-gravity, string",
"url": null
} |
python, time-series, lstm, forecasting
Title: LSTM future steps prediction with shifted y_train relatively to X_train I'm trying to predict simple one feature time series data with shifted train data. The source looks like this:
DATE PRICE
0 1987-05-20 18.63
1 1987-05-21 18.45
2 1987-05-22 18.55
3 1987-05-25 18.60
4 1987-05-26 18.63 | {
"domain": "datascience.stackexchange",
"id": 6142,
"lm_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, time-series, lstm, forecasting",
"url": null
} |
php
Title: PHP function to create a Hex dump - Follow up This is a followup of this question.
@Corbin made a very interesting review, and I re-wrote most of the code.
function hex_dump( $value )
{
$to_hex = function( $number ){
$hex = strtoupper( dechex( $number ) );
//if we don't check if the number is 0, it won't fill the whole space
return ( $number === 0 || strlen( $hex ) & 1 ? '0' : '' ) . $hex;
};
$lines = array();
$start_time = microtime(true);
switch( gettype( $value ) )
{
case 'string':
foreach( str_split( $value, 16 ) as $k => $line )
{
$lines[$k] = array();
for( $i = 0, $l = strlen($line); $i<$l; $i++)
{
$lines[$k][$i] = $to_hex( ord( $line[$i] ) );
}
}
break; | {
"domain": "codereview.stackexchange",
"id": 17333,
"lm_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",
"url": null
} |
quantum-field-theory, operators, conformal-field-theory, singularities
Alternatively, we can use the fact that we know all the operators in this CFT. So for $\frac{\mathcal{O}_1(w)}{z - w}$ to appear, there must be some dimension 1 combination of fundamental fields such that the three-point function $\left < \partial \phi(z) \partial \phi(w) \mathcal{O}_1(x) \right >$ is non-zero. But Wick contractions make it easy to prove that exponentials like $V_\alpha(x) = e^{i \alpha \phi(x)}$ do not satisfy this condition because no copies of $\partial \phi(x)$ are produced in the OPE $\partial \phi(w) V_\alpha(x)$. The only other dimension 1 operator is $\partial \phi(x)$ itself and $\left < \partial \phi(z) \partial \phi(w) \partial \phi(x) \right > = 0$ by $\mathbb{Z}_2$ symmetry of the action. | {
"domain": "physics.stackexchange",
"id": 85088,
"lm_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, operators, conformal-field-theory, singularities",
"url": null
} |
statics, mathematics, moments
Apparently I have to use $dA=r\ d\theta\ dr$, $y= r\sin(\theta)$ and end up getting $I_x=\frac{r^4}{8}(\alpha-\sin(\alpha))$
But I have no idea how they got that, I have never had this.
Could someone step by step explain how to get to $I_x$ with this question and how to integrate something that has two different differentials. Since you actually asked for the moment about the $x$ axis. Calculating the moment of inertia about the $x$ axis is a fair deal more complicated than calculating it about the $z$ axis as in my other answer. | {
"domain": "engineering.stackexchange",
"id": 785,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "statics, mathematics, moments",
"url": null
} |
ros, navigation, turtlebot, frontier-exploration, dwa-local-planner
<remap from="cmd_vel" to="navigation_velocity_smoother/raw_cmd_vel"/>
<remap from="odom" to="$(arg odom_topic)"/>
<remap from="scan" to="$(arg laser_topic)"/>
</node>
</launch>
local_costmap_params.yaml:
local_costmap:
global_frame: odom
static_map: false
rolling_window: true
width: 4.0
height: 4.0
plugins:
- {name: obstacle_layer, type: "costmap_2d::ObstacleLayer"}
- {name: inflation_layer, type: "costmap_2d::InflationLayer"}
global_costmap_params.yaml:
global_costmap:
global_frame: map
rolling_window: false
track_unknown_space: true
static_map: true
plugins:
- {name: static_layer, type: "costmap_2d::StaticLayer"}
- {name: obstacle_layer, type: "costmap_2d::ObstacleLayer"}
- {name: inflation_layer, type: "costmap_2d::InflationLayer"} | {
"domain": "robotics.stackexchange",
"id": 25002,
"lm_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, turtlebot, frontier-exploration, dwa-local-planner",
"url": null
} |
java, email, gui, javafx
LaySentController.java
package org.tempestdesign.sendclient;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import java.io.IOException;
public class LaySentController extends TransitionController {
@FXML
protected void handleBackButton(ActionEvent e) throws IOException {
tto.setText(mto);
ttext.setText(cTEXT);
tsub.setText(msub);
thead.setText(mhead);
transitionScene("Edit Email", "layedit.fxml", 640, 710);
}
}
laysent.fxml
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Text?>
<?import javafx.scene.control.Button?> | {
"domain": "codereview.stackexchange",
"id": 17766,
"lm_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, email, gui, javafx",
"url": null
} |
docker
Title: How to get an older version of ros::rolling Docker image
Due to nav2 not being quite up-to-date, I can't use nav2 with official ros::rolling docker image. Here's the nav2 issue that has details on that: https://github.com/ros-planning/navigation2/issues/3364
While waiting for the nav2 issues to be fixed, is it possible to get an older version of the ros::rolling docker image?
My Dockerfile starts with this:
FROM ros:rolling # Would like to roll this back one version
@tfoote | {
"domain": "robotics.stackexchange",
"id": 38221,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "docker",
"url": null
} |
quantum-mechanics
My question is: what is the correct method for obtaining the charge density of a many-body wavefunction which has different charge species contained in it? If it were purely a wavefunction of electrons, then you could look at the one-body density matrix which contains all the information you need:
$$n(\mathbf{r}_1) = -Ne\int d\mathbf{r}_2...d\mathbf{r}_k \vert \psi(\mathbf{r}_1,\mathbf{r}_2,...,\mathbf{r}_k)\vert^2$$
But what is the correct procedure for multi-species wavefunctions (i.e. wavefunctions of particles with different charge/quantum numbers)? Naively I would assume the charge density is given by the following equation, but I am not sure if this is rigorously true.
$$\rho(\mathbf{r}) = +e\left(\int d\mathbf{r}_e \vert \psi(\mathbf{r}_p,\mathbf{r}_e)\vert^2\right)\rvert_{\mathbf{r}_p=\mathbf{r}} -e\left(\int d\mathbf{r}_p \vert \psi(\mathbf{r}_p,\mathbf{r}_e)\vert^2\right) \rvert_{\mathbf{r}_e=\mathbf{r}}$$ Your final expression, | {
"domain": "physics.stackexchange",
"id": 49065,
"lm_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",
"url": null
} |
c#, multithreading, api
/// <summary>
/// True is a timeout occurred
/// </summary>
public bool TimoutOccured { get; private set; }
/// <summary>
/// Gets the reply length
/// </summary>
/// <param name="firstPacketData">The first packet's data, for use with variable length responses</param>
/// <returns>Number of packets required for the whole command</returns>
protected abstract int GetReplyPacketLength(byte[] firstPacketData);
#endregion
#region Constructor
protected CommandBase()
{
TimoutOccured = false;
ResponseTimeoutMilliseconds = 500; // default timeout 500ms
}
#endregion
protected async Task<bool> ExecuteCommandBase(CanbusConnection connection, TPCANMsg msg)
{
if(connection == null)
{
throw new ArgumentNullException("connection");
}
if(!connection.IsOpen)
{
throw new ArgumentException("Connection is not open");
} | {
"domain": "codereview.stackexchange",
"id": 35058,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, multithreading, api",
"url": null
} |
javascript, iterator, ecmascript-6, generator
function ord(a, b, c) {
return sign(a - b) == sign(b - c);
}
function* range(start, end, step) {
if (end === undefined) {
[start, end, step] = [0, start, sign(start)];
} else if (step === undefined) {
step = sign(end - start) || 1;
} else if (sign(end - start) != sign(step)) {
return;
}
if (start === end) return;
var i = 0, result;
do {
result = start + i*step;
yield result;
++i;
} while (ord(start, start + i*step, end));
}
See above for comments. | {
"domain": "codereview.stackexchange",
"id": 20644,
"lm_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, iterator, ecmascript-6, generator",
"url": null
} |
electrochemistry, kinetics, reaction-order
Title: Why is concentration never zero for zero order reactions? By formula of zero order reaction:-
$$C_t=C_o-kt$$
The concentration should be zero at $t=C_0/k$. But in some books and websites I saw that graph between concentration and time don't touch the X-axis. So does zero order reaction complete or not? If the concentration never reaches zero, then it isn't following "zero-order" kinetics, at least not at all times.
If it were, as you say, the concentration would reach zero at time $t = C_0/k$. | {
"domain": "chemistry.stackexchange",
"id": 17703,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electrochemistry, kinetics, reaction-order",
"url": null
} |
gazebo
A screenshot can be seen here. I am facing the same problem in my robot models.
On a similar note, I have seen weird behavior in Gazebo from my COLLADA mesh models (this behavior was also similarly weird in Gazebo 1.0 + ROS Fuerte). I would like to use the colors as specified in the mesh file (rviz + RobotModel handle this correctly).
Gazebo seems to start with all the meshes painted grey. If any of the joints move, then the corresponding links seem to alternate between grey and the color as specified by the mesh. A video of this can be seen here.
I am not sure what information will be required to debug this, but I can place it online.
Edit #1:
Replacing the material tag as suggested by the SDF documentation and Nate's answer does not work. I've replace the material tag of all my urdf links with this line from my world file which I know works:
<material>
<script>
<uri>file://media/materials/scripts/gazebo.material</uri>
<name>Gazebo/Green</name>
</script>
</material> | {
"domain": "robotics.stackexchange",
"id": 2891,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gazebo",
"url": null
} |
powershell, web-services, ip-address
That would match 4 groups of up to 3 digits each separated by commas.
In your function Set-ServerConfiguration you have this
$officeoneip = "11.111.11.11"
$officetwoip = "22.222.22.22"
If ($currentip -match $officeoneip) {
While this would not likely have the issue I am about to describe I need to point out another potential flaw. Period is a control character in regex. Now, I get that you will never get a public ip "11.111.11T11" but know that your comparison would match that since T would satisfy the "any character" meaning of the period. In this case it would be better anyway to use the -eq operator as you are looking for an exact match anyway.
If ($currentip -eq $officeoneip) { | {
"domain": "codereview.stackexchange",
"id": 19642,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "powershell, web-services, ip-address",
"url": null
} |
ds.algorithms, graph-algorithms
In general minimum range matroid basis problems can be solved in $O(n\log n)$ time, plus $O(n)$ steps of a subroutine that finds a basis of a set with corank one: sort the elements from smallest to largest and then process the elements one by one. While you process the elements maintain an independent set $I$; when you process an element $e$, add $e$ to $I$ and, if that addition causes $I$ to become dependent, kick out the minimum weight element in the unique circuit of $I$. The minimum range basis is one of the sets $I$ that you found in this process: the one that has full rank and has as small a range between min and max as possible. | {
"domain": "cstheory.stackexchange",
"id": 1648,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ds.algorithms, graph-algorithms",
"url": null
} |
reinforcement-learning, terminology, sutton-barto
Now, back to the specific context. $v_\pi$ and $q_\pi$ are value functions, so they give you the value of a state or state-action pair, respectively, i.e. the expected return (reward in the long run). The goal in RL is really to learn these functions or a policy. Now, Sutton & Barto mean that we can use a model like $f$ above and adjust the parameters $a$ and $b$ in order to learn the optimal value functions. Now, I will not define what an optimal value function is. It's defined in the book. Once you have a good grasp of the notion of a value function and optimality, you can also check this post (written by me) for more mathematical details on Bellman equations and value functions. | {
"domain": "ai.stackexchange",
"id": 3622,
"lm_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, terminology, sutton-barto",
"url": null
} |
homework-and-exercises, classical-mechanics, lagrangian-formalism, textbook-erratum
\end{align*}$$
I was able to follow
$$\begin{align*}
T &= \sum_i{m_i\mathbf{v}_i} \cdot \partial\mathbf{v}_i\\
T &=\frac{1}{2} \sum_i{m_iv_i^2}
\end{align*}$$
But I am at a loss: Where does $\color{red}{-Q_j}$ come from? General explanation. Similar to Newton's 2nd law, the D'Alembert's principle has both a dynamical and a kinetic term,
$$
\sum_i (\mathbf{F}^{(a)}_i - \dot{\mathbf{p}}_i) \cdot \delta \mathbf{r}_i~=~0. \tag{1.45}
$$
On one hand, the dynamical term
$$\sum_i \mathbf{F}^{(a)}_i \cdot \delta \mathbf{r}_i = \sum_j Q_j \delta q_j \tag{1.48}$$
contains the generalized force
$$Q_j=\sum_i\mathbf{F}^{(a)}_i\cdot \frac{\partial \mathbf{r}_i}{\partial q_j}.\tag{1.49}$$
On the other hand, the kinetic term
$$\dot{\mathbf{p}}_i \cdot \delta \mathbf{r}_i~=~ \sum_j{\left[ \frac{d}{dt} \left( \frac{\partial T}{\partial\dot{q}_j} \right) - \frac{\partial T}{\partial q_j} \right] \delta q_j} $$
contains the kinetic energy $T =\frac{1}{2} \sum_i{m_iv_i^2}$. | {
"domain": "physics.stackexchange",
"id": 1288,
"lm_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, classical-mechanics, lagrangian-formalism, textbook-erratum",
"url": null
} |
fl.formal-languages
The case of $Q' := Q\cup\{\epsilon\}$ is rather more complicated. The obvious things to note are that in any decomposition $Q = A\cdot B$, both $A$ and $B$ must be subsets of $Q'$ with $A\cap B = \{\epsilon\}$. Also, $a,b$ must be contained in $A\cup B$.
With a bit of extra work, one can show that $a$ and $b$ must be in the same subset. Otherwise, assume wlog that $a\in A$ and $b\in B$. Let us say that $w\in Q'$ has a proper factorization if $w=uv$ with $u\in A\setminus\{\epsilon\}$ and $v\in B\setminus\{\epsilon\}$. We have two (symmetric) subcases depending on where $ba$ goes (it must be in $A$ or $B$ since it has no proper factorization). | {
"domain": "cstheory.stackexchange",
"id": 4644,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fl.formal-languages",
"url": null
} |
java, console, enum
while (true)
{
try
{
userScelta = Integer.parseInt(Actions.bufferedReader.readLine());
break;
}
catch (IOException ignored) { }
catch (NumberFormatException e)
{
System.out.println("Inserisci un numero valido.");
}
}
return MENU_SCELTE.from(userScelta);
}
} | {
"domain": "codereview.stackexchange",
"id": 7040,
"lm_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, console, enum",
"url": null
} |
computability, programming-languages, turing-completeness
Turing completeness tells nothing about having types, built in arrays/integers/dictionaries, input/output capabilities, network access, multithreading, dynamic allocation, ...
Just because Java does not have feature X (say, macros, higher-rank types, or dependent types), it does not suddenly stop being Turing complete.
Turing completeness and language expressiveness are two different notions. | {
"domain": "cs.stackexchange",
"id": 7401,
"lm_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, programming-languages, turing-completeness",
"url": null
} |
c++, beginner, strings
So now you need to define isLetter() efficiently so it only applies to characters that appear in words.
bool isLetter(char v)
{
/*
* Return true for any character that is legally part of a word.
* currently this is a-z and A-Z but the question was unclear as
* to the extent of what counts as part of the word so this array
* can be adjusted as appropriate to include valid characters.
*
* Note: If this is really just a-z and A-Z then it can be replaced
* by a single call to std::isalpha() which does exactly
* the same thing.
*
* Note II: The use of the array is to trade space for time.
* This will be faster. But it also assumes we are using
* the ASCII character set.
*
* The use of the array can be traded for another technique
* this function is simply meant to define the letters that | {
"domain": "codereview.stackexchange",
"id": 8593,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, beginner, strings",
"url": null
} |
ros, ros2, colcon, qt5, ros-crystal
Title: Could not find or load the Qt platform plugin "windows" in ""
I am trying to build a Qt5 Widget application as a ROS2 package with colcon. After following
this tutorial (only that I am using a Widget application instead of a quick app), I finally was able to compile the package, but I cannot run it because I get the following output:
c:\dev\ros2>ros2 run plainwidget plainwidget
This application failed to start because it could not find or load the Qt platform plugin "windows"
in "".
Reinstalling the application may fix this problem. | {
"domain": "robotics.stackexchange",
"id": 32557,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, ros2, colcon, qt5, ros-crystal",
"url": null
} |
python, numbers-to-words
This is still wrong. If there are no lookups for nums remaining, there will still be a trailing space. There are multiple ways to handle this. The two obvious ones are removing the trailing spaces or modifying the string in case n%10 is 0.
First approach:
if n < 20 :
txt = f"{nums[n]}"
elif n >= 20 and n < 100:
txt = f"{tens[int(n/10)]} {nums[n%10]}"
else:
txt = f"{nums[n//100]} hundred {tens[(int(n/10))%10]} {nums[n%10]}"
return(txt.rstrip(" "))
str.rstrip([chars]) will return a copy of the string with trailing characters removed. There's an lstrip too, in case you ever want to remove characters from the front of the string.
I'll leave the second approach as an exercise, but you'll want to overhaul the remainder of the function either way. At the moment, nToTxt(0) is empty. Modifying the dictionary to have it contain zero will break the rest of your program. Add zero and modify the rest of your program to handle it properly with extra checks. | {
"domain": "codereview.stackexchange",
"id": 44213,
"lm_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, numbers-to-words",
"url": null
} |
c#, object-oriented, comparative-review, email
private static SmtpClient CreateSmtpClient(
bool enableSsl,
SmtpDeliveryMethod deliveryMethod)
{
SmtpClient client = new SmtpClient
{
EnableSsl = enableSsl,
DeliveryMethod = deliveryMethod
};
return client;
}
And here's the method responsible for calling the above two and sending the email:
public static void SendEmail(string subject, string body, List<string> emails, List<string> ccs = null)
{
using (MailMessage message = CreateMailMessage(subject, body, true, emails, ccs))
{
using (SmtpClient client = CreateSmtpClient(true, SmtpDeliveryMethod.Network))
{
client.Send(message);
}
}
} I'd still say that you should break apart the mail message and SMTP client into separate classes for the "Single responsibility principle". In specific: | {
"domain": "codereview.stackexchange",
"id": 35233,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, object-oriented, comparative-review, email",
"url": null
} |
newtonian-mechanics, mass
Title: The impossible possibility - weightless mass I have a hypothetical question about inertia.
Let's say I have an object with inertial mass a ton (2,000 lbs.), and it is sitting in my front yard, for instance. If it would suddenly become immune to gravity, i.e its gravitational mass becomes zero, what would happen to it? Now forget about whether this is actually possible, because science at its best tries to disprove itself. I just need to know what would happen to this block of iron sitting in my front yard if it would lose gravity.
Edit: By immune to gravity, I mean that it no longer is affected by gravity. It still has the same mass and everything else, it just isn't affected by gravity anymore. | {
"domain": "physics.stackexchange",
"id": 4227,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "newtonian-mechanics, mass",
"url": null
} |
There are infinitely many primes of forms $$4n + 1$$ and $$4n +3$$.
However, it is not clear which of the two are more abundant.
In 1853, Chebyshev in a letter indicated that he had a proof that the number of primes of the form $$4n+1$$ is less than the number of primes of the form $$4k+3$$. However, in 1914, Littlewood showed that Chebychev's assertion fails infinitely often; however, he did not specify where this first reversal occurs.
Nevertheless, some forty years later in a computer search, it was discovered that the first prime for which the $$4n+1$$ primes become more plentiful than the $$4n+3$$ primes is for the prime $$26861$$.
That situation is not reversed until the prime $$616,841$$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9822876997410348,
"lm_q1q2_score": 0.8030933603195975,
"lm_q2_score": 0.8175744850834648,
"openwebmath_perplexity": 255.20696182575563,
"openwebmath_score": 0.947903037071228,
"tags": null,
"url": "https://math.stackexchange.com/questions/3302126/are-primes-ignoring-2-equally-likely-to-be-1-textor3-pmod-4"
} |
java, networking, event-handling
This signature was clearly generated by a tool. Even though you only need one of the arguments and it is used on the first line of the function doesn't mean the arguments shouldn't have good names.
What happens if I need to use the long argument later? I haven't been in this code for a while, but I just have to add this one simple line. I'm pretty sure arg2 was the long. Oops, arg3 is the long and the int gets implicitly converted and the complier doesn't care. If the arguments had real names, it would be much harder to make this mistake.
That is some what of a contrived example because you could just look at the signature to see that arg3 is the long. But how about this. I haven't had to implement an OnItemClickListener before. I don't know what the arguments are supposed to mean. Why is there a long and an int? Since you didn't take the time to give the arguments real names, I need to look at the documentation to see what each argument means. | {
"domain": "codereview.stackexchange",
"id": 10942,
"lm_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, networking, event-handling",
"url": null
} |
bash, linux
Would this be considered a reasonably accurate way of doing this? Any suggestions to increase efficiency/accuracy would be greatly appreciated. There are a few problems you have here. The first, is the concept of getting the usage at a point in time, which is not possible. But, you can get it for a span of time. You are using top -bn 1 which will get the usage for the span of a second.
Since you are accessing the /proc system to get the number of CPU's, you may as well use the right /proc file for what you want:
cat /proc/stat: | {
"domain": "codereview.stackexchange",
"id": 9461,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "bash, linux",
"url": null
} |
c++, performance, strings, c++11, programming-challenge
Consolidate constant strings
The code current contains four instances of the line return "Error!"; It would probably make sense to create a static const variable for that instead. Your compiler is probably smart enough to combine those strings anyway, but doing so explictly makes your intent clear and aids in translation if internationalization is needed at some later date.
Consider testing for exceptions
At the moment, an identifier in_?valid gets interpreted as a "C++-style" identifier (as I mentioned in the comments, few real C++ programmers actually write code like that) and is translated into in?valid as a "Java-style" identifier. However, the input in?valid is rejected as an error. Since neither identifier is valid in either language, I suspect this is an error.
Consider early bailout within the loop | {
"domain": "codereview.stackexchange",
"id": 11575,
"lm_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, c++11, programming-challenge",
"url": null
} |
sequence-alignment, database, genome, statistics, machine-learning
No, a phenotype is a way of behavior or other observed characteristic of a person, resulting from a combination on its underlying biology and the environment it's in. Think things like, height, running speed, strength, etc.
In the context in which you're interested, this would be more properly, "the clinical presentation of a disease or disorder".
Step one of diagnosing a patient is defining exactly how they present (i.e., exactly what their maladies, aberrant electrolyte levels, genetic mutations, etc. are).
An algorithm that only works on the test population is useless. Google "model overfitting".
The point of an algorithm is to take the EHR data and progress to a diagnosis. This isn't real time, you'd just run a batch of algorithms as test results come in.
You need patients in your test/validation sets to have the required inputs for your algorithm. | {
"domain": "bioinformatics.stackexchange",
"id": 1209,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "sequence-alignment, database, genome, statistics, machine-learning",
"url": null
} |
javascript, unit-testing, node.js, promise, express.js
it('should return todo items', () => {
return todo.findAll(request, response)
.then(() => {
expect(response._getRenderData()).to.deep.equal(testData);
}).catch((err) => {
throw err;
});
});
});
describe('json requested', () => {
beforeEach(() => {
request = httpMocks.createRequest({
headers: {
Accept: 'application/json'
}
});
var responseOptions = { req: request };
response = httpMocks.createResponse(responseOptions);
}); | {
"domain": "codereview.stackexchange",
"id": 23548,
"lm_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, unit-testing, node.js, promise, express.js",
"url": null
} |
reinforcement-learning, dqn, hyperparameter-optimization, performance, c51
To avoid reward exploitation, only .70% of the reward if the agent moves closer vertically or horizontally when a diagonal move was available. This is to get the agent to take the shortest path moving diagonally with only the sqrt(2) bird's eye reward. Otherwise and agent might move up, then left and collect a reward of 2 normalized units instead of the ~=1.4142 normalized reward units collected for moving diagonally. The .70% keeps the reward for an vertical then horizontal (or vice versa) move to 1.4 which is less than the ~=1.4142 diagonal reward.
Originally, the agent could collect up to a total reward of up to 1 and then 3 additional reward points for reach the target. Using the stock TensorFlow c51 DQN agent against this reward scheme, using the default min_q_value=-10 and max_q_value=10 values (I believe they are referred to as VMIN and VMAX in the literature) I found learning achieved the following results on very small world sizes:
[5/2/2021 5:39:19 PM] Training Started | {
"domain": "ai.stackexchange",
"id": 2804,
"lm_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, dqn, hyperparameter-optimization, performance, c51",
"url": null
} |
java, game, swing
Doing the separation of UI and model is very hard while saying to do so is easy. I even saw experienced developers struggling with it as the do not put the fact into account that a proper separation implicitly makes the UI interchangable. I often heard "we do not need to exchange the UI but we have proper separation". But that is inherent contradictory. I see UI exchangability not as a feature. I see it as a measurement for a pretended separation.
Game state
You formulate the state of the game within an enum. My suggestion is to use a full state pattern. There you not only provide an artefact that says you are in state 1 or in state 2. You also encapsulate the corresponding behaviour and use polimorphism. Currently the state specific behaviour is spread all over the place within if-then-else-statements. | {
"domain": "codereview.stackexchange",
"id": 24230,
"lm_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, game, swing",
"url": null
} |
python, pandas
you could try doing this:
In [3] : df.melt("a").sort_values("a")
Out[3] :
a variable value
0 1 b 2
3 1 c 3
1 4 b 5
4 4 c 6
2 7 b 8
5 7 c 9
where the sorting might be optional in your case. Also, you should swap "a" for the name of your column containing the UID values.
You can additionally drop the autogenerated variable column too, so the final solution would be:
In [4] : df.melt("a").sort_values("a").drop("variable", axis=1)
Out[4] :
a value
0 1 2
3 1 3
1 4 5
4 4 6
2 7 8
5 7 9 | {
"domain": "datascience.stackexchange",
"id": 5762,
"lm_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, pandas",
"url": null
} |
java, thread-safety, swing
all user interface components should be created and accessed only from the AWT event dispatch thread.
including view.list.getSelectedIndices() in the deleteElement() method. The good news is that the actionPerformed event handler (which calls deleteElement()) is already runned by this thread so it's fine but you could get rid of the EventQueue.invokeLater and call view.listModel.remove(index) directly there.
The index/indices manipulation is not so convenient in the deleteElement() method:
final int index = indices[indices.length - 1 - i];
It took a while to figure out what it is doing and this is needed becase removing an element from a list shifts the indexes of elements after the removed one so you have to remove them in reversed order.
I'd simply reverse the array and use a foreach loop:
ArrayUtils.reverse(indices);
for (final int elementIndex: indices) {
view.listModel.remove(elementIndex);
} | {
"domain": "codereview.stackexchange",
"id": 6202,
"lm_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, thread-safety, swing",
"url": null
} |
navigation, gmapping
<!-- Debug parameters -->
<!--
<param name="output_timing" value="false"/>
<param name="pub_drawings" value="true"/>
<param name="pub_debug_output" value="true"/>
-->
<param name="tf_map_scanmatch_transform_frame_name" value="$(arg tf_map_scanmatch_transform_frame_name)" />
<!--
</node>
-->
<node pkg="tf" type="static_transform_publisher" name="map_nav_broadcaster" args="-0.45 0 0 3.1765 0 3.1415 /base_link /laser 100"/> | {
"domain": "robotics.stackexchange",
"id": 24626,
"lm_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, gmapping",
"url": null
} |
java, javafx
}
MainApp.java: (32 lines, 766 bytes)
/**
* Main Application
* @author Bhathiya
*/
public class MainApp extends Application {
/**
* Start Application
* @param stage main stage
* @throws Exception
*/
@Override
public void start(Stage stage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("/fxml/Scene.fxml"));
Scene scene = new Scene(root);
stage.setTitle("Java FX Property Class Builder");
stage.setResizable(false);
stage.setScene(scene);
stage.show();
}
}
PropertyClassBuilder.java: (115 lines, 3922 bytes)
/**
*
* @author Bhathiya
*/
public class PropertyClassBuilder {
/**
* class name for code generator to use
*/
private final String className;
/**
* constructor for code generator
*
* @param className class name
*/
public PropertyClassBuilder(String className) {
this.className = className;
} | {
"domain": "codereview.stackexchange",
"id": 9762,
"lm_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, javafx",
"url": null
} |
ros, gazebo, ros-kinetic
Originally posted by ros_aaron on ROS Answers with karma: 3 on 2020-04-15
Post score: 0
You moved the link collision and visual relative to the joint axis, you probably shoud fix your front wheels so they aren't fixed. This should be less froglike:
<?xml version="1.0" ?>
<robot name="two_wheel_robot" xmlns:xacro="http://www.ros.org/wiki/xacro">
<material name="black">
<color rgba="0.0 0.0 0.0 1.0"/>
</material>
<material name="blue">
<color rgba="0.203125 0.23828125 0.28515625 1.0"/>
</material>
<material name="green">
<color rgba="0.0 0.8 0.0 1.0"/>
</material>
<material name="grey">
<color rgba="0.2 0.2 0.2 1.0"/>
</material>
<material name="orange">
<color rgba="1.0 0.423529411765 0.0392156862745 1.0"/>
</material>
<material name="brown">
<color rgba="0.870588235294 0.811764705882 0.764705882353 1.0"/>
</material>
<material name="red">
<color rgba="0.80078125 0.12890625 0.1328125 1.0"/>
</material>
<material name="white"> | {
"domain": "robotics.stackexchange",
"id": 34770,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, gazebo, ros-kinetic",
"url": null
} |
ros, ros-kinetic, mocap-optitrack
Originally posted by oha on ROS Answers with karma: 35 on 2018-03-19
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 30372,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, ros-kinetic, mocap-optitrack",
"url": null
} |
optics, water, reflection, refraction, polarization
In short, at glancing angles, the TIR mechanism mimics the action of a quarter wave plate.
I show the above is true with the Fresnel equations in my answer to the Physics SE question How does one calculate the polarization state of random light after total internal reflection (read the answer to about halfway, where I discuss the grazing angle case). | {
"domain": "physics.stackexchange",
"id": 41673,
"lm_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, water, reflection, refraction, polarization",
"url": null
} |
python, python-3.x, image
if par.find("rozdzielczosc") == -1:
pass
else:
try:
w, h = re.findall('\d+', par)
except:
pass
if par.find("zdjecia=") == -1:
pass
else:
urls = self.path[self.path.find("zdjecia=") + 8 :]
urls = urls.split(",")
try:
image_list = create_images_list(urls)
# call mosaic creator
# 1 required attribute: list of images in cv2 format,
# 3 optional attributes: random image positioning, width of output image, height of output image
mozaika = Mozaika(image_list, losowo, w, h)
img = mozaika.output_image # store output image | {
"domain": "codereview.stackexchange",
"id": 34826,
"lm_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, image",
"url": null
} |
python, beginner, game, hangman
MAX = len(HANGMAN) - 1
ALPHABETH = 'abcdefghijklmnopqrstuvwxyz'
def guess_letter(letters_guessed):
while True:
guess = raw_input('Guess a letter dude: ').lower()
if guess not in ALPHABETH:
print guess, 'is like totally not in the alphabet dude, try again!'
elif guess in letters_guessed:
print 'You already guessed {}.. PAY ATTENTION!'.format(guess)
else:
return guess
def play_hangman():
hang_size = 0
word_to_guess = random.choice(WORD_LIST)
word_to_guess_spaced = ' '.join(word_to_guess)
hidden = ['_']*len(word_to_guess)
letters_guessed = set()
user_guessed_word_spaced = ' '.join(hidden)
print "HANGMAN!"
while hang_size < MAX:
print
print user_guessed_word_spaced
user_guess = guess_letter(letters_guessed)
letters_guessed.add(user_guess)
if user_guess in word_to_guess: | {
"domain": "codereview.stackexchange",
"id": 21044,
"lm_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, game, hangman",
"url": null
} |
javascript, beginner, jquery, html, css
Title: Simple restaurant menu As stated in the title, the code produces a simple drop-down menu that allows you to select your Starter, Main and Dessert courses, and will show your order in a small box underneath (like a bill).
$(document).ready(function() {
//Variables
var selectedStarter = {
dish: "(None)",
price: 0
};
var selectedMain = {
dish: "(None)",
price: 0
};
var selectedDessert = {
dish: "(None)",
price: 0
};
var starter = {
firstDish: "Salad",
firstDishPrice: 15,
secondDish: "Soup",
secondDishPrice: 7,
thirdDish: "Fish rolls",
thirdDishPrice: 12
};
var main = {
firstDish: "Steak",
firstDishPrice: 17,
secondDish: "Salmon",
secondDishPrice: 12,
thirdDish: "Rissotto",
thirdDishPrice: 9
};
var dessert = {
firstDish: "Sorbet",
firstDishPrice: 4,
secondDish: "Fruit salad",
secondDishPrice: 6,
thirdDish: "Apple pie",
thirdDishPrice: 5
}; | {
"domain": "codereview.stackexchange",
"id": 20476,
"lm_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, beginner, jquery, html, css",
"url": null
} |
Create a clock with a hand that covers 10 minutes in one full revolution. Mark time 0 at the top. The assumptions amount to marking those five beeps independently and uniformly at random around the clock, creating six marks.
This picture should make it obvious that the distributions of the six gaps between the marks are identical. It is immediate that their (unconditional) expectations are the same and must sum to the full time, so each expected gap length is $10/6$ minutes. It makes no difference whether you heard the third beep, or the second, or whatever: the question is tantamount to asking the expected time to the next beep around the clock, given that the preceding gap was one-tenth of the time.
This leaves five gaps uniformly spanning nine-tenths of the remaining time. Again, each must have the same expectation, now equal to one-fifth of nine-tenths of the time. Thus, the answer is $1.8$ minutes. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.976669234586964,
"lm_q1q2_score": 0.841437867044612,
"lm_q2_score": 0.8615382129861583,
"openwebmath_perplexity": 2593.037301965224,
"openwebmath_score": 0.6912132501602173,
"tags": null,
"url": "https://stats.stackexchange.com/questions/305548/expected-remaining-minutes-given-fixed-number-of-events"
} |
java, validation, constructor
I'm wondering if this is a bad coding habit to get into and if I should break out of this coding habit or if it'll be fine to continue doing this. Would doing this be a bigger issue down the line when I get onto more complex programs?
Edit: Just wanted to give some more information for why part of the code is written the way it is. The snippet provided is part of a coding challenge where one of the requirements is to set any negative number inputted to 0. The biggest problem I see here is that you are printing a warning message to System.out and then using a default value for something which sounds like an Exception.
Why allow negative values at all?
if (initialAge < 0) {
throw new IllegalArgumentException("Initial age cannot be negative, was specified as " + initialAge);
}
age = initialAge; | {
"domain": "codereview.stackexchange",
"id": 23482,
"lm_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, validation, constructor",
"url": null
} |
javascript, object-oriented, programming-challenge, design-patterns
class GroupRepository {
add(group) {
GROUPS.add(group);
}
remove(group) {
return GROUPS.delete(group);
}
filter(id) {
return [...GROUPS].filter(g => g.name === id);
}
all() {
return [...GROUPS];
}
}
class AccountRepository {
add(account) {
ACCOUNTS.add(account);
}
filter(id) {
return [...ACCOUNTS].filter(acc => acc.name === id);
}
remove(account) {
return ACCOUNTS.delete(account);
}
all() {
return [...ACCOUNTS];
}
}
class Group {
constructor(name) {
this.name = name;
this.accounts = new Set();
}
getName() {
return this.name;
}
add(account) {
this.accounts.add(account);
}
delete(account) {
return this.accounts.delete(account);
}
getAccounts() {
return [...this.accounts];
}
toString() {
return `Group: ${this.name}`;
}
} | {
"domain": "codereview.stackexchange",
"id": 23335,
"lm_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, object-oriented, programming-challenge, design-patterns",
"url": null
} |
statistical-mechanics, material-science, polymers
Update - To make a prediction, the problem of squeezing a WLC or FJC polymer between two plates is probably more straightforward than that of 'crushing' a polymer into a spherical ball (which could perhaps be experimentally accomplished by placing a hydrophilic polymer into increasingly 'bad'/non-polar solvent) since it avoids having to estimate any bending energies. So, focusing on the 3D --> 2D scenario, my guess is that the energy to accomplish the task of squeezing the polymer until only two dimensional diffusion is observed would be similar to that of reducing one degree of diffusional freedom of a monoatomic gas - i.e. (Number of persistence length units in polymer) * $\frac{1}{2}(kB)(T)$. I would also predict that the force curve is non-linear, since the probability density for the location of a particular persistence length segment of a polymer is probably not uniform across the gap between the plates. However, that's simply a guess. Under the isothermic condition, the force | {
"domain": "physics.stackexchange",
"id": 1352,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "statistical-mechanics, material-science, polymers",
"url": null
} |
javascript, validation, form, ajax
var form = $(this);
ajaxHandler(form.url, form.serialize()).then(function (result) {
console.log('#############');
$('.field-error, .success, .error').remove();
if(result.errorType == "fieldErrors")
{
// handle field errors
$.each(result.data, function (key, value) {
console.log(key, value);
$('<span class="field-error"> ' + value.msg + '</span>').insertBefore('#' + value.param);
});
}
else if(result.errorType == "formErrors")
{
// handle form errors
$('<p class="error">' + result.message + '</p>').insertBefore(form);
}
else
{
// success
form[0].reset();
$('<p><span class="success">' + result.message + '</span></p>').insertBefore(form);
} | {
"domain": "codereview.stackexchange",
"id": 26992,
"lm_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, validation, form, ajax",
"url": null
} |
There is a very old result that says $$\lim_{n\to\infty}\frac{\sum_{k=1}^n \varphi(k)}{n^2}=\frac{3}{\pi^2}.$$
The error term I have in notes is $O(x(\log x)^{2/3}(\log\log x)^{4/3})$, but undoubtedly there have been improvements on that. There is a large literature.
Added: The OP quoted correctly the textbook source of the problem, which asks about the behaviour of $(\sum_{i=1}^n\varphi(n))/n^2$. This is undoubtedly a typo, since $\sum_{i=1}^n\varphi(n)=n\varphi(n)$.
The ratio $\dfrac{\varphi(n)}{n}$ certainly bounces around a lot, and can be made arbitrarily close to $0$, and, much more easily, arbitrarily close to $1$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9637799410139921,
"lm_q1q2_score": 0.835631681717433,
"lm_q2_score": 0.8670357683915537,
"openwebmath_perplexity": 361.3016385675144,
"openwebmath_score": 0.9339703917503357,
"tags": null,
"url": "http://math.stackexchange.com/questions/113120/finding-lim-n-to-infty-phin-n2-when-phin-sum-i-1n-phin?answertab=votes"
} |
newtonian-mechanics, energy-conservation, work, friction
Title: Will work done be zero when Tesla car goes uphill and comes back downhill? If we are going uphill using Tesla car, it uses energy from the battery however when we come downhill it charges the battery, I am not sure if the charge produced while driving downhill will be equal to the charge used when going uphill but if hypothetically we consider it to be equal, will still be work done zero? Technically, because their are dissipative non-conservative forces acting on a Tesla such as air resistance, resistance from friction from the road and various kinds of internal mechanical sources of friction; there will be a non-zero net work on the car for the up and down hill round trip. Even the process of charging a battery is not one hundred percent efficient so that some energy will be lost as heat during both discharge and recharge. So, a repetitive cycle of going uphill and down hill will eventually result in a dead battery; a process that would take more time in cooler weather and | {
"domain": "physics.stackexchange",
"id": 100054,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "newtonian-mechanics, energy-conservation, work, friction",
"url": null
} |
inscribed into the right-angled triangle. Right Triangle Equations. The inscribed circle has a radius of 2, extending to the base of the triangle. 4 Find the circle's radius. Radius of the inscribed circle of an isosceles triangle is the length of the radius of the circle of a triangle is the largest circle contained in the triangle; it touches (is tangent to) the three sides. Solution to Problem: a) Let M, N and P be the points of tangency of the circle and the sides of the triangle. Therefore, in our case the diameter of the circle is = = cm. In geometry, the incircle or inscribed circle of a triangle is the largest circle contained in the triangle; it touches (is tangent to) the three sides. Determine the side length of the triangle … This common ratio has a geometric meaning: it is the diameter (i.e. By the inscribed angle theorem, the angle opposite the arc determined by the diameter (whose measure is 180) has a measure of 90, making it a right triangle. Angle Bisector: | {
"domain": "laartagency.com",
"id": null,
"lm_label": "1. Yes\n2. Yes",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9755769042651874,
"lm_q1q2_score": 0.8330575618506452,
"lm_q2_score": 0.8539127548105611,
"openwebmath_perplexity": 308.6810973504068,
"openwebmath_score": 0.733421266078949,
"tags": null,
"url": "http://laartagency.com/kate-and-jqzxi/0720ad-radius-of-circle-inscribed-in-a-right-angled-triangle"
} |
waves, experimental-physics, electric-circuits, electric-current
Title: Sinewave in DC powersupply today in our physics class we talked about the hall-effect. Therefore we have used a Lab Quest with a sensor to measured the magnetic flux induced by a coil.
While adjusting the current to gather some values I noticed a steady lowering in amperage. And after replacing the power supply nothing happened.
Some time passed and I found an option to plot the data over time and the result was interesting. The graph showed an alternating wave-like relation, like a mixture of a sine and rectangular wave. It looked like a normal sine, but at its peek it stayed there for a full period doing a full leap and again staying...
I'm going to school in Germany and our ac power line frequency is about 50Hz and the wave had an duration of about 50 seconds and i can imagine there could be a relation. | {
"domain": "physics.stackexchange",
"id": 52356,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "waves, experimental-physics, electric-circuits, electric-current",
"url": null
} |
biodiversity
So can i say they aren't diverse because of in their meiosis division their chromosomes don't cross over and random assort (alignment)?
No, you can't say that! Because they are diverse and because for many of the species you may think about, cross-over does occur. Their genetic diversity as well as their phenotypic diversity is as high than in humans. There is nothing extraordinary about humans (except their brain and the related fact that we predigest our food by cooking it) compare to other lineages. And there is nothing extraordinary to have one extraordinary feature (such as a big brain) that you can't find in other lineages! Many lineages are extraordinary in some sense. | {
"domain": "biology.stackexchange",
"id": 2411,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "biodiversity",
"url": null
} |
logic, type-theory
To do that I am using the ANN rule that forces me to check that α -> α is a type (and I can prove it no problem). Then I got this naked id symbol and have to prove it's type to be α -> α.
Finally, here is a problem. In order to do that I will have to use var rule, which requires the type of id to be set in the context Gamma explicitly, but it is not done, therefore the proof is falling apart. $\mathsf{id}$ and $\mathsf{const}$ are not variables of the calculus, but syntactic sugar for $\lambda x \rightarrow x$ and $\lambda x \rightarrow \lambda y \rightarrow x$ respectively. This is stated at the end of §2.2 and subtly conveyed by the use of a sans-serif font rather than italics (this is a typographic convention of this particular document, not a common convention).
So for example the type judgement
$$
\alpha :: \ast, y :: \alpha \vdash (\mathsf{id} :: \alpha \rightarrow \alpha) \: y :: \rightarrow \alpha
$$
is also the type judgement
$$ | {
"domain": "cs.stackexchange",
"id": 17632,
"lm_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, type-theory",
"url": null
} |
pcl, sensor-msgs, ros-hydro, pointcloud
Original comments
Comment by Ken_in_JAPAN on 2014-04-24:
@georgebrindeiro, Thank you for replying early! The one of thing I want to know is how to pass ROS topic (that means sensor infomation) to callback function. I have thought that the role is sensor_msg::PointCloud.
My idea is wrong, isn't it? I will rely on you when I have new issues. Thanks!
Comment by georgebrindeiro on 2014-04-27:
When using ROS, you use sensor_msgs::PointCloud2. When using PCL, you use PCL types. To convert from ROS to PCL cloud type, use the pcl_conversions::toPCL function. To convert back, use pcl_conversions::fromPCL. See http://wiki.ros.org/hydro/Migration#PCL
Comment by Athoesen on 2014-05-20:
Have you had any luck saving PCD files with ROS and PCL?
Comment by georgebrindeiro on 2014-05-22:
@Athoesen yeah, no problem. if you're having problems with that, though, you should probably start a new thread. | {
"domain": "robotics.stackexchange",
"id": 17771,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "pcl, sensor-msgs, ros-hydro, pointcloud",
"url": null
} |
special-relativity, classical-mechanics
This kind of hyperbolic motion has been widely studied because it has very interesting features. For example, an observer in such a motion experiences an apparent event horizon, which has also consequences for "counting particles" from the point of view of quantum theory; a rod under such kind of motion experience stress; and other phenomena. You can check the Wikipedia page for references, or § 6.2 in Misner, Thorne, Wheeler: Gravitation (Freeman & Co. 1973). | {
"domain": "physics.stackexchange",
"id": 48334,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "special-relativity, classical-mechanics",
"url": null
} |
opencv, openni, turtlebot, sensor-msgs, image
To get image dimension: std::cout << "Image dimension (Row x Col): " << cv_ptr->image.rows << " x " << cv_ptr->image.cols << endl;
To get
image global max and min depth
values:
double max = 0.0;
cv::minMaxLoc(cv_ptr->image, &min, &max, 0, 0);
std::cout << "Min value: " << min << " " << "Max value: " << max << endl;``` | {
"domain": "robotics.stackexchange",
"id": 16845,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "opencv, openni, turtlebot, sensor-msgs, image",
"url": null
} |
made in the results of every single equation.. Remember when setting up the A matrix, that we have to fill one column full of ones. The basic problem is to find the best fit straight line y = ax + b given that, for n 2 f1;:::; Ng, the pairs (xn;yn) are observed. Interactive Linear Algebra This is an introductory textbook on linear algebra, written by Joe Rabinoff and Dan Margalit for Math 1553 at Georgia Tech. Gireesh Sundaram. \lVert This calculates the least squares solution of the equation AX=B by solving the normal equation A T AX = A T B. Is this the global minimum? Notice that any solution $$X$$ to $$MX=V$$ is a least squares solution. \left( \color{red}{ No- you can use the Moore-Penrose pseudoinverse to find a minimum norm least squares solution no matter what rank A has. \Big\lVert \color{blue}{\mathbf{A}^{+} b} + where vectors are colored according to whether they reside in a \color{blue}{range} space or \color{red}{null} space.$$ If $A$ has full column rank, then there is a | {
"domain": "kezklinika.hu",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9825575157745541,
"lm_q1q2_score": 0.8078481160038832,
"lm_q2_score": 0.8221891370573388,
"openwebmath_perplexity": 977.894354635926,
"openwebmath_score": 0.7075470685958862,
"tags": null,
"url": "https://kezklinika.hu/6siwd8v1/zb71a.php?e7ea89=least-squares-solution-linear-algebra"
} |
pressure, fluid-statics, vacuum
sand or any heavy material in quantity sufficient to finally separate the upper surface of the stopper, EF, from the lower surface of the water to which it was attached only by the resistance of the vacuum. Next weigh the stopper and wire together with the attached vessel and its contents; we shall then have the force of the vacuum [forza del vacuo].” | {
"domain": "physics.stackexchange",
"id": 84255,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "pressure, fluid-statics, vacuum",
"url": null
} |
15 In Asl, Sheikh Zayed Grand Mosque Columns, Easyjet Recruitment Process, Mazda 323 Protege 2003 Fuel Consumption, Heritage Furniture Flyer, Mont Tremblant-village Weather, Small Kitchen Remodel Ideas, Lawrence Tech Scholarships, Tile Adhesive Not Setting, | {
"domain": "forret.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9632305307578324,
"lm_q1q2_score": 0.8088573876496202,
"lm_q2_score": 0.8397339596505965,
"openwebmath_perplexity": 660.5278213635348,
"openwebmath_score": 0.8692973256111145,
"tags": null,
"url": "https://web.forret.com/ruv2b6uq/67b03a-antisymmetric-matrix-eigenvalues"
} |
photons, universe, time-dilation, galaxies, gravitational-redshift
Title: Can a photon that is emitted from a denser part of the universe to a less dense part appear redshifted? Galaxy one is located in a dense area of the universe and galaxy two is located in a less dense part of the universe. Would galaxy one appear red-shifted to galaxy two? Is the mass density at our position in the universe less dense than most other positions? The answer to your question is yes, but the gravitational redshift could not be confused with cosmological redshift because it is small.
The basics of gravitational redshift can be grasped by the simple approximation that the redshift is given by
$$z \simeq \Delta \Phi /c^2,$$
where $\Delta \Phi$ is the difference in gravitational potential between where the photon was emitted and where it is absorbed/detected. This approximation is valid, where the ratio of gravitational potential energy to rest mass energy is small - so practically all circumstances except near black holes and neutron stars. | {
"domain": "physics.stackexchange",
"id": 35922,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "photons, universe, time-dilation, galaxies, gravitational-redshift",
"url": null
} |
special-relativity, fermions, noethers-theorem, classical-field-theory, poisson-brackets
for bosonic and fermionic particles, respectively. Since classical mechanics can be viewed as a one-dimensional classical field theory, one can also use functional derivative to re-write them as
$$\left\{f(t),g(t)\right\}_{PB}=\int ds\left\{\frac{\delta f(t)}{\delta q(s)}\frac{\delta g(t)}{\delta p(s)}-\frac{\delta f(t)}{\delta p(s)}\frac{\delta g(t)}{\delta q(s)}\right\}$$
$$\left\{\phi(t),\gamma(t)\right\}_{PB}=\int ds\left[\phi(t)\left(\frac{\overset{\leftarrow}{\delta}}{\delta\xi(s)}\frac{\overset{\rightarrow}{\delta}}{\delta\pi(s)}+\frac{\overset{\leftarrow}{\delta}}{\delta\pi(s)}\frac{\overset{\rightarrow}{\delta}}{\delta\xi(s)}\right)\gamma(t)\right].$$
The above Poisson super-bracket for "classical fermions" is $\mathbb{Z}_{2}$-graded. i.e. $$\left\{\phi,\gamma\right\}_{PB}=-(-1)^{\epsilon(\phi)\epsilon(\gamma)}\left\{\gamma,\phi\right\}_{PB},$$
where where $\epsilon(\,\,\cdot\,\,)$ means the parity of the Grassmann variable ($0$ when even and $1$ when odd). | {
"domain": "physics.stackexchange",
"id": 88806,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "special-relativity, fermions, noethers-theorem, classical-field-theory, poisson-brackets",
"url": null
} |
python, performance, algorithm, python-2.x, robotframework
This methodology seems very inefficient to me. By the end of the program, I've looped through my list of keywords once statically and around 4 or 5 for every iteration of the loop itself. This is why I'm looking for algorithm suggestions.
In addition, I'd like to get away from using \\ to delineate lines, but unless I figure out how the compiler takes Robot Framework's code and says "this is what it equates to in Python", that probably won't be happening.
Here's my code as it currently stands:
from robot.libraries.BuiltIn import BuiltIn
# TODO: Create new types of For Loops
# TODO: Expand While Loop
# TODO: Create Do-While Loops
class Loops(object):
def __init__(self):
self.selenium_lib = BuiltIn().get_library_instance('ExtendedSelenium2Library')
self.internal_variables = {} | {
"domain": "codereview.stackexchange",
"id": 28543,
"lm_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, algorithm, python-2.x, robotframework",
"url": null
} |
java, programming-challenge, time-limit-exceeded, interval
Execution time is limited. Some classes are restricted (e.g. java.lang.ClassLoader). You will see a notice if you use a restricted class when you verify your solution.
Third-party libraries, input/output operations, spawning threads or processes and changes to the execution environment are not allowed. You can make your current \$O(n^2)\$ algorithm run in \$O(n \log n)\$ time by first sorting the input intervals by interval start time, then do a linear scan of the sorted array:
public static int answer(int[][] intervals) {
if (intervals.length() < 1) {
return 0;
}
java.util.Arrays.sort(
intervals,
new java.util.Comparator<int[]>() {
public int compare(int[] a, int[] b) {
return Integer.compare(a[0], b[0]);
}
});
int totalTime = 0;
int currentIntervalEnd = intervals[0][0];
for (int[] interval : intervals) {
int intervalStart = interval[0];
int intervalEnd = interval[1]; | {
"domain": "codereview.stackexchange",
"id": 19717,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, programming-challenge, time-limit-exceeded, interval",
"url": null
} |
c++, c, makefile
#~~~~ compiler command for every source file ~~~~
%.o : %.c
@echo ==== compiling [opt=${opt}] $< ====
${CC} -o $@ $< -c ${BINFLAGS} ${CPPFLAGS} ${CFLAGS}
@${SKIP_LINE}
%.o : %.cpp
@echo ==== compiling [opt=${opt}] $< ====
${CXX} -o $@ $< -c ${BINFLAGS} ${CPPFLAGS} ${CXXFLAGS}
@${SKIP_LINE}
-include ${DEPEND_FILES}
#~~~~ remove all files ~~~~
clean :
@echo ==== cleaning ====
${REMOVE} ${GENERATED_FILES}
@${SKIP_LINE}
#~~~~ remove generated files ~~~~
clear :
@echo ==== clearing ====
${REMOVE} ${filter-out ${subst /,\,${EXE_FILES}},${GENERATED_FILES}}
@${SKIP_LINE} | {
"domain": "codereview.stackexchange",
"id": 43163,
"lm_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, makefile",
"url": null
} |
# Will the convergence of $\frac{1}{N}\sum_{n=1}^{N}a_n$ imply the convergence of $\sum_{n=1}^{N}\frac{a_n}{n^2}$?
Assume that we have a positive sequence $\{a_n\}$ with its Cesàro mean converges: $$\lim_{N\to\infty}\frac{1}{N}\sum_{n=1}^{N}a_n<\infty\,.$$ I am wondering if the following summation converges: $$\lim_{N\to\infty}\sum_{n=1}^{N}\frac{a_n}{n^2}$$
Any proof is appreciated!
• Squeeze theorem? Would this work? – Jihoon Kang Sep 26 '17 at 15:43
• Do you know summation by parts? – Daniel Fischer Sep 26 '17 at 15:52
• @JihoonKang Sorry but how? – Did Sep 26 '17 at 17:03
• @Did I was (probably) wrong - I thought it might be possible without thinking through the details. – Jihoon Kang Sep 27 '17 at 1:11
• @JihoonKang May I suggest to avoid at all cost such random comments? They are a (minor) plague of the site. – Did Sep 27 '17 at 8:10
Define $s_0=0, s_n = a_1 + \cdots + a_n, n>0.$ Summing by parts (note Daniel Fischer mentioned this in a comment) gives | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9883127440697254,
"lm_q1q2_score": 0.8439328579029641,
"lm_q2_score": 0.8539127548105611,
"openwebmath_perplexity": 504.1350469258439,
"openwebmath_score": 0.9079939126968384,
"tags": null,
"url": "https://math.stackexchange.com/questions/2446145/will-the-convergence-of-frac1n-sum-n-1na-n-imply-the-convergence-of"
} |
photons
1. We let this "continuous ripple" fall on the surface for some time and let the surface (rather the electrons) absorb some energy. If we wait for some more time, the surface will absorb some more energy and after a certain period of time, the electrons will gain enough energy to leave the surface. So, given any small amount of energy in the "continuous ripple", electrons will always be ejected.
2. Since absorption of energy takes time, there should be a time gap between the falling of the "continuous ripple" and the ejection of an electron.
But... Unfortunately, that is exactly what does not happen! Pretty sad.
So, what happens?
1. The ejection of electrons occurs above a certain energy of the "ripple". Given a "ripple" with less energy than the minimum value, even if you wait for a very very long amount of time, not a single electron will be ejected.
Strike 1 to "continuous ripple"
2. There is no detectable time lag between the falling of the ripple and the ejection of electrons. | {
"domain": "physics.stackexchange",
"id": 47684,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "photons",
"url": null
} |
ros, rosbag, buffer
Title: Rosbag Record Buffer
Hi,
I am using rosbag for recording 2 kinects pointcloud (with RGB, without 2d-image) for duration around 10 minutes.
I am recording in the same machine to which the kinects are attached.
When recording, usually it happens:
rosbag record buffer exceeded. Dropping oldest queued message.
Then, I set the record buffer to like 40 Gigabyte. It helps, but still I found on one or two videos while recording, the buffer exceeded ocassionally.
I am running on Debian Squeeze machine, 4 processor @3.1 GHz. Memory: 7.8GiB.
My questions are:
What does actually the buffer do?
and is there some solutions for the recording problem?
Best,
kang | {
"domain": "robotics.stackexchange",
"id": 6955,
"lm_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, rosbag, buffer",
"url": null
} |
c++, object-oriented, c++11, linked-list, pointers
if(position == getLength()){
popBack();
return;
}
current = head;
for(int i=1; i<position; i++){
previous = current;
current = current->next;
}
previous->next = current->next;
}
template <typename T>
int SingleLinkedList<T>::getLength(){
Node * current = head;
int len = 0;
while(current != nullptr){
len++;
current = current->next;
}
//std::cout << "The list length is: " << len;
return len;
}
template <typename T>
int SingleLinkedList<T>::getValue(int position){
Node * current = head; | {
"domain": "codereview.stackexchange",
"id": 30666,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, object-oriented, c++11, linked-list, pointers",
"url": null
} |
# Fourier Series Notes | {
"domain": "psicologicamenteonlus.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9793540704659681,
"lm_q1q2_score": 0.8006948933458974,
"lm_q2_score": 0.817574478416099,
"openwebmath_perplexity": 771.7534024236097,
"openwebmath_score": 0.8521015048027039,
"tags": null,
"url": "http://psicologicamenteonlus.it/fourier-series-notes.html"
} |
tree, formatting, clojure, ascii-art
Implementation notes
When printing a sparse string, one first needs to find the minimum occupied row and column in the sparse string. This naturally leads to the end-col, min-corner, and max-corner functions for calculating bounding boxes for sparse strings.
Now, how does one print a sparse string? This problem basically boils down to printing the whitespace to fill the gaps between sparse string entries. Once that's accomplished, the actual sparse-str implementation is quite straightforward.
Also, since I'm going to be combining sparse strings in addition to just creating and printing them, I'll need a function to shift the reference point of an existing sparse string.
All we need now is a way to convert from that logical representation of the tree to the textual one, which is the task of the tree-string function. | {
"domain": "codereview.stackexchange",
"id": 26826,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "tree, formatting, clojure, ascii-art",
"url": null
} |
machine-learning, svm, theory
Problem is the $a_n=0$ assumption, i.e. assuming misclassified points are not support vectors.
Here is the flow. Slack variable $\xi_n$ is defined as
$$\xi_n := |t_n - y(\boldsymbol{x}_n)|$$
where $t_n \in \{+1, -1\}$ is the true label, and $y(\boldsymbol{x}_n)$ is the prediction. Therefore, for a misclassified point (on the wrong side) we have $$\xi_n > 1$$ by definition. Given $\mu_n \xi_n = 0$, therefore$$\mu_n=0$$
and given $a_n=C - \mu_n$, therefore $$a_n = C > 0$$ which means (given $a_n > 0$ only for support vectors) | {
"domain": "datascience.stackexchange",
"id": 4908,
"lm_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, svm, theory",
"url": null
} |
# Limit points of irrationals
We know that the set of all limit points of $\Bbb Q$ is $\Bbb R$. This means that if $a \in \Bbb Q$, we can find a rational number as close to $a$ as we want. We also know that between every two rational numbers there exists an irrational number.
My question is:
1. Is $\Bbb R$ the set of all limit points of $\Bbb R \setminus \Bbb Q$ (of the irrational numbers)?
2. Can this be concluded only from the above?
• You have the first statement off, it means each real is a limit of rationals, so change to "if $a \in \mathbb{R}$." We can find a sequence of irrationals limiting to any real, so question 1 is "yes". – coffeemath Feb 6 '17 at 12:08
First observe the following simple fact:
If $a, b\in\mathbb{R}$ with $a<b$ then there are numbers $c, d$ with $c\in \mathbb{Q}, a<c<b$ and $d\in\mathbb{R} \setminus \mathbb{Q}, a<d<b$.
The following are then immediate consequences of the above statement: | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9736446456243804,
"lm_q1q2_score": 0.8070918281578299,
"lm_q2_score": 0.8289388040954683,
"openwebmath_perplexity": 147.19296961321282,
"openwebmath_score": 1.0000004768371582,
"tags": null,
"url": "https://math.stackexchange.com/questions/2131666/limit-points-of-irrationals"
} |
image-compression
Title: Loss in converting YUV to PNG I have a YUV 420NV12 image. I'm using ffmpeg to convert the YUV file to PNG and then back again to YUV.
ffmpeg -s 640x480 -pix_fmt nv12 -i testold.yuv test-640x480 test.png
ffmpeg -i test.png -s 640x480 -pix_fmt nv12 testnew.yuv
When I compare the two YUV files, there are few differences. I expected PNG to be a lossless compression. What is the reason for difference in two files? The PNG format is lossless for RGB24 image data. However the conversion from YUV to RGB24 is not lossless, as the two formats quantize the color space differently.
To see this, the following animated gif was made by applying your two ffmpeg operations 200 times back-and-forth and collating the resulting 200 images into the gif.
By contrast, the following gif was generated using yuv444p as the YUV format instead of nv12. This format does not do subsampling / as much quantization. | {
"domain": "dsp.stackexchange",
"id": 11538,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "image-compression",
"url": null
} |
quantum-mechanics, measurements, measurement-problem, schroedingers-cat, quantum-foundations
Could it be that a system is always in a superposition, and when we perform a measurement, we obtain a definite value due to the interaction, but after it, the system returns to a superposition?
How would the system you're observing know whether you're looking at it to flip back and forth between those two options?
You further ask:
For Wigner, who will check if superposition exists for him after his friend's measurement, he will find the system again in a superposition. | {
"domain": "physics.stackexchange",
"id": 98907,
"lm_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, measurements, measurement-problem, schroedingers-cat, quantum-foundations",
"url": null
} |
newtonian-mechanics, forces, rotational-dynamics, friction, free-body-diagram
So, in the first case the frictional force have the same direction with the acceleration of the center of mass but it's not in the latter one. Can someone explain the difference between those 2.
If the object want to slide, it first must rolls faster with very big acceleration. I can understand the first case, the force act ton the point P direct to the left to make the wheel rolling faster so the frictional force must direct to the right. In the second case, the object rolls to the left so the force acting on P must direct to the right so why the frictional force direct to the right. Isn't its direction must be to the left.
Also, in both cases above, considering accelerating object but not considering object which move very fast. If the object is rolling very fast at a direction, to which direction will the frictional force be? | {
"domain": "physics.stackexchange",
"id": 35405,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "newtonian-mechanics, forces, rotational-dynamics, friction, free-body-diagram",
"url": null
} |
The if clause only adds constant time to the computation, and so the upper bound of the running time is $O(n^2)$. It follows that maximal_subarray_brute_force runs in $\Theta(n^2)$ time. $\square$
4.1-3. Implement both the brute-force and recursive algorithms for the maximum-subarray problem on your own computer. What problem size $n_0$ gives the crossover point at which the recursive algorithm beats the brute-force algorithm? Then, change the base case of the recursive algorithm to use the brute-force algorithm whenever the problem size is less than $n_0$. Does that change the crossover point?
>>> import random
50 elements: | {
"domain": "markhkim.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.962673113726775,
"lm_q1q2_score": 0.8655599823803488,
"lm_q2_score": 0.8991213840277783,
"openwebmath_perplexity": 732.0085319858442,
"openwebmath_score": 0.9267470836639404,
"tags": null,
"url": "https://markhkim.com/clrs/ch04/"
} |
cell-biology, replication
hope my question was clear!
Thanks! The short answer is yes, there are single-celled organisms that can reproduce without another "partner". Probably the most famous example is that of bacteria.
What you're talking about is known as asexual reproduction. In bacteria, the process is known as binary fission, where one bacterium (known as the parent cell) divides into two organisms (known as daughter cells). These two cells will be genetically identical (barring any mutations) to the parent cell, because there has been no combination (for lack of a better term) of DNA, as there is in sexual reproduction. | {
"domain": "biology.stackexchange",
"id": 2830,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "cell-biology, replication",
"url": null
} |
optics, double-slit-experiment
Title: The path difference when a block covers one slit in Young's double slit experiment A modification of the simplest case of Young’s double slit experiment is when the path length for one of the slits is changed.
I've been told that if a strip of material of thickness $ t $ and refractive index $ n $ is placed over one slit then it adds a path difference of $(n − 1)t$, which results in the fringes being shifted. However, I am not sure how $(n − 1)t$ is derived and why this gives the path difference? Earlier that light had to travel the distance $t$ in vacuum with refractive index 1. Now the refractive index is $n$ so the path will be $n*t$ The additional path is $n*t - t$ which is $(n-1)*t$. So if the path difference between the two rays was some $x$, $(n-1)*t$ would be added to it. | {
"domain": "physics.stackexchange",
"id": 47550,
"lm_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, double-slit-experiment",
"url": null
} |
kolmogorov-complexity
Title: Kolmogorov Complexity: Why would you need more bytes than the string itself? I was reading Wikipedia's entry on Kolmogorov Complexity (thanks to this question), which states:
It can be shown that the Kolmogorov complexity of any string cannot be more than a few bytes larger than the length of the string itself. | {
"domain": "cs.stackexchange",
"id": 2120,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "kolmogorov-complexity",
"url": null
} |
python, parsing, data-mining
Code:
def parseFile(input, output, mode):
infile = open(input)
outfile = open(output, mode)
for line in infile:
if re.match("random seed", line):
tokens = re.search(r'random seed = (.*)', line, re.M|re.I)
seed = tokens.group(1)
#print seed
if re.match("input", line):
tokens = re.search(r'(.*)n = (.*), m = (.*), k = (.*) \[(.*) ms\] {peak:(.*)GiB} {curr:(.*)GiB}', line, re.M|re.L)
n = tokens.group(2).strip()
m = tokens.group(3).strip()
k = tokens.group(4).strip()
t = tokens.group(5).strip()
inPeak = tokens.group(6).strip()
inCurr = tokens.group(7).strip()
#print n, m, k, t, peak, curr | {
"domain": "codereview.stackexchange",
"id": 14834,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, parsing, data-mining",
"url": null
} |
newtonian-mechanics, kinematics, orbital-motion
If my argument is wrong, what is the logical basis to say that the relationships still hold even when the model does not take into account the change in the orbit's radius?
If my argument is right, any pointer to a better model that takes into account the change in the orbit's radius? The two relations that you give, are strictly valid only for circulation motion. You give an example of circular motion with variable radius, but, that is not circular motion anymore. Also, how would you define the centre of the motion, and thus angular velocity or cetripetal accelaration?
If you have a well-defined case, you can always derive similar relations. You then need to start from the basic principles that are always for classical mechanics, such as conservation of momentum, and conservation of angular momentum. In circular motion, there is only one force, directed towards the centre of the circle. For your case, you will have to make a free body diagram, and choose a smart origin. | {
"domain": "physics.stackexchange",
"id": 12943,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "newtonian-mechanics, kinematics, orbital-motion",
"url": null
} |
java, beginner, integer
// Current is positive and has less digits - Therefore it is smaller
else if (numberDigits.size() < other.numberDigits.size())
return -1;
// Both have same number of digits - need to iterate them
else
for (int index = 0; index < numberDigits.size(); index++) {
// Current has bigger positive digit - therefore it is bigger
if (numberDigits.get(index) > other.numberDigits.get(index))
return 1;
// Current has smaller positive digit - therefore it is smaller
else if (numberDigits.get(index) < other.numberDigits.get(index))
return -1;
}
// If we have reached here, the numbers are completely identical
return 0;
}
@Override
public boolean equals(Object o) {
// self check
if (this == o)
return true; | {
"domain": "codereview.stackexchange",
"id": 34004,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, beginner, integer",
"url": null
} |
frequency-modulation, chirp
$$SNR_q= 6.02 \text{ dB/bit} + 1.76 \text{ dB}$$
Where here bit represents the output data width and $SNR_q$ is the total noise due to quantization alone relative to the desired output tone.
This is depicted below with the addition of a "Phase Control Word" for optional phase modulation in addition to the frequency modulation capability provided by the "Frequency Control Word". An additional multiplier after the look-up table output could be used to provide amplitude modulation capability for a universal phase/frequency/amplitude modulator. | {
"domain": "dsp.stackexchange",
"id": 10733,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "frequency-modulation, chirp",
"url": null
} |
Interesting property related to the sums of the remainders of integers
Cross-posted on Math Overflow too
Let us define, $$r(b)=\sum_{k=1}^{\lfloor \frac{b-1}{2} \rfloor} (b \bmod{k})$$ After playing around with the $$r(b)$$ function for sometime I noticed that $$r(b)$$ appreared to be more even than odd. So to see the difference between the number of even and odd terms of $$r(b)$$, I defined a function, $$z(x)=\sum_{n=1}^x(-1)^{r(n)}$$ When user Peter ran a program for computing values of $$z(x)$$ in PARI, I observed that for $$x\le 10^{10}$$, $$z(x)\gt 0$$. This suggests that there are always more even terms of $$r(n)$$ than odd terms for any $$x$$.
This leads to my two questions: | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9840936101542134,
"lm_q1q2_score": 0.8532443645209306,
"lm_q2_score": 0.8670357735451835,
"openwebmath_perplexity": 582.2596203755722,
"openwebmath_score": 0.9025372266769409,
"tags": null,
"url": "https://math.stackexchange.com/questions/3587292/interesting-property-related-to-the-sums-of-the-remainders-of-integers"
} |
ros
Title: subscriber and if-else/switch-case statement
Hi there, I am new to ROS and having a bit of problems when using subscriber. I am writing a leader following function and trying to subscribe to a rostopic under a conditional statement, switch statement in this case, but it doesn't work. Key lines of the problem are shown below:
main(int argc, char **argv)
{
ros::init(argc, argv, "mycontrol_1");
ros::NodeHandle n;
ros::Subscriber h_sub = n.subscribe("/uav1/sonar_height",1000,hcontrol);
switch (squad_leader_no){
case 1:
{ros::Subscriber splitcmd_sub = n.subscribe("/uav1/split_cmd", 1000, getsplitcmd);
break;}
case 2:
{ros::Subscriber splitcmd_sub = n.subscribe("/uav2/split_cmd", 1000, getsplitcmd);
break;}
case 3:
{ros::Subscriber splitcmd_sub = n.subscribe("/uav3/split_cmd", 1000, getsplitcmd);
break;}
case 4:
{ros::Subscriber splitcmd_sub = n.subscribe("/uav4/split_cmd", 1000, getsplitcmd); | {
"domain": "robotics.stackexchange",
"id": 18989,
"lm_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
} |
java, tex, ant
<!-- target: main -->
<target name="main" depends="foo, bar" description="default target" />
</project> The bar and foo targets (as well as the conditions on foo.uptodate and bar.uptodate) seems really similar to each other. I'd try to remove this duplication with a presetdef or a macrodef
Reply for the edit:
Nice to see that the macrodef works :-). A few other ideas:
<attribute name="basename" default="unknown" />
Are you sure that you need the default attribute here? The macrodef documentation says the following:
The attributes will be required attributes unless a default value has been set.
I'd create a list for
<srcfiles file="@{basename}.dtx" />
<srcfiles file="@{basename}.ins" />
Here is an example: Ant: using Filelist as Fileset in Uptodate?
After this I guess the three uptodate tag could be replaced with only one which uses a composite or a chained mapper but I'm not too familiar with these. | {
"domain": "codereview.stackexchange",
"id": 2078,
"lm_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, tex, ant",
"url": null
} |
Finally, observing that $$E[W_T e^{W_T}]$$ corresponds to the derivation of $$E[e^{\lambda W_T}]$$ evaluated in $$\lambda=1$$, we can conclude that $$E[W_T e^{W_T}] = Te^{T/2}$$
• I like those derivation under summation / integration tricks very much, eg wenn calculating various integer sums or such. Your ‘trick‘ somehow eluded me til today. +1! Aug 14 at 17:11
• Nice. Richard Feynman apparently likes these type of tricks where you differentiate wrt a parameter evaluated at 1 or 0. Aug 15 at 7:38
• Very nice solution!! Aug 15 at 9:20 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9748211612253742,
"lm_q1q2_score": 0.8185904473513934,
"lm_q2_score": 0.8397339736884712,
"openwebmath_perplexity": 1143.9944661231998,
"openwebmath_score": 0.9983028769493103,
"tags": null,
"url": "https://quant.stackexchange.com/questions/66429/how-to-compute-ewt-expwt"
} |
electromagnetism
Title: Force on a magnet in a magnetic field I was wondering what happens when i put a wire in which current flows parallel to a magnet, something like this:
where the straight line is the wire, the circle is a cylindrical magnet(with outgoing magnetic field) and the red line is a line force for the magnetic field of the wire.
In particular i was wondering if the force on the magnet is directly proportional to the magnetic field produced by the wire.
Thanks.
In particular i was wondering if the force on the magnet is directly proportional to the magnetic field produced by the wire. | {
"domain": "physics.stackexchange",
"id": 14498,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electromagnetism",
"url": null
} |
+0
# What is the distance between the two intersections of $y=x^2$ and $x+y=1$?
0
103
1
What is the distance between the two intersections of $y=x^2$ and $x+y=1$?
Feb 26, 2020
#1
+25235
+1
What is the distance between the two intersections of $$y=x^2$$ and $$x+y=1$$?
$$\begin{array}{|lrcll|} \hline & \text{intersections:} \\ \hline (1) & y &=& x^2 \\ \\ (2) & x+y &=& 1 \quad | \quad y = x^2 \\ & x+x^2 &=& 1 \\ & \mathbf{x^2+x-1} &=& \mathbf{0} \\ & x &=& \frac{-1\pm \sqrt{1-4(-1)} }{2} \\ & x &=& \frac{-1\pm\sqrt{5} }{2} \\ & \mathbf{x_1 = \dfrac{-1+\sqrt{5} }{2}} && \mathbf{x_2 = \dfrac{-1-\sqrt{5} }{2}} \\ \hline \end{array}$$ | {
"domain": "0calc.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9890130586647622,
"lm_q1q2_score": 0.8108852072256916,
"lm_q2_score": 0.8198933271118221,
"openwebmath_perplexity": 351.5797341805179,
"openwebmath_score": 0.9956175684928894,
"tags": null,
"url": "https://web2.0calc.com/questions/what-is-the-distance-between-the-two-intersections"
} |
sampling, finite-impulse-response
I want to clarify that this is not asking about multirate filters or changing sample rates, I should still get N filtered samples out per clock cycle. Transposing the FIR filter lends itself well to parallel processing as each input can be applied to all multipliers at the same time. Below shows a typical FIR filter in Direct Form where the input is sequenced through a shift register and then applied to each multiplier with the output of the multipliers summed. The filter is transposed by changing summing nodes to branch nodes, branch nodes to summing nodes, and changing direction of all signal flows as shown in the lower diagram. This structure if used directly with a register after each summation will extend the maximum clock frequency, as delays can otherwise accumulate in the larger adder trees of the Direct Form structure causing timing issues at the higher rates. Below shows how it can be used in parallel form with all operations done at a lower frequency. | {
"domain": "dsp.stackexchange",
"id": 11985,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "sampling, finite-impulse-response",
"url": null
} |
homework-and-exercises, newtonian-gravity, orbital-motion, unit-conversion, galaxy-rotation-curve
Title: Express the total mass of the galaxy in solar masses I have the following problem:
"The Sun has an orbital speed of about 220 km s−1 around the center
of the Galaxy, whose distance is 28 000 light years. Estimate the total
mass of the Galaxy in solar masses."
I know how to solve it in two different ways, considering the galaxy mass as the total mass inside the sphere that the sun is orbiting:
using that the gravitational force is equal to the centripetal force;
by Kepler's third law | {
"domain": "physics.stackexchange",
"id": 60832,
"lm_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-gravity, orbital-motion, unit-conversion, galaxy-rotation-curve",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.