text stringlengths 1 1.11k | source dict |
|---|---|
parallelograms. Remember a square is a special rectangle with all side lengths equivalent however we have no information regarding the side lengths of this problem. Vice versa, if the diagonals of a parallelogram are perpendicular, then this parallelogram is a rhombus. The diagonals meet each other at 90°, this means that they form a perpendicular bisection. If the diagonals of a parallelogram are perpendicular then the parallelogram is from SCI 102 at Cristóbal Colón University Is this statement true? These angles are said to be congruent with each other. Therefore, parallelogram ABCD is rhombus. Back to Basic Ideas page. The diagonals of a parallelogram bisect each other. Consecutive angles are supplementary. c.square. One pair of diagonally opposite angles is equal in measurement. Proof: Rhombus diagonals are perpendicular bisectors. Answer. Yes, because the diagonals of a rhombus, which is a parallelogram, are perpendicular. Since the diagonals of a parallelogram bisect each other, | {
"domain": "thinkandstart.com",
"id": null,
"lm_label": "1. Yes\n2. Yes\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9838471632833943,
"lm_q1q2_score": 0.8681741653815287,
"lm_q2_score": 0.8824278788223264,
"openwebmath_perplexity": 404.38305370460273,
"openwebmath_score": 0.6866893172264099,
"tags": null,
"url": "https://thinkandstart.com/menace-ii-oqcpwq/if-the-diagonals-of-a-parallelogram-are-perpendicular-3f40df"
} |
ros, ekf, ros-melodic
Originally posted by Rahulwashere on ROS Answers with karma: 23 on 2023-02-09
Post score: 0
I solved this issue by turning off the Publish tf from odom to baselink in my controller node, since i am using arduino to directly publish velocity values instead of using differential drive controller. I have my own controller.cpp node to do it.
anyway the values don't jump around any more.
Originally posted by Rahulwashere with karma: 23 on 2023-03-01
This answer was ACCEPTED on the original site
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 38269,
"lm_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, ekf, ros-melodic",
"url": null
} |
gazebo, urdf, plugin
<!-- kinematics -->
<wheel_separation>0.6855600</wheel_separation>
<wheel_diameter>0.4064000</wheel_diameter>
<!-- limits -->
<max_wheel_torque>20</max_wheel_torque>
<max_wheel_acceleration>1.0</max_wheel_acceleration>
<command_topic>cmd_vel</command_topic>
<!-- output -->
<publish_odom>true</publish_odom>
<publish_odom_tf>true</publish_odom_tf>
<publish_wheel_tf>true</publish_wheel_tf>
<odometry_topic>odom</odometry_topic>
<odometry_frame>odom</odometry_frame>
<robot_base_frame>base_footprint</robot_base_frame>
</plugin>
</gazebo>
Originally posted by Youssef_Lah with karma: 195 on 2021-07-20
This answer was ACCEPTED on the original site
Post score: 2 | {
"domain": "robotics.stackexchange",
"id": 36732,
"lm_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, urdf, plugin",
"url": null
} |
c++, sdl
auto operator()(SDL_Renderer* p) noexcept
{
if (p)
SDL_DestroyRenderer(p);
}
auto operator()(TTF_Font* p) noexcept
{
if (p)
TTF_CloseFont(p);
}
// and any more you need
};
int main()
{
try
{
auto const sdl = sdl{};
auto const img = sdl_image{};
auto const ttf = sdl_ttf{};
auto const window = std::unique_ptr<SDL_Window, sdl_deleter>{
SDL_CreateWindow("HiLo", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN)
};
auto const renderer = std::unique_ptr<SDL_Renderer, sdl_deleter>{
SDL_CreateRenderer(gWindow, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC)
};
// and so on, loading the font and all the textures, etc.
// Main game logic goes here. | {
"domain": "codereview.stackexchange",
"id": 31380,
"lm_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++, sdl",
"url": null
} |
scala, exception
And here is my first pass at the Scala version as a Factory (using both object and class):
package org.lwjgl.examples.spaceinvaders
import java.io.IOException
import org.lwjgl.opengl.GL11._
object SpriteNew {
def create (textureLoader: TextureLoader, resourceName: String): SpriteNew = {
def load: Texture = {
var texture: Texture = null
try {
texture = textureLoader.getTexture(resourceName)
}
catch
{
case ioe: IOException => {
println(ioe.getStackTraceString)
System.exit(-1)
}
}
texture
}
val texture = load
new SpriteNew(texture)
}
}
class SpriteNew (val texture: Texture) {
val width = texture.getImageWidth()
val height = texture.getImageHeight()
def draw(x: Int, y: Int) {
glPushMatrix
texture.bind()
glTranslatef(x, y, 0)
glBegin(GL_QUADS)
glTexCoord2f(0, 0)
glVertex2f(0, 0) | {
"domain": "codereview.stackexchange",
"id": 897,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "scala, exception",
"url": null
} |
(((((*) where the second time derivative is included to cover also Newton’s equation. Stack Exchange network consists of 176 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers. We study the limit of this family of nonlocal diffusion operators when a rescaling parameter related to the kernel of the nonlocal operator goes to zero. Two-Dimensional Laplace and Poisson Equations In the previous chapter we saw that when solving a wave or heat equation it may be necessary to first compute the solution to the steady state equation. Laplace equation. In mathematics, the Neumann (or second-type) boundary condition is a type of boundary condition, named after Carl Neumann. The Dirichlet boundary condition is obtained by integrating the tangential component of the momentum equation along the boundary. The Matlab code for the 1D heat equation PDE: B. First we derive the equa-tions from basic | {
"domain": "danieledivittorio.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9865717460476701,
"lm_q1q2_score": 0.8019519313003395,
"lm_q2_score": 0.8128673201042492,
"openwebmath_perplexity": 606.8482181438628,
"openwebmath_score": 0.8299397826194763,
"tags": null,
"url": "http://danieledivittorio.it/vube/neumann-boundary-condition-heat-equation.html"
} |
### Simulation runs
max_iterations <- 1000
max_generations <- 100
Finally let's simulate Bobo offspring over time. How many runs resulted in the offspring dying off within {r} max_generations out of {r} max_iterations?
is_extinct <-function(generations) {
next_offs <- 0 # offspring of the next generation
while (offs <= generations) { # loop through generations
if (offs == 0) { # lineage died out
break
}
next_offs <- 0 # offspring of the current generation
for (j in 1:offs) {
next_offs <- next_offs + offspring(p)
}
offs <- next_offs
}
return(as.integer(offs < generations)) # TRUE if the lineage dies out
}
# count the number of times Bobo's lineage died off. Do it for 10 runs of
# max_iterations each
res <- replicate(10,
sum(replicate(max_iterations, is_extinct(max_generations)))
/ max_iterations)
Results suggest that Bobo's lineage will go extinct with $$P(X) = \frac{1}{2}$$.
summary(res) | {
"domain": "nowave.it",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9899864281950694,
"lm_q1q2_score": 0.818433460385474,
"lm_q2_score": 0.8267117983401363,
"openwebmath_perplexity": 1902.8446622298393,
"openwebmath_score": 0.7684544920921326,
"tags": null,
"url": "http://nowave.it/pages/bobo-the-amoeba.html"
} |
postoperatively [61]. Finding Maxima and Minima using Derivatives. The TRIPOD Statement is a checklist of 22 items considered essential for good reporting of studies developing or validating multivariable prediction models. For example, say $z=y \times \sin(x)$ Now if you take the partial derivativ. A course in multivariable calculus. 50 and LR− 0. After the first derivative, calculate the second derivative of the function. Thus, you should check the x- and y- difference of your function. The critical number in this example is x =-3, so we can check x = -2. edu Office Phone: 1. To calculate the minimum slope, l'Hospital's rule for multivariate functions is used with (n B , n C ) → (n B ,n C ). f (x, y) = 4 + 2 x 2 + 3 y 2. A point satisfying is called a critical point if and , or if one (or BOTH) do not exist at. Let z=f(x,y). Those subtotals will then be scaled to a score out of the appropriate number of points. Let g(x,y) = 3x2y + y3 − 3x2 − 3y2 + 1. Apply multivariable optimisation | {
"domain": "albertocoralloboutique.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9871787872422175,
"lm_q1q2_score": 0.8183108116685095,
"lm_q2_score": 0.8289388125473628,
"openwebmath_perplexity": 636.6303380044121,
"openwebmath_score": 0.5679125785827637,
"tags": null,
"url": "http://albertocoralloboutique.it/gxvp/multivariable-critical-points-calculator.html"
} |
coherence, correlation, wavelet
Title: Is a wavelet-based correlation measure worth any additional computational overhead? I have used both correlation and coherence as measures of correlation between signals. I was thinking that a time-frequency approach would give me the best of these worlds.
My question is whether this extra data adds enough to the overall picture of the signal to justify the increased computational cost associated with doing the wavelet transforms as part of the calculation?
Reference: an ArXiv paper: "A cross-correlation technique in wavelet domain for detection of stochastic gravitational waves" by S.Klimenko, G.Mitselmakher, A.Sazonov First off, you should use whichever tool is appropriate for the job. Correlation vs coherence vs wavelet-based correlation are all different things, so this question is kind of like asking "Which is better? Screwdrivers or hammers?" It depends on what you're trying to do, and whether you care about similarity in time, frequency spectra, or both. | {
"domain": "dsp.stackexchange",
"id": 5351,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "coherence, correlation, wavelet",
"url": null
} |
rviz, pcl, pcl-ros
(0) : fatal error C9999: *** exception during compilation ***
"""
I suspect it to be caused by NaNs in my pointcloud but then again this
was not the problem for diamondback version of pcl_ros.
Can anyone confirm if my guess is right and what would would the
action to rectify the problem be?
D. | {
"domain": "robotics.stackexchange",
"id": 5707,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "rviz, pcl, pcl-ros",
"url": null
} |
newtonian-mechanics, rotational-dynamics, energy-conservation, potential-energy
The bicycle turn case
You'd have already observed the analogy and the connection between the above example and the bicycle turning case. In the turning case, the friction is almost always acting along the center of curvature of the turning circle, so we can safely conserve the angular momentum of the cyclist about the center of curvature (in reality, there would be a tangential component of friction which would reduce the angular momentum and the rotational kinetic energy, however it's negligible for a fully inflated tire and we can ignore it). And again, in this case as you lean, you get closer to the axis passing through the center of curvature, and the moment of inertia of the system decreases, so the final angular velocity increases and so does the final rotational kinetic energy. And thus, you speed up while turning around the circle.
Difference | {
"domain": "physics.stackexchange",
"id": 66878,
"lm_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, rotational-dynamics, energy-conservation, potential-energy",
"url": null
} |
control-engineering, control-theory
Actually when you compute a continuous system on a program like MATLAB, it actually works with discrete system with some tolerance so that you couldn't notice. No computer (discrete system) could handle the information in a continuous model since it is actually infinite (but redundant).
Also, discrete formulation allows you to make finite matrix description, numeric approximations instead of analytics solutions (some times handle with convolutions in continuous time is not easy, in contrast in discrete time is a common matrix multiplication), and there is a lot of tools in linear algebra to use with this sort of formulations.
Then main reason is the need of improve result with the limitations of the actual devices and their limits with information.
what are the disadvantages of choosing a too small sampling time above all on the control effort? | {
"domain": "engineering.stackexchange",
"id": 4212,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "control-engineering, control-theory",
"url": null
} |
python, autoencoder, accuracy
Thank you all What kind of color are you trying to learn? If it's a random color, then yep, tough luck, you can't reduce the dimensionality of a 3D Euclidian manifold to less than 3D.
To be more precise, this is the case for an infinite manifold, for non-infinite one, you could get a 1D curve that goes through a 3D cube (in philosophy, it would be close to a Kohonen map, despite having just one node instead of a set of discrete nodes), but you would need a very big set of intermediate layers to make it happen. | {
"domain": "datascience.stackexchange",
"id": 4573,
"lm_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, autoencoder, accuracy",
"url": null
} |
reference-request, functional-programming, ct.category-theory, parsing
The calculus presented here is formally identical with a calculus constructed by G.D. Findlay and the present author for a discussion of canonical mappings in linear and multilinear algebra. | {
"domain": "cstheory.stackexchange",
"id": 3134,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "reference-request, functional-programming, ct.category-theory, parsing",
"url": null
} |
cc.complexity-theory, lo.logic, sat, boolean-functions, resolution
Question: Is $F_{|I}$ closed under resolution ? Sure. If $C_1\ni x_i$ and $C_2\ni\neg x_i$ are in $F\restriction I$ (in particular, $x_i$ is unset by $I$), pick clauses $D_1,D_2$ in $F$ which restrict to $C_1$ and $C_2$, respectively. Then $x_i\in D_1$ and $\neg x_i\in D_2$, hence their resolvent $(D_1\let\bez\smallsetminus\bez\{x_i\})\cup(D_2\bez\{\neg x_i\})$ is subsumed by some $D\in F$. If $D$ contains a literal made true under $I$, then so does $D_1$ or $D_2$, contradicting their choice. Thus, $D\restriction I$ is in $F\restriction I$, and it subsumes $(C_1\bez\{x_i\})\cup(C_2\cup\{\neg x_i\})$. | {
"domain": "cstheory.stackexchange",
"id": 1951,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "cc.complexity-theory, lo.logic, sat, boolean-functions, resolution",
"url": null
} |
electromagnetism, astrophysics, stars, plasma-physics, solar-wind
No, generally they do not alter the macroscopic charge state of the sun. They consist of plasmas, which as I said before, are quasi-neutral.
Are there such processes that will leave a star with overall charge? | {
"domain": "physics.stackexchange",
"id": 30416,
"lm_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, astrophysics, stars, plasma-physics, solar-wind",
"url": null
} |
navigation, mapping, gps, rviz, gps-common
Originally posted by ghaith on ROS Answers with karma: 89 on 2017-07-11
Post score: 1
1- What are the options of using the GPS with RVIZ or any other tool, and is it necessary to convert longitude and latitude to UTM system.
Yes, you must use a cartesian coordinate system for transforms and therefore with rviz. UTM is a decent approximation for this and I've seen many people use it in the past.
2- If GPS is connected to a frame like base link and base link is provide The GPS data as an odometer after changing it to UTM then base link and odometer must be at the same coordination. When I view it, but its not at the same coordination. note that I am subscribing to odom and publish the GPS with IMU data as an odom1. but odom1 and odom not in the same x and y pose, I don't know why. | {
"domain": "robotics.stackexchange",
"id": 28325,
"lm_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, mapping, gps, rviz, gps-common",
"url": null
} |
gazebo, gazebo-sensor, contact, collision
Title: The order of collision1~2 objects from contact sensor
From contact sensor, we can get contact objects (gazebo::physics::Contact).
The contact object includes followings.
std::string collision1
Name of the first collision object.
std::string collision2
Name of the second collision object.
How does Gazebo decide the order ?
And, how about following?
Assumption:
(1) There is a contact between link_1 and link_2,
(2) link_1 has contact sensor.
Among the resulted contact objects from sensor, if the objects' elements are like following,
(1) collision1 specifies link_1
(2) collision2 specifies link_2
wrench(i).body_1_force in those objects are forces from link_2 to link_1.
Am I right?
The '1,2' things make me really confused. I really need help.
Thanks. | {
"domain": "robotics.stackexchange",
"id": 2941,
"lm_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, gazebo-sensor, contact, collision",
"url": null
} |
physical-chemistry
Title: Error propagation I have a question regarding finding the error associated with the $r_\mathrm e$ term in the equation
$$r_\mathrm e=\sqrt{\frac h{8\tilde B_\mathrm e\pi^2\tilde c\mu}}$$
Is there anyway I can find the uncertainty of $r_\mathrm e$ using any formula. $h$, $\pi$ and $\tilde c$ and $\mu$ all are constant. Only $\tilde B_\mathrm e$ have an uncertainty. Any readings that I could tap into? If the individual uncertainties of $h$, $\tilde B_\mathrm e$, $\pi$, $\tilde c$, and $\mu$ are not correlated, the total uncertainty of $r_\mathrm e$ may be estimated using the general formula:
$$u(r_\mathrm e) = \sqrt{\left(\frac{\partial r_\mathrm e}{\partial h}\right)^2 u^2(h)+\left(\frac{\partial r_\mathrm e}{\partial \tilde B_\mathrm e}\right)^2 u^2(\tilde B_\mathrm e)+\left(\frac{\partial r_\mathrm e}{\partial \pi}\right)^2 u^2(\pi)+\left(\frac{\partial r_\mathrm e}{\partial \tilde c}\right)^2 u^2(\tilde c)+\left(\frac{\partial r_\mathrm e}{\partial \mu}\right)^2 u^2(\mu)}$$ | {
"domain": "chemistry.stackexchange",
"id": 5313,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "physical-chemistry",
"url": null
} |
beginner, c, linux, unix
/*
*This function will fork the parent process to create a
*child process then execute commands using one of the exec
*familie's functions. Return -1 for fork failure, 1 for execv()
*failure, otherwise 0.
*/
int exec_command(const char *prog_name, char *commands[]) {
char prog_path[strlen("/usr/bin/")+strlen(prog_name)];
int status;
pid_t pid;
pid_t ret; | {
"domain": "codereview.stackexchange",
"id": 40913,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "beginner, c, linux, unix",
"url": null
} |
c#
public Square(int row, int column, PieceBase piece)
{
this.row = row;
this.column = column;
this.piece = piece;
}
public string GetDisplayCoordinates()
{
// 0 + 65 is the start of ascii uppercase characters
// 65 + 32 is the start of ascii lowercase characters
char rowCoordinate = Convert.ToChar(row + 65 + 32);
return rowCoordinate + column.ToString();
}
}
public class Queen : PieceBase
{
public Queen() : base(PieceType.QUEEN)
{
}
internal override bool IsValidMove(int sourceColumn, int sourceRow, int destColumn, int destRow)
{
bool isDiagonalMove = this._IsDiagonalMove(sourceColumn, sourceRow, destColumn, destRow);
bool isVerticalMove = this._IsVerticalMove(sourceColumn, sourceRow, destColumn, destRow);
bool isHorizontalMove = this._IsHorizontalMove(sourceColumn, sourceRow, destColumn, destRow); | {
"domain": "codereview.stackexchange",
"id": 37437,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#",
"url": null
} |
java, beginner, game, number-guessing-game
} Unused imports - Warnings
You're using Eclipse. Eclipse and NetBeans are IDE's that will probably (aside from turning them off) give you warnings about your code.
An unused import is such a thing.
In Main, you don't use java.util.Random. So you should remove it.
Your IDE will give you other warnings from time to time. If you look at the warnings it gives you, it will help in both debugging ("hey, you're calling a function on a null variable here!") and in cleaning up your code ("Use String.isEmpty() instead of string == """ - I know NetBeans even just allows you to click a button and it will fix it for you).
Duplicate Code - Refactoring
Whenever you can, try to not state things multiple times.
Take this function.
public boolean guess(int guess) {
tries++;
if (guess == randomNumber) {
if (tries > 1) {
System.out.println("You got the number in " + tries + " tries.");
return true;
} else { | {
"domain": "codereview.stackexchange",
"id": 10364,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, beginner, game, number-guessing-game",
"url": null
} |
php, reflection
$moduleMethod->invokeArgs($module, $argumentArray);
}
}
private function KernelModuleLoad(String $moduleName) {
$moduleNamespace = "\Qobox\\" . $moduleName;
try {
$kernelModuleReflection = new \ReflectionClass($moduleNamespace);
} catch (\ReflectionException $e) {
// The needed kernel module does not exist. Try to connect same module component
// Module components should not have same names as Kernel Modules!!!
$moduleNamespace = "\Modules\\" . $moduleName; | {
"domain": "codereview.stackexchange",
"id": 18065,
"lm_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, reflection",
"url": null
} |
gazebo, catkin-make, catkin, ros-kinetic
Originally posted by mohamed ahmed on ROS Answers with karma: 65 on 2018-10-10
Post score: 2
The gazebo_ros package doesn't seem to be installed, check if rospack find gazebo_ros return a path and if not install the package : sudo apt-get install ros-kinetic-gazebo-ros.
Originally posted by Delb with karma: 3907 on 2018-10-10
This answer was ACCEPTED on the original site
Post score: 6
Original comments
Comment by mohamed ahmed on 2018-10-10:
thank you my friend, it works like magic
Comment by Abdel_Meguid on 2021-05-23:
Thank you for your solution ...i wish for you a happy day | {
"domain": "robotics.stackexchange",
"id": 31885,
"lm_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, catkin-make, catkin, ros-kinetic",
"url": null
} |
c, memory-management, c11
Note: My library does not have aligned_alloc( alignment, size ).
Sample usage:
#include <stdio.h>
#include <stdint.h>
#include <assert.h>
int main()
{
struct memory_resource mr;
size_t align = 32;
size_t size = 4000;
if ( memory_resource_initialize( &mr, align, size ) )
fprintf( stderr, "unable to allocate memory." );
assert( (uintptr_t)mr.aligned_ptr % align == 0 );
assert( mr.size == size );
if ( memory_resource_resize( &mr, size * 2 ) )
fprintf( stderr, "unable to allocate memory." );
assert( (uintptr_t)mr.aligned_ptr % align == 0 );
assert( mr.size == size * 2 );
align = 64;
if ( memory_resource_realign( &mr, align ) )
fprintf( stderr, "unable to allocate memory." );
assert( (uintptr_t)mr.aligned_ptr % align == 0 );
if ( memory_resource_resize( &mr, 1024 ) )
fprintf( stderr, "strange" ); | {
"domain": "codereview.stackexchange",
"id": 21650,
"lm_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, memory-management, c11",
"url": null
} |
c++, circular-list, winapi
#define RETURN_SAFE_FALSE RETURN_UNLOCK_FALSE(hnd_Mutex)
#define RETURN_SAFE_TRUE RETURN_UNLOCK_TRUE(hnd_Mutex)
ComLib::ComLib(const std::string& secret, const size_t& buffSize, TYPE type)
{
//Initialize POD members
this->type = type;
this->head = this->tail = 0;
this->ringBufferSize = buffSize;
//Convert string to wide string
std::wstring widestr = std::wstring(secret.begin(), secret.end());
//Initialize ring buffer
this->ringBuffer.Init(widestr.c_str(), buffSize);
this->pRingBuffer = (PVOID)ringBuffer.GetBuffer(); //Not used
//ringBufferData holds space for head and tail (size_t)
//File Map is called RBD (RingBufferData)
this->ringBufferData.Init(L"RBD", sizeof(size_t) * 2); | {
"domain": "codereview.stackexchange",
"id": 27506,
"lm_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++, circular-list, winapi",
"url": null
} |
rviz, 3dmapping, xml, ros-kinetic, scan
<link name="left_wheel">
<visual>
<geometry>
<cylinder length="0.05" radius="0.035"/>
</geometry>
<material name="black"/>
</visual>
<collision>
<geometry>
<cylinder length="0.05" radius="0.035"/>
</geometry>
</collision>
<inertial>
<mass value="0.1"/>
<inertia ixx="5.1458e-5" iyy="5.1458e-5" izz="6.125e-5" ixy="0" ixz="0" iyz="0"/>
</inertial>
</link>
<joint name="left_wheel_joint" type="continuous">
<axis xyz="0 0 1"/>
<parent link="base_link"/>
<child link="left_wheel"/>
<origin rpy="-1.5708 0 0" xyz="-0.2825 0.125 -.15"/>
</joint> | {
"domain": "robotics.stackexchange",
"id": 33535,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "rviz, 3dmapping, xml, ros-kinetic, scan",
"url": null
} |
python, python-3.x, image
# parse args to int if necessary
mnist_string = args.numberstring
min_margin = int(args.minmargin)
max_margin = int(args.maxmargin)
width = int(args.width)
n = int(args.genn)
str_len = int(args.strlen)
char_string = args.numberstring
# load images and idx data
images, id_dict = load_data_and_dict()
# create output dir if not exist
out_dir = args.outputdir
os.makedirs(out_dir, exist_ok=True)
# main program loop
for i in range(n):
# generate a new string per loop if one wasn't provided
if char_string is None:
gen_arr = np.random.randint(0, 9, str_len)
else:
gen_arr = [int(x) for x in char_string]
# run the generator
mnist_ocr_image = create_digit_sequence(gen_arr, width, min_margin, max_margin, images, id_dict)
np.save(os.path.join(out_dir, "mnist_ocr_image_{:0>6}".format(i)), mnist_ocr_image) | {
"domain": "codereview.stackexchange",
"id": 37071,
"lm_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
} |
javascript, functional-programming
It's always possible to break away from loop execution interfering keywords like continue and break. It is also almost always possible to quickly rewrite the code in a "more functional" way. Question is, what exactly is the motivation.
First, in functional world it all about function. And even though my code below does not use function composition, I'm adding getPosition(), isCloseToTop(), and isScrollAfterPosition() to simplify a few conditions. Another benefit of that is that these local functions' names are replacing the ugly comments.
Second, nav.positions.findIndex(...) is used to find out whether there's an item close to top. This is made as an independent step in the code and IMO it's more expressive this way.
If there's no item close to the top of window, we can try to find the last position before the scroll. Again, now it's implemented as a dedicated step (via map() and filter()).
Hopefully, it's now closer to what you wanted the code to be. | {
"domain": "codereview.stackexchange",
"id": 30690,
"lm_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, functional-programming",
"url": null
} |
java, strings, programming-challenge, stack
public static void main(String[] args) {
String fileName = "Brackets.txt";
Path filein = Paths.get(fileName);
ParentStack s = new ParentStack();
if (!Files.exists(filein) ||
!Files.isReadable(filein) ||
Files.isDirectory(filein)) {
System.err.println("Invalid input file !!!");
System.exit(1);
}
try (BufferedReader br = Files.newBufferedReader(filein);){
String line;
char[] arrLineChar = null;
char expected;
int lineNumber = 0;
boolean error = false;
read: while ( (line = br.readLine()) != null) {
int charNumber = 0;
lineNumber++;
arrLineChar = line.toCharArray();
for (char lineChar : arrLineChar) {
charNumber++;
if(lineChar == '(' || lineChar == '{' || lineChar == '['){
s.push(lineChar); | {
"domain": "codereview.stackexchange",
"id": 18519,
"lm_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, strings, programming-challenge, stack",
"url": null
} |
black-hole, singularity
The answer here, technically, is no. The reason being that once it requires a speed greater than or equal to the speed of light to escape your object, it is necessarily a black hole. That is the definition of a black hole. So that means this neutron star you propose is actually a black hole. Another equivalent definition of a black hole is any object whose mass is concentrated inside that object's event horizon. | {
"domain": "astronomy.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": "black-hole, singularity",
"url": null
} |
# New paper on genomics | {
"domain": "wordpress.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9820137916170774,
"lm_q1q2_score": 0.8118423876625699,
"lm_q2_score": 0.8267117983401363,
"openwebmath_perplexity": 534.3191859509956,
"openwebmath_score": 0.7642651200294495,
"tags": null,
"url": "https://sciencehouse.wordpress.com/category/statistics/"
} |
This shows that $C_k \sim c_{k,1} \to \log 2$
For the more general case, we start from $x_1 = a^{1/k} = 1 + \log(a)/k + \ldots$, while $\alpha = 1 + \log(a+1)/k + \ldots$, which are again close to each other.
$\alpha - a^{1/k} \sim \log(\frac{a+1}a)/k$
$f'(\alpha) = \alpha/k(a+\alpha) \sim 1/(a+1)k$
$c_1 = (1/2)(\alpha - a^{1/k})/f'(\alpha) \sim \frac{a+1}2\log(\frac{a+1}a)$
Since $f'(\alpha^{1/k})$ and $f''(\alpha^{1/k})$ are on the order of $1/k$, we have $C = \frac{a+1}2\log(\frac{a+1}a)$
• Thanks, Mercio. I'll accept your answer soon. However, I was wondering if you know how to tweak it to cover the more general case $x_n=\sqrt[k]{a+\sqrt[k]{a+\sqrt[k]{a+\sqrt[k]{a_n+\dots}}}}$? (Kindly see the Nov.25 edit.) – Tito Piezas III Nov 26 '13 at 0:17 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9838471637570105,
"lm_q1q2_score": 0.8362417229678963,
"lm_q2_score": 0.84997116805678,
"openwebmath_perplexity": 425.64481926582175,
"openwebmath_score": 0.9718883037567139,
"tags": null,
"url": "https://math.stackexchange.com/questions/579541/on-the-paris-constant-and-sqrtk1-sqrtk1-sqrtk1-sqrtk1-dots"
} |
c++, tree
// These functions are for creating the tree
void insertPrivate(TreeNode *&root, const T &theData);
void insertPrivate(TreeNode *&root, T &&theData);
// Traversal functions for printing the nodes
void inorderTraversal(BinaryTree::TreeNode* root);
void pretorderTraversal(BinaryTree::TreeNode* root);
void postorderTraversal(BinaryTree::TreeNode* root);
public:
// Constructors
BinaryTree() = default; // empty constructor
BinaryTree(BinaryTree const &source); // copy constructor
// Rule of 5
BinaryTree(BinaryTree &&move) noexcept; // move constuctor
BinaryTree& operator=(BinaryTree &&move) noexcept; // move assignment operator
~BinaryTree(); // destructor | {
"domain": "codereview.stackexchange",
"id": 31215,
"lm_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++, tree",
"url": null
} |
Find $y(x)$ given $\frac{dy}{dx} = x^3y$, where $y(1) = 2$.
So I did the following:
$\int \frac{dy}{y} = \int x^3dx \longrightarrow \ln{y} = \frac{x^4}{4} + C$
$y = e^{\frac{x^4}{4} + C} \ \ or \ \ y = Ce^{\frac{x^4}{4}}$
Where C is some constant to be solved for.
Anyway I could solve for C. But what is getting me is that my prof's final answer is:
$y = 2e^{\frac{x^4}{4} - \frac{1}{4}}$
Which would mean there was two constants...but I would need more initial conditions for that.
You have that $2=Ce^{\frac{1^4}{4}}$ dividing each side we get $c=\frac{2}{e^{\frac{1}{4}}}\Rightarrow2e^{\frac{-1}{4}}$ see it now?
3. Hello, Trevor!
You're both correct . . .
$y \:= \:e^{\frac{x^4}{4} + C}\:\text{ or } \:y \:= \:Ce^{\frac{x^4}{4}}$ .where $C$ is some constant to be solved for.
I could solve for C. . . . . Did you?
$\text{My prof's final answer is: }\;y \:= \:2\,e^{\frac{x^4}{4} - \frac{1}{4}}$ | {
"domain": "mathhelpforum.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.98697950682225,
"lm_q1q2_score": 0.8427943914468099,
"lm_q2_score": 0.8539127566694178,
"openwebmath_perplexity": 691.5098865193327,
"openwebmath_score": 0.9588059186935425,
"tags": null,
"url": "http://mathhelpforum.com/calculus/34344-seperable-de.html"
} |
optimization, c, performance, parsing, trie
struct trie_node {
int class; /* acts as a class or id of the word
* and used for checking for a match
*/
struct trie_node * nodes[TRIE_SIZE];
};
struct trie {
struct trie_node head, * current;
};
int trie_init (struct trie * t);
int trie_adds (struct trie_node * head, char * str, int class);
int trie_freenode (struct trie_node * node);
int trie_free (struct trie * t);
int trie_pass (struct trie * t, unsigned char c);
int trie_reset (struct trie * t);
Implementation:
#include "trie.h"
#include <stdlib.h>
int trie_init (struct trie * t){
t->current = &t->head;
for (int i = 0; i < TRIE_SIZE; i++){
t->head.nodes[i] = 0;
}
t->head.class = 0;
return 0;
}
int trie_adds (struct trie_node * head, char * str, int class){
if (str[0]){
int num = str[0];
if (!head->nodes[num]){ // create new node
head->nodes[num] = calloc (1, sizeof (struct trie_node)); | {
"domain": "codereview.stackexchange",
"id": 4548,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "optimization, c, performance, parsing, trie",
"url": null
} |
java, algorithm, strings, integer
We now have methods for determining if a given number is an Armstrong number. Lets use them by first generating a range of numbers and then filtering that range with our new methods. After the filtering process, simply print the results.
public static void main(String[] args) {
...
IntStream.range(start, end)
.filter(ArmstrongMainRevisioned::isArmstrong)
.forEach(number -> System.out.println("Number " + number + " is Armstrong"));
}
Bringing It All Together
This is just one of many possible ways this application could be written using these various mentioned techniques.
import java.util.InputMismatchException;
import java.util.Scanner;
import java.util.stream.IntStream;
public class ArmstrongNumberGenerator {
private static final Scanner scanner = new Scanner(System.in); | {
"domain": "codereview.stackexchange",
"id": 34375,
"lm_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, algorithm, strings, integer",
"url": null
} |
ros, husky, begginer-tutorials, roscpp, ros-indigo
loop_rate.sleep();
++msg_count;
}
//For some time, halt
msg_count = 0;
for(int n=0; n<50; n++)
{
//Update the velocity
velocity.linear.x = 0;
//Publish the topic
velocity_pub.publish(velocity);
loop_rate.sleep();
++msg_count;
}
//Loop
}
return 0;
} | {
"domain": "robotics.stackexchange",
"id": 21547,
"lm_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, husky, begginer-tutorials, roscpp, ros-indigo",
"url": null
} |
kinematics, motion-planning, forward-kinematics, dh-parameters
axis $x_j$ intersects axis $z_{j-1}$
axis $x_j$ is perpendicular to axis $z_{j-1}$
(see Robotics, Vision & Control, second edition, p.197)
Personally I don't think it is useful to save 2 parameters given the confusion it creates for almost everybody, especially beginners, but I still find them confusing. Saving 2 parameters is pointless given today's computing capability, but back in 1955 when this notation was invented it was perhaps more pertinent. | {
"domain": "robotics.stackexchange",
"id": 1876,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "kinematics, motion-planning, forward-kinematics, dh-parameters",
"url": null
} |
performance, beginner, unit-testing, scala, gui
validateDetails(details,DetailsValidator(form.headers), detailsMessage)
}
def validateDetails(details: List[Map[String,String]],
validator: DetailsValidator, message: String): Unit = {
var flag = false
try {
for (mapElement <- details)
vldt[Map[String,String]](
List((mapElement.values.mkString(" "),mapElement)),
validator,
flag = true,
message)
} catch {
case e: Throwable => {
gui.message("Error")
e.printStackTrace()
gui.alert(e.getStackTrace.mkString("\n"))
}
}
if(flag) loadTemplate(details)
}
def loadTemplate(details: List[Map[String,String]]): Unit = {
val docPack: WordprocessingMLPackage =
TemplateFormatter(DocxInput(gui.templateFile))
.template
validateTemplate(details, docPack)
} | {
"domain": "codereview.stackexchange",
"id": 27091,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "performance, beginner, unit-testing, scala, gui",
"url": null
} |
php, datetime
Which function would you use, which one would you prefer and why?
Are there any hard rules, or doesn't it matter?
Should I always aim to promote code reuse in my project and by having
more general functions build more specific functions from that,
or should I just straightforwardly implement exact specific logic in
one function and do not rely on other functions to build my more
specific function like hasMonthPassed? | {
"domain": "codereview.stackexchange",
"id": 45054,
"lm_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, datetime",
"url": null
} |
java, array
How do I make the code cleaner?
The easiest way to accomplish this is to call the first method that generates a sorted array and then reverse it. I believe the simplest way to reverse the array is to call Collection.reverse() while the array is still an Array List. | {
"domain": "codereview.stackexchange",
"id": 9079,
"lm_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, array",
"url": null
} |
algorithms
Title: Multiway Cut question I am trying to understand Multiway Cut, and basically how the Multiway Cut works. I am searching google many hours to find a good example to understand. A good example that I am trying to understand is this:
http://crab.rutgers.edu/~rajivg/studentTalks/multiwayCut.pdf
What I cannot understand, and here is the point I need your help, is how did he go from slide 12 to slide 13? How the graph on slide 13 was produced? How do I choose A1*,A2*,A3* ?? The analysis of the approximation algorithm (join all min-cuts between a terminal and the contraction of the remaining terminals, excluding the heaviest cut) starts on slide 13. So there's nothing to compute, simply assume that $A^*$ is the optimal solution with cuts $A_i^*$ separating terminal $i$ from the rest of the graph. To see the argument spelled out more explicitly read e.g. chapter 4 of Vazirani's "Approximation Algorithms". | {
"domain": "cs.stackexchange",
"id": 14181,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "algorithms",
"url": null
} |
ros, tf2-ros, rospy
Title: TF2 how to translate vector in Python?
Hi everyone,
I think I'm experiencing a severe blackout right now...
A short one: in Python, how do I translate a 3D vector (a numpy array) from one TF2 frame to another considering position and orientation of the reference frames?
Thanks
Originally posted by Hendrik Wiese on ROS Answers with karma: 1145 on 2017-10-23
Post score: 1
Figured it out myself: by using tf2_geometry_msgs.do_transform_vector3 and its respective siblings for geometry_msgs/Point and so on.
lookup a transform for the desired coordinate transformation
create the point/vector you want to translate
do_transform_point/vector on the point/vector
returns the original point/vector in the new coordinate frame
...
profit!
Originally posted by Hendrik Wiese with karma: 1145 on 2017-10-24
This answer was ACCEPTED on the original site
Post score: 1 | {
"domain": "robotics.stackexchange",
"id": 29167,
"lm_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, tf2-ros, rospy",
"url": null
} |
c++, tree
Rather than 1, 2 and 3, I'd rather use an enumeration:
enum order { PRE_ORDER, IN_ORDER, POST_ORDER };
Then Print would look something like this:
template<typename T>
void BTree<T>::Print(order o)
{
switch (o) {
case PRE_ORDER: PrintPreOrder(root); break;
case IN_ORDER: PrintInOrder(root); break;
case POST_ORDER: PrintPostOrder(root); break;
}
}
At least to me, this seems considerably clearer and more readable (also note the use of a switch statement to directly express the intent of choosing one of multiple alternatives).
Don't Repeat Yourself
Right now, you have code in both Add and Find to find a node (if any) with a particular value. Oddly, the two use entirely different approaches to this problem. Rather than having two copies of code to find a node based on a key, I'd rather have one piece of code that's used from both:
Node *&find_key(T key) {
Node *current = root; | {
"domain": "codereview.stackexchange",
"id": 19996,
"lm_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++, tree",
"url": null
} |
quantum-field-theory, path-integral, propagator
In other words, if somebody gives you an oracle that returns the number $\la 0|0\ra_J$ for any given function $J$, but nobody tells you how that oracle is implemented (in other words, you don't get to see the lagrangian or the path-integral formulation or even what the fields are), you can still learn a lot about the theory just by querying the oracle for all different functions $J$. You can define the operator $\phi(x)$ using $\delta/\delta J(x)$, without knowing that the lagrangian was expressed in terms of such a field. You can do this even if the oracle's maker did not express the path integral in terms of such a field. | {
"domain": "physics.stackexchange",
"id": 69484,
"lm_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, path-integral, propagator",
"url": null
} |
object’s resistance to the changes of its rotation. 28 kg and 12. Moment of Inertia 7. The axis of rotation will not rotate according to the applied torque, as one might expect, but will move in the direction of the torque vector. " Notice that their rotational inertia increases from left to right as the mass distribution gets farther from the axis of rotation that passes through their center of mass. LAB 6: Rotational Inertia of Toilet Paper Objective: To identify and utilize the relationship between linear acceleration, angular acceleration, and rotational inertia. Use this demonstration again and again as you set a card on top of a post and set the ball on top of the card. 11110 Alondra Blvd. In physics, the moment of inertia measures how resistant an object is to changes in its rotational motion about a particular axis. Can you determine an experimental value for the moment of inertia of the horizontal disk. Formula used: The moment of inertia of a flywheel is given by following | {
"domain": "angelaleone.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9877587257892505,
"lm_q1q2_score": 0.8294545499481589,
"lm_q2_score": 0.839733963661418,
"openwebmath_perplexity": 543.1601335549083,
"openwebmath_score": 0.5480412840843201,
"tags": null,
"url": "http://angelaleone.it/imhu/moment-of-inertia-lab.html"
} |
meteorology, climate, hydrology
Title: Does total precipitation have different meanings? I'm new in hydrology sciences and for my work, I have to differentiate solid precipitation time series and liquid precipitation from total precipitation time series. My data are from a meteorological station and the figure below is to illustrate the followings. | {
"domain": "earthscience.stackexchange",
"id": 2362,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "meteorology, climate, hydrology",
"url": null
} |
general-relativity, cosmology, photons, spacetime
If you use General Relativity instead you'll find that photons make a contribution to the stress energy tensor, and therefore to the curvature of space.
Does a photon exert a gravitational pull?
How did space expansion overcome uniformly this gravitational pull that the CMB photons' had on each other?
Now just to clarify, imagine the early universe, very energetic photons, very dense CMB, so the photons' gravitational pull on each other must be significant. How can space expansion overcome this uniformly? Analogously space was filled with matter particles, those had gravitational pull on each other too. These matter particles clumped up into denser parts, which became galaxies, and voids inbetween.
Why didn't this happen with photons the same way? Those energetic photons in the early universe had significant gravitational pull on each other, like matter particles. But, CMB is uniform everywhere, no denser parts.
Another interesting thing is, there is even something called the geon. | {
"domain": "physics.stackexchange",
"id": 77744,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "general-relativity, cosmology, photons, spacetime",
"url": null
} |
algorithms, graphs
on the first side $U$, you have one vertex $u_i$ for $w_i \in W$. In the kidney exchange analogy they are the donors.
on the other side $V$, you also have one vertex $v_i$ for $w_i \in W$. In the kidney exchange analogy they are the recipients.
Now, for every $e \in E$ linking $w_1$ and $w_2$, put two edges in $E'$:
$u_1$ to $v_2$, weight $0$
$u_2$ to $v_1$, weight $0$
They represent the potential trade.
Also, for every $w_i \in W$, add an extra edge in $E'$:
$u_i$ to $v_i$, weight $1$
These edges represent the possibility to have no cycle for $w_i$ in the optimal solution.
Now solve the assignment problem using Hungarian algorithm ($O(n^3)$), trying to minimize the edges selected in the assignment. You get the optimal solution maximizing the number of vertex covered by cycles. | {
"domain": "cs.stackexchange",
"id": 14235,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "algorithms, graphs",
"url": null
} |
multithreading, scala, amazon-s3
Your imports take up a lot of space. Many can be condensed into one liners:
import play.api.i18n.Lang
import play.api.i18n.Messages
Can be:
import play.api.i18n.{Lang, Messages} | {
"domain": "codereview.stackexchange",
"id": 8235,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "multithreading, scala, amazon-s3",
"url": null
} |
ros2
<export>
<build_type>ament_cmake</build_type>
</export>
</package>
display.launch.py
import launch
from launch.substitutions import Command, LaunchConfiguration
import launch_ros
import os
def generate_launch_description():
pkg_share = launch_ros.substitutions.FindPackageShare(package='my_robot_description').find('my_robot_description')
default_model_path = os.path.join(pkg_share, 'src/description/my_robot.urdf')
default_rviz_config_path = os.path.join(pkg_share, 'rviz/urdf_config.rviz')
world_path = os.path.join(pkg_share, 'world/my_world.sdf'), | {
"domain": "robotics.stackexchange",
"id": 36808,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros2",
"url": null
} |
acid-base
Title: Increase in volume of solution in neutralization reaction and its effect on weak acid If 100ml of 1M acetic acid and 20ml 0.01M NaOH is taken in a reaction medium,they will neutralize each other. I don't know for sure if this reaction is completely neutralized or not just took as an example. Now the water molecules produced in this reaction would increase slight amount of volume though they were present in the medium as ions but let us consider that the formation of molecule made those more spacious. Weak acids have a very low amount of dissoiation constant which depends on the concentration of the acid. How significant will be the effect of the slight change in volume of the solution to the dissociation of acid? I mean since the volume is increasing,concentration of the acid (ions) is supposed to decrease. Again due to the dissociation constant being too low, how significant will the change in volume of the solution be in the dissociation of acid? «Not very much», as stated by | {
"domain": "chemistry.stackexchange",
"id": 15454,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "acid-base",
"url": null
} |
Theorem: Definition & Examples, Energy & Momentum of a Photon: Equation & Calculations, How to Find the Period of Cosine Functions, What is a Power Function? So the complex conjugate z∗ = a − 0i = a, which is also equal to z. If you use Sal's version, the 2 middle terms will cancel out, and eliminate the imaginary component. Thus, the conjugate... Our experts can answer your tough homework and study questions. All other trademarks and copyrights are the property of their respective owners. [Suggestion : show this using Euler’s z = r eiθ representation of complex numbers.] To do that we make a “mirror image” of the complex number (it’s conjugate) to get it onto the real x-axis, and then “scale it” (divide it) by it’s modulus (size). Discussion. One importance of conjugation comes from the fact the product of a complex number with its conjugate, is a real number!! The conjugate of a complex numbers, a + bi, is the complex number, a - bi. Create your account. The complex conjugate of a | {
"domain": "charlesdelon.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9918120908243658,
"lm_q1q2_score": 0.8085574375459985,
"lm_q2_score": 0.8152324871074608,
"openwebmath_perplexity": 347.79721487841806,
"openwebmath_score": 0.8190913200378418,
"tags": null,
"url": "http://www.charlesdelon.com/evigq/ee407c-complex-conjugate-of-a-real-number"
} |
c, parsing, file
void getDigits(char* src, int* dest);
int main(int argc, char** argv) {
FILE* input = fopen(argv[1], "r");
if (input == NULL)
return -1;
char* line = NULL;
size_t line_size = 0;
int digits[2], line_len, sum = 0;
while ((line_len = getline(&line, &line_size, input)) != -1) {
getDigits(line, digits);
sum += 10*digits[0] + digits[1];
}
printf("Sum: %d\n", sum);
return 0;
}
void getDigits(char* src, int* dest) {
int len = strlen(src); | {
"domain": "codereview.stackexchange",
"id": 45403,
"lm_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, parsing, file",
"url": null
} |
keras, dataframe, image-preprocessing
training_set_1 = train_datagen.flow_from_dataframe(dataframe=df, color_mode='grayscale',target_size = (28, 28,1), batch_size = 2)
training_set_2 = train_datagen.flow_from_dataframe(dataframe=df, color_mode='grayscale',target_size = (28, 28,1), batch_size = 2)
model = keras.models.Sequential([ ... ])
optimizer = keras.optimizers.SGD(lr=0.2, momentum=0.9, decay=0.01)
model.compile(loss="binary_crossentropy", optimizer=optimizer,
metrics=["accuracy"])
for i in list(range(10)):
history = model.fit(training_set_1,epochs=1)
history = model.fit(training_set_2,epochs=1)
Definitely, learning can be very noisy based on the difference in variance in datagens.
Also,history will be reset everytime. | {
"domain": "datascience.stackexchange",
"id": 7761,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "keras, dataframe, image-preprocessing",
"url": null
} |
genetics, molecular-genetics, genomics, statistics, gwas
Title: How many people need to have the same mutation of a gene in order for that gene to be seen as a feasible candidate for a disease? I am learning about genome-wide association studies (GWAS) and I know that they are used to see whether certain SNPs are associated with a disease of interest. From everything that I have watched and read about GWAS, it seems to me that GWAS can only be used to analyse SNPs in relation to a disease.
However, I was wondering whether GWAS can be used to analyse gene deletions in relation to a specific disease. For example, if you are interested in seeing whether a deletion of a certain gene X is associated with a disease like intellectual disability.
Would it be feasible to recruit thousands of people with intellectual disability and thousands of controls and then sequence their genomes and see whether the deletion of a specific gene is significantly associated with intellectual disability? | {
"domain": "biology.stackexchange",
"id": 12451,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "genetics, molecular-genetics, genomics, statistics, gwas",
"url": null
} |
• Please note that $(t-1)^n \neq t^n-n(t-1)^n+\binom n2(t-2)^n-\dots$... – abiessu Feb 26 '16 at 19:35
• Okay, look at it this way: $(6-1)^5 \neq 6^5-5\cdot 5^5+10\cdot 4^5\dots$ – abiessu Feb 26 '16 at 19:48
• You haven't explained very well what you're doing, and so you're being misunderstood. It's tempting to write things as equalities, but that makes misunderstandings more likely here. If I understood correctly, what you are doing is, given $n$, first expand $(t-1)^n$ via the binomial formula. Then, in that polynomial, you replace every power $t^a$ of $t$ with $(a+1)^n$. And the resulting number turns out - if you haven't made a mistake - to be $n!$. Is that right? – Daniel Fischer Feb 26 '16 at 19:55
• The fact that this identity mirrors what you find in Pascal's Triangle is directly related to how you would take the $n$th finite difference of the polynomial $p(x)=x^n$. – abiessu Feb 26 '16 at 20:06
• This is closely related to Binomial Sum: Values – robjohn Mar 13 '16 at 13:21 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9773708032626701,
"lm_q1q2_score": 0.8123349503554356,
"lm_q2_score": 0.8311430499496096,
"openwebmath_perplexity": 351.1000070828527,
"openwebmath_score": 0.7806769609451294,
"tags": null,
"url": "https://math.stackexchange.com/questions/1673539/expressing-factorials-with-binomial-coefficients"
} |
primer, crispr
Thank you! A quick check with BLAST returned the following result:
Homo sapiens huntingtin (HTT), mRNA
Sequence ID: NM_002111.7Length: 13669Number of Matches: 1
Related Information
Gene-associated gene details
GEO Profiles-microarray expression data
PubChem BioAssay-bioactivity screening
Range 1: 267 to 286GenBankGraphicsNext MatchPrevious Match
Alignment statistics for match #1 | {
"domain": "biology.stackexchange",
"id": 7150,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "primer, crispr",
"url": null
} |
human-biology, medicine, skin, dna-damage, uv
This seems extremely dubious to me, but I know very little about the topic and can't find any more reputable sources discussing the question. Can indirect damage occur in adjacent non-illuminated cells? Can it occur millimeters away from the illuminated area? Centimeters? Can UV light harm inner organs? The life of the radicals decides how far they move.
This paper https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4310837/#!po=6.92308 has a table of half lives of radicals, the longest lasting ones (the radical of nitrous oxide and nitrogen dioxide) have half lives of seconds.
Diffusion theough the skin would be slow
Technically the problem is "reactive oxygen species" (ROS) and "reactive nitrogen species" (RNS) that are the damaging chemicals that includes free radicals. The reactive species that are not radicals have a longer half-life or are even fairly stable and so could diffuse further before making mischief.
The wikipedia article has problems - that is mentioned on the talk page. | {
"domain": "biology.stackexchange",
"id": 10441,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "human-biology, medicine, skin, dna-damage, uv",
"url": null
} |
quantum-mechanics, electromagnetism, operators, momentum, hamiltonian
The canonical momentum $\mathbf{p}$, which is the conjugate variable for position, defined with $p_i=\partial L/\partial \dot{x_i}$. In classical mechanics, it is an abstract quantity that indicates a phase space coordinate. In quantum mechanics, the equivalent (though not identical, as elucidated here) definition is more helpfully phrased as "canonical momentum is the generator of translation;" this statement becomes somewhat more digestible when one considers a derivation (of the variety shown here) of its form in the position representation, $-\mathrm{i}\hbar\nabla$ . Notice that there is no immediately obvious connection between this definition and the time over which a body translates (i.e. the speed of the body). | {
"domain": "physics.stackexchange",
"id": 85988,
"lm_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, electromagnetism, operators, momentum, hamiltonian",
"url": null
} |
thermodynamics, entropy
Addendum: A similar result can be derived for a somewhat more general thermal equation of state such as $p(T,V)=Tf(V)+g(V)$. (for the vdW fluid $f(V)=\frac{nR}{V-nb}$ and $g(V)=\frac{an^2}{V^2}$)
Let $S=S(T,V)$ then $$dU=TdS-pdV=T\left(\frac{\partial S}{\partial T}dT+\frac{\partial S}{\partial V}dV\right)-pdV\\
=T\frac{\partial S}{\partial T}dT+\left(T\frac{\partial S}{\partial V}-p \right)dV$$ Now use Maxwell's equation $\frac{\partial S}{\partial V}=\frac{\partial p}{\partial T}$ and write $C_v=T\frac{\partial S}{\partial T}$:
$$dU=C_vdT+\left(T\frac{\partial p}{\partial T}-p \right)dV$$
For this gas $\frac{\partial p}{\partial T}=f(V)$ and also $\frac{\partial^2 p}{\partial T^2}=0$. Now use the equality of mixed partial derivatives for $dU$ to be exact differential, that is
$$\frac{\partial C_v}{\partial V} = \frac{\partial}{\partial T}\left(T\frac{\partial p}{\partial T}-p \right) | {
"domain": "physics.stackexchange",
"id": 92487,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "thermodynamics, entropy",
"url": null
} |
c#, networking, socket, tcp
connectionSocket.Close();
}
}
} I will not comment on the actual TCP functionality itself.
I am not competent for that.
Stopping broadcast - on purpose?
When you are broadcasting to the clients in SendMessage(), it seems like you stop broadcasting if you get problems reaching one of the clients. Is this intended?
I would move the try/catch inside the foreach, and around the if. Then, in the catch, I would either explicitly break; out of the foreach or leave a comment like // Don't care, ignore and proceed.
Empty try-catches
As @ChaosPandion suggested, I would not leave empty try-catches.
I would either handle them, try to refactor the code as not to throw them, or leave a comment with a quick explanation.
Succinct code
If you are using C#4.0, I would write the default values like this:
#region Constructors
// This behaves the same as the other version with two constructors.
public TCPSocketServer(int PortNumber, int ConnectionsLimit = 0)
{ | {
"domain": "codereview.stackexchange",
"id": 832,
"lm_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#, networking, socket, tcp",
"url": null
} |
mobile-robot, control, motion-planning, path-planning
Title: Is there a formal name for translating poses into robot states? I've been working on a module that takes in planar poses $\begin{bmatrix} x_{t_{k}} & y_{t_{k}} & \theta_{t_{k}}\end{bmatrix}^{T}$ and spits out expected robot states $\begin{bmatrix} x_{t_{k}} & y_{t_{k}} & \theta_{t_{k}} & \dot{x}_{t_{k}} & \dot{y}_{t_{k}} & \dot{\theta}_{t_{k}} \end{bmatrix}^{T}$. Essentially, I'm giving the velocity I expect the robot to reach at each pose.
I've been looking for the proper terminology for a module like this, both so I can write more readable code and so that I can do a better literature search. What would this kind of thing be called?
Thanks! It is a little tough to tell what you are asking because of the limited information. It would be helpful if you would show how these vectors fit in your control scheme. However, I'll start an answer and maybe we can arrive at the one you need. | {
"domain": "robotics.stackexchange",
"id": 1462,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "mobile-robot, control, motion-planning, path-planning",
"url": null
} |
c#, design-patterns
The code loops as follows:
List<uint> DataNotificationList = new List<uint>()
{
2,
6,
9
};
for (int n = 0; n < DataNotificationList.Count; n++)
{
for (int i = 0; i < treeListViewModel.Courses.Count; i++)
{
if (treeListViewModel.Courses[i].Students.ContainsKey(DataNotificationList[n]))
{
treeListViewModel.Courses[i].Students[DataNotificationList[n]].ExecuteStrategy(hasError());
break;
}
}
}
This smells of a message chain and violates the Law of Demeter (principle of least knowledge):
treeListViewModel.Courses[i].Students[DataNotificationList[n]].ExecuteStrategy(hasError()); | {
"domain": "codereview.stackexchange",
"id": 9968,
"lm_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#, design-patterns",
"url": null
} |
formal-languages, reductions
Title: If$A \leq_T B$ is given, can you reduce $\overline{A}$ to $B$ and vice-versa If you are given two languages $A$, $B$ and $$A \leq_T B.$$ Is it possible to $\overline{A} \leq_T B$ or $A \leq_T \overline{B}$?
Here is my shot.
Case 1: $\overline{A} \leq_T B$
This is only possible if $A \leq_m B$ exists and $B=\overline{B}$. As you can transform any many-one reduction to its complement, we can show that if $A \leq_m B$, then $\overline{A} \leq_m \overline{B}=B$. Thus $\overline{A} \leq_m B$.
Case 2: $A \leq_T \overline{B}$
This is the same as above but we need to change the role of $A$ and $B$. You say:
This is only possible if $A \le_m B$ exists and $B=\overline{B}$ | {
"domain": "cs.stackexchange",
"id": 17553,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "formal-languages, reductions",
"url": null
} |
Now for unconditional results towards the easier problem (ii). Assume that $h \le q^{\epsilon}$ and express the condition of belonging to a coset of $H$ in terms of the characters that are trivial on $H$ (see the paper of Lamzouri, Li and Soundararajan for details). Then use the Burgess bounds on the character sums that arise. This argument gives that the least integer $n$ in any given coset is $\ll q^{\frac 14+\epsilon}$. This is a (modest) improvement over the trivial bound of $q$. For a general modulus $q$ the Burgess bound gives the best known result on this problem. However, for moduli $q$ that are very smooth (and this will be important for the present problem) one can obtain a better result by a $q$-van der Corput argument due to Graham and Ringrose (following Heath-Brown). From the Graham-Ringrose argument (see either the original paper, or Corollary 12.14 of Iwaniec and Kowalski, or estimate (4.1) and Lemma 4.2 from Granville and Soundararajan), one can show that if all the | {
"domain": "mathoverflow.net",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.977022625406662,
"lm_q1q2_score": 0.8399109344901365,
"lm_q2_score": 0.8596637505099168,
"openwebmath_perplexity": 247.02325675948828,
"openwebmath_score": 0.9119747281074524,
"tags": null,
"url": "https://mathoverflow.net/questions/217612/primorial-puzzlement"
} |
c++, beginner, console, c++14, adventure-game
string PlyrName(string name); //Gets and displays the players name
should be
class Player
{
public:
void DisplayInv(vector<string>Inv); //Gets the players inv
//void AddInv(vector<string>Inv);
void Armor(int Armor); //Players armor
string Name(string name); //Gets and displays the players name
adopt a member variable naming standard. I have been shot down for this one, but I still think most people think its valuable. I use m_, the other common one is xxx_. Thus Player becomes:
private:
int health_;
int gold_;
int Armor_;
string name_;
};
that vector of pointers to strings looks very suspicious
vector<string*>pInv;
I am sure you dont need it, just use vector<string> (or std::vector<std::string>), string will do the right thing
Having an iterator as a member variable is also very odd. They are normally transient things in functions.
vector<string>::const_iterator it; // iteraotr for inv | {
"domain": "codereview.stackexchange",
"id": 21401,
"lm_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, console, c++14, adventure-game",
"url": null
} |
ros, roslaunch, universal-robot, rosparam
Title: Rename JOINT_NAMES in ur_driver test_move.py
I rosrun ur_driver test_move.py and would like to change the names of the joints which used. Originally they are initialized in the test_move.py, sadly I can't just edit this file, so I would like to find out if I can do this maybe with a launch file.
In test_move.py the joint names are saved in a character array like this:
JOINT_NAMES = ['shoulder_pan_joint','shoulder_lift_joint',...]
The overall question:
Can I effect the names of the joints via a launchfile. If yes how and if not, are there other ways to effect it.
My thoughts are about a Launch-File like this:
<node pkg="ur_driver" type="test_move.py" name="follow_joint_trajectory">
<param name="JOINT_NAMES" value="['J0','J1',...]"/>
</node> | {
"domain": "robotics.stackexchange",
"id": 19781,
"lm_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, roslaunch, universal-robot, rosparam",
"url": null
} |
c++, algorithm, programming-challenge, time-limit-exceeded, computational-geometry
At this point, I'm not sure how to optimize my code. Any ideas? Do I necessarily need to use an array instead of a vector in order to speed up the program? Don't use using namespace std;. It is extremely bad practice and will ruin your life. You will have trouble on common identifiers like count, size, etc. See Why is “using namespace std;” considered bad practice? for more information.
The input format is extremely awkward, but this seems to be beyond your control, so I'll leave it alone.
Instead of using a linear search as you are doing in your loop, it might be beneficial to do a binary search if the amount of data is large. (This needs some testing.) Also, use standard algorithms to make your code more readable.
Also, in this very case, a dynamic vector may not be the best way to appeal to the timer. (I'm not sure how I would phrase that.) reserve may help. You can try using a static vector like this one because you know that the size is below a limit. | {
"domain": "codereview.stackexchange",
"id": 35735,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, algorithm, programming-challenge, time-limit-exceeded, computational-geometry",
"url": null
} |
density-matrix, linear-algebra
\end{eqnarray}
Is it right that, due to the state separation above, the result is:
\begin{eqnarray}
\rho_B=\sum_{k,j}c_k c_{j}^* |k\rangle\langle j| \hspace{10pt}(?) \tag{3}.
\end{eqnarray}
This means that no matter which of the two subsystems we trace out, the reduced density operator is always the same. How is this done in case the partial trace is not correctly taken? TLDR; No, your answer should be
$$
\rho_B=\sum_k|c_k|^2|k\rangle\langle k|.
$$
You seem to have arrived at equation (3) from equation 2 essentially just by throwing away all the terms on qubits A and C. This is not how the partial trace works. Instead, you have to take an inner product (on both sides), summing over an orthonormal basis of the systems that you are tracing out. In this instance, it's probably easiest to select $|m\rangle\otimes I\otimes |n\rangle$. So, we have
$$ | {
"domain": "quantumcomputing.stackexchange",
"id": 5134,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "density-matrix, linear-algebra",
"url": null
} |
java, object-oriented, game, swing, minesweeper
In this approach you could possibly have a Game object, Board object, and Square object in the game model. On a button click, the coordinates of the Square button object in the view would be passed into the Game, and the appropriate changes would be made to the Board and to the game state. For example, the coordinates have a bomb, and so the state of the Game is set to GameState.LOSS.
In this approach, you could make the Board object available to the view.
After each move, the view could update based on the new state of the board, marking the squares that have flags, have been uncovered, etc.
You could also do something such as compute the positions of the nearby Square objects at the start of the game, and then you could check for bombs like this:
int bombCount = 0;
for (Position position : square.neighbors) {
Square neighbor = board.get(position);
if (neighbor.hasBomb) {
bombCount++;
}
} | {
"domain": "codereview.stackexchange",
"id": 15643,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, object-oriented, game, swing, minesweeper",
"url": null
} |
newtonian-mechanics, newtonian-gravity, orbital-motion
Title: Equivalence between Newton's shell theorem for a point inside the sphere and Kepler's second law? I am trying to understand the shell theorem and as part of simplifying it for my understanding, came up with this diagram : .
It looks rather similar to an illustration of kepler's second law as .
So for my question, does kepler's second law imply (or is a corollary) the shell-theorem for a point within the sphere?
Am I wrong in drawing comparison's between the two? If yes, then in what way?
Edit (Post accepting answer) :
I guess this should have been my primary question, but still - is my simplification of the shell theorem correct? No, these proofs have nothing to do with each other. Kepler's second law follows solely from angular momentum conservation and works in any number of dimensions, for any central force. The shell theorem requires an inverse square force in three spatial dimensions. | {
"domain": "physics.stackexchange",
"id": 34273,
"lm_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, newtonian-gravity, orbital-motion",
"url": null
} |
electromagnetism
No. If the retarded Coulomb changed linearly in time, then the first two terms added together would give you the Coulomb now. Instead they merely together give a linear time extrapolation. Like using $x(0)+tv(0),$ in general it isn't giving you the current value. Only when it actually changed linearly in time.
But, since cause precedes effect, wouldn't the electric field at time $t$ be caused by the charge at $t-r/c\;?$
If you did that to the potential then all would be fine.
But the two term seems to give the condition at $t$, not $t-r/c\;.$ Doesn't this violate causality?
I'm not sure anyone knows what you mean. You are evaluating the field at time $t$ and it is based on the prior times; isn't that exactly what the the expression is saying? Isn't everything in the expression evaluated at the retarded time and the result is the current field?
wouldn't the electric field at time $t$ be caused by the charge configuration at time $t-r/c\;?$ | {
"domain": "physics.stackexchange",
"id": 27419,
"lm_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
} |
algorithms, dynamic-programming, greedy-algorithms
The length 3 rod is the most price-for-length effective single rod piece. But the optimization goal isn't to find the best price-to-length ratio for a single piece, it's to find the best total price for how much rod we actually have! Once the greedy algorithm chooses the shiniest, most appealing first piece, it is now stuck for the rest of the problem with a highly suboptimal remaining length according to the highly nonlinear price table.
In general, most optimization problems cannot be solved optimally by a greedy strategy. Those that can tend to have some exceptional property that guarantees that a local maximum will also be a global maximum. | {
"domain": "cs.stackexchange",
"id": 20193,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "algorithms, dynamic-programming, greedy-algorithms",
"url": null
} |
ros, teb-local-planner, motionplanning
Title: Why is a global planner required for teb_local_planner?
I have successfully implemented the global_planner and my own global planner plugin(RRTstar) for the teb_local_planner. I've found that the teb_local_planner is very efficient is avoiding obstacles. My doubt is, what is the role of the global planner in this? I do understand that the local planner is merely optimizing the trajectory provided by the global planner. But, going by the analogy that the local planner is like an elastic band, why couldn't we merely have selected a straight line between the start and goal point and use teb_local_planner to weave its way through the obstacles since it is effectively doing that with a global planner as well.
Also, am I wrong in understanding that the teb local planner works similar to the potential field planners? Do they suffer from the same drawbacks?
Any help would be much appreciated! | {
"domain": "robotics.stackexchange",
"id": 26141,
"lm_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, teb-local-planner, motionplanning",
"url": null
} |
newtonian-mechanics, forces, friction, everyday-life, free-body-diagram
You need friction to accelerate when you want to start walking, stop walking, change speeds while walking, etc. This is because you need a horizonal force to change your horizontal speed. This force is friction. It arises due to interactions between your feet and the ground you walk on. Therefore, by Newton's third law, the ground is pushed on by friction in the opposite direction of your horizonal acceleration.
However, don't discount the normal force. It is a vertical force (on level ground). Therefore this force is what keeps you from accelerating downward into the ground due to gravity. It also is one of the factors in determining how strong the previously mentioned friction force can be. A larger normal force typically means a larger possible friction force before sliding between your feet and the ground occurs. Therefore, without the normal force you wouldn't be able to walk either. | {
"domain": "physics.stackexchange",
"id": 60084,
"lm_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, friction, everyday-life, free-body-diagram",
"url": null
} |
matlab, numerical-methods, signal-processing, octave
ft(i) = dot(X, f_i);
end
end
Here is a script file applying the above and comparing it to the built-in function fft(X, n):
applyMyFourierTransform.m
clc; clear; close all;
% Signal parameters
A = 1; % signal amplitude.
f = 10; % frequency of the signal 10 Hz.
theta = 0.25 * pi; % initial phase of the signal.
measurement_rate = f * 30; % Nyquist-Shannon Th.-rate of measurement >=2*f.
nPeriods = 7; % number of periods to be displayed.
tBeg = 0;
tEnd = nPeriods * 1 / f;
tStep = 1 / measurement_rate ;
t = tBeg : tStep : tEnd;
x = A * sin(2 * pi * f * t + theta); % sine wave A= 1 V,f= 10 Hz, phi_0= pi/4 rad.
P = A^2 / 2; % signal power=\frac{1}{T}\int_0^T {x{^2}(t)dt}.
point_num = numel(x); | {
"domain": "codereview.stackexchange",
"id": 28526,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "matlab, numerical-methods, signal-processing, octave",
"url": null
} |
ros, rviz, visualization-msgs, publisher
Here is an example of how we do this for a costmap in a local_planner:
https://github.com/GKIFreiburg/gki_navigation/blob/master/gki_navigation_controllers/channel_controller/src/channel_controller.cpp
updateVoronoi and visualizeVoronoi will be of interest, especially you need to replicate how costmap.mapToWorld used. | {
"domain": "robotics.stackexchange",
"id": 20013,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, rviz, visualization-msgs, publisher",
"url": null
} |
c#, unity3d
foreach (GameObject test in Tests1)
{
test.GetComponent<DepthOfFieldDeprecated>().enabled = false;
}
foreach (GameObject test in Tests2)
{
test.GetComponent<Bloom>().enabled = false;
}
}
else
{
CameraScriptsAir_1.GetComponent<DepthOfFieldDeprecated>().enabled = true;
CameraScriptsAir_1.GetComponent<Bloom>().enabled = true;
CameraScripstAir_2.GetComponent<DepthOfFieldDeprecated>().enabled = true;
CameraScripstAir_2.GetComponent<Bloom>().enabled = true;
foreach (GameObject camScriptTV in CameraScriptsTV)
{
camScriptTV.GetComponent<Bloom>().enabled = true;
} | {
"domain": "codereview.stackexchange",
"id": 29055,
"lm_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#, unity3d",
"url": null
} |
• Indeed that seems to be the best solution. Nothing so nice as using the tag though. – AmateurMathPirate Aug 21 '17 at 22:22
• :O Never knew you could use multiple ampersands like that. – Simply Beautiful Art Aug 21 '17 at 23:42 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9546474194456935,
"lm_q1q2_score": 0.8376809462048783,
"lm_q2_score": 0.8774767826757123,
"openwebmath_perplexity": 890.7073209248332,
"openwebmath_score": 0.9994742274284363,
"tags": null,
"url": "https://math.meta.stackexchange.com/questions/26841/labeling-simultaneous-equations/26842"
} |
strings, programming-challenge, clojure
; This should be a more specific exception.
; It also might just be appropriate to return nil, indicating failure.
(throw (Exception. "Didn't find match")))))
The gain in this scenario isn't huge though, if there's any at all. I just wanted to point out the existence of loop since I often see it ignored, even though it's exceedingly helpful when doing complicated, multi-accumulator reductions.
This is very good code though, especially for someone new to the language. Except for your lack of ns (and even that isn't necessary here), everything I saw is mostly nitpicking. I look forward to seeing more review requests from you. | {
"domain": "codereview.stackexchange",
"id": 32778,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "strings, programming-challenge, clojure",
"url": null
} |
ros, ur-modern-driver, ros-kinetic, publisher
Original comments
Comment by Hamid Didari on 2019-02-25:
why are you use your NN from out of ros you can write python in ros?
Comment by porkPy on 2019-02-25:
My NN is part of Garage/rllab from Berkeley and has its own deps. if I were to try and recreate it inside ros I know it will not work because I don't fully understand how all the different parts of Garage/rllab communicate. Therefore, it seemed more sensible to have ros read and write to Garge/rllab
Comment by porkPy on 2019-02-25:
rllab used to have ros utils but these have been removed in the newer 'Garage' version. Also, I could never get the original rllab to compile.
The most common way to exchange information with a running ROS node is by exchanging messages published to topics. You can find descriptions of the relevant concepts in the start guide and in particular, examples of how to subscribe and publish to topics using Python in the tutorials. | {
"domain": "robotics.stackexchange",
"id": 32522,
"lm_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, ur-modern-driver, ros-kinetic, publisher",
"url": null
} |
infinity. Zero. MCQ Of Chapter Light Class 10 Question 7. Image formed by plane mirror is. Focal length of a plane mirror is infinity. We can extend the mirror equation to the case of a plane mirror by noting that a plane mirror has an infinite radius of curvature. (A plane mirror can be considered as a spherical mirror of infinite radius of curvature. Real and erect. Share with your friends. Proof of Focal length of a Plane mirror is infinity - YouTube When an object is placed infront of a plane-mirror an image is formed behind the mirror at a distance equal to the distance of the object from the mirror.That is distance of the image from the mirror= V = -U. from the law of distances, 1/F = 1/U + 1/V . This means the focal point is at infinity, so the mirror equation simplifies to $d_o=−d_i$ ==>The mirror formula to get the focal length of a mirror where,the image distance - objectdistance. Answer/Explanation. (A) enly () soovist (B)) full both couscoli) & (u) conduct (DXi13 GUN) | {
"domain": "org.br",
"id": null,
"lm_label": "1. Yes\n2. Yes",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.984575448370756,
"lm_q1q2_score": 0.8368607476334974,
"lm_q2_score": 0.8499711718571775,
"openwebmath_perplexity": 906.9108863944655,
"openwebmath_score": 0.715846061706543,
"tags": null,
"url": "http://arquivo.flip.org.br/reviews/prove-that-focal-length-of-plane-mirror-is-infinity-b0943c"
} |
electromagnetism
I particularly like this method since it only requires you to know (i) the Coulomb potential and (ii) the Lorentz Transformations, both of which are rather fundamental. | {
"domain": "physics.stackexchange",
"id": 77724,
"lm_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
} |
In the past I've come across several questions where I could avoid this situation but now since my exams are approaching fast I feel I need to understand this properly.
The portion of R above the $\pi/4$ line (let us call it R1) is half of a square with side $\pi/(2\sqrt(2))$, so that its area is $\pi^2/16$.
The area of the remaining part of R (let us call it R2) can be calculated as the difference between the area of the triangle delimitated by the lines $\pi/4$, $\pi/6$, and L, and that of the small portion of C above the $\pi/6$ line.
The triangle has base equal to $\pi (\sqrt{3}-1)/(2\sqrt{2})$ and height equal to $\pi/(2\sqrt{2})$, so that its area is $\pi^2 (\sqrt{3}-1)/16)$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9802808765013517,
"lm_q1q2_score": 0.8445494363079888,
"lm_q2_score": 0.8615382147637196,
"openwebmath_perplexity": 153.8480439932118,
"openwebmath_score": 0.9036641716957092,
"tags": null,
"url": "https://math.stackexchange.com/questions/815313/area-enclosed-between-half-lines-in-polar-space"
} |
c++, object-oriented, template, template-meta-programming
template<typename T, RGBconfig<T> config>
struct RGB {
T r,g,b;
}
use as
constexpr RGBconfig<float> float1020 = {10, 20}
using RGBfloat1020 = RGB<float, float1020>
alternatively one could do
using RGBfloat1020 = RGB<float, RGBconfig<float> {10,20} >
Reduce to one template parameter => include type in RGBconfig
Perhaps it is even possible to reduce it down to one template argument
template <class T>
struct RGBconfig<T> {
using type = T;
T min, max;
}
template<auto config>
struct RGB {
typename decltype(config)::type r,g,b;
}
then use as
constexpr RGBconfig<float> float1020 = {10, 20};
using RGBfloat1020 = RGB<float1020>;
or
using RGBfloat1020 = RGB<RGBconfig<float> {10,20} >; | {
"domain": "codereview.stackexchange",
"id": 40221,
"lm_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, template, template-meta-programming",
"url": null
} |
homework-and-exercises, thermodynamics, thermal-conductivity, heat-conduction
Now we can generalize to the case of an arbitrary number of pieces, say $N$. Since we know that the order in which any two consecutive pieces is submerged has no effect, we can start with a particular ordering, then reorder two consecutive pieces at a time to obtain any ordering, without affecting the final temperature. This shows that the final temperature still doesn't depend on the ordering in the general case. Since swapping any two pieces $n$ and $k$ has no effect, we must have $C_n = C_k$ for the optimal ordering, therefore all pieces must have the same heat capacity $C_s/N$ and hence the same size to achieve the lowest final liquid temperature.
So the answer to your question is: | {
"domain": "physics.stackexchange",
"id": 94752,
"lm_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, thermodynamics, thermal-conductivity, heat-conduction",
"url": null
} |
c++, stream, sdl
read = streamReadThorBad;
size = streamSizeThor;
}
I may do a code review of the Surface object later but basically its a wrapper around SDL_Surface. But to give context to the above I will show the usage in the Surface class.
// will be called from `operator>>`
std::istream& Surface::loadFromStream(std::istream& stream)
{
if (stream)
{
try
{
ThorSDLStreamRead streamWrapper(stream);
SDL_Surface* newSurface = IMG_Load_RW(&streamWrapper, 0);
SDL::Surface tmp(newSurface, "Failed to load image from stream");
std::swap(surface, tmp);
}
catch (std::exception const& e)
{
stream.setstate(std::ios::failbit);
}
}
return stream;
} | {
"domain": "codereview.stackexchange",
"id": 44266,
"lm_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++, stream, sdl",
"url": null
} |
c++, reinventing-the-wheel
This is great; this would be the correct thing to do… if allocators weren’t a factor. Let’s put allocators aside for the moment, though. Although this creates an entire third vector, with a possibly redundant internal memory buffer, that’s what you need to do to account for exceptions.
Except… not always though, eh?
Because if T is noexcept copyable, then all you need to do is possibly grow the internal memory buffer (if and only if other.size() > this->capacity()… then just copy over whatever’s there. In other words:
constexpr auto operator=(vector const& other) -> vector&
{
if constexpr (std::is_nothrow_copy_constructible<T>)
{
if (capacity() < other.size())
// This might conceivably throw.
reserve(other.size());
// This shouldn't throw, because all it should do is destruct
// all existing elements (and destructors shouldn't throw),
// then copy construct all the new ones (and we've confirmed | {
"domain": "codereview.stackexchange",
"id": 38736,
"lm_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++, reinventing-the-wheel",
"url": null
} |
A selection of three balls that includes at least one black ball has either one black ball and two of the other six balls, two blacks balls and one of the other six balls, or three black balls and none of the other six balls. Therefore, the number of ways of selecting at least one black ball when three balls are selected from two white, three black, and four red balls is $$\binom{3}{1}\binom{6}{2} + \binom{3}{2}\binom{6}{1} + \binom{3}{3}\binom{6}{0} = 45 + 18 + 1 = 64$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9805806518175514,
"lm_q1q2_score": 0.8571032249968491,
"lm_q2_score": 0.8740772351648677,
"openwebmath_perplexity": 154.21553549898297,
"openwebmath_score": 0.8001653552055359,
"tags": null,
"url": "https://math.stackexchange.com/questions/3030285/ways-of-selecting-3-balls-out-of-9-balls-if-at-least-one-black-ball-is-to-be"
} |
of radio. To 340.1 meters per second this lesson, you 'll learn how to calculate frequency a! We want our frequency to solve the problem close to 340.1 meters per second to... Spring constant k = 20.0 N/m example, it will be given in 1/min, as revolutions per minute of! Quizzes, and your favorite radio station, 84.7 RS period will be given in,! Is an average of how often something repeats few examples by going through some practice problems for.! A calculator, Excel, or contact customer support period ( T ) is the from! Last value will always be equal to the next lesson you must a! Bin numbers ( upper levels ) in the sketch is an essential feature for engines per lap it to.! ( B ) what is the number of times an event occurs in a length... Lesson to a given amount of time it takes for them to happen say you 're how to find frequency a race TV. Fact that period is also the inverse of period adjusted with the frequency in 1/s name: hertz unit:. You need to find the reciprocal of period | {
"domain": "7cloudtech.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9648551515780319,
"lm_q1q2_score": 0.8081819288646529,
"lm_q2_score": 0.8376199552262967,
"openwebmath_perplexity": 1116.3333985343006,
"openwebmath_score": 0.6042473912239075,
"tags": null,
"url": "http://www.7cloudtech.com/1v2x8/01ee4b-how-to-find-frequency"
} |
The two defining conditions in the definition of a linear transformation should “feel linear,” whatever that means. Conversely, these two conditions could be taken as exactly what it means to be linear. As every vector space property derives from vector addition and scalar multiplication, so too, every property of a linear transformation derives from these two defining properties. While these conditions may be reminiscent of how we test subspaces, they really are quite different, so do not confuse the two.
Here are two diagrams that convey the essence of the two defining properties of a linear transformation. In each case, begin in the upper left-hand corner, and follow the arrows around the rectangle to the lower-right hand corner, taking two different routes and doing the indicated operations labeled on the arrows. There are two results there. For a linear transformation these two expressions are always equal.
##### DiagramDLTMDefinition of Linear Transformation, Multiplicative | {
"domain": "neocities.org",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9843363476123224,
"lm_q1q2_score": 0.8202716946367744,
"lm_q2_score": 0.8333246015211009,
"openwebmath_perplexity": 280.99038497609126,
"openwebmath_score": 0.8915245532989502,
"tags": null,
"url": "https://flashman.neocities.org/MD/knowls/subsection.LT.LT.knowl.html"
} |
organic-chemistry, reaction-mechanism, stereochemistry
Title: Predicting the product of a hydrogenation reaction | {
"domain": "chemistry.stackexchange",
"id": 7135,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "organic-chemistry, reaction-mechanism, stereochemistry",
"url": null
} |
Out of necessity, integer addition with a computer is addition modulo $n\text{,}$ for $n$ some larger number. Consider the case where $n$ is small, like 64. Then addition involves the addition of six-digit binary numbers. Consider the process of adding 31 and 1. Assume the computer's adder takes as input two bit strings $a = \left\{a_0,a_1,a_2,a_3,a_4,a_5\right\}$ and $b=\left\{b_0,b_1,b_2,b_3,b_4,b_5\right\}$ and outputs $s = \left\{s_0,s_1,s_2,s_3,s_4,s_5\right\}\text{,}$ the sum of $a$ and $b\text{.}$ Then, if $a = 31 = (1, 1, 1, 1, 1, 0)$ and $b = 1 = (1, 0, 0, 0, 0, 0)\text{,}$ $s$ will be (0, 0, 0, 0, 0, 1), or 32. The output $s_{ }=1$ cannot be determined until all other outputs have been determined. If addition is done with a finite-state machine, as in Example 14.3.9, the time required to get $s$ will be six time units, where one time unit is the time it takes to get one output from the machine. In general, the time required to obtain $s$ will be proportional to the number of | {
"domain": "discretemath.org",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9919380101400315,
"lm_q1q2_score": 0.8200468456171953,
"lm_q2_score": 0.8267117876664789,
"openwebmath_perplexity": 1615.108769389095,
"openwebmath_score": 0.9999842643737793,
"tags": null,
"url": "https://discretemath.org/ads/s-cyclic-groups.html"
} |
# How to find the minimum time for an elevator going up and deccelerating in a building?
The problem is as follows:
The magnitude of the acceleration and decceleration of an elevator is $$4\frac{m}{s^2}$$ and its maximum vertical speed is $$6\frac{m}{s}$$. Find the minimum time (in seconds) such that the elevator goes up and gets to $$90\,m$$ of height departing from rest and arriving with zero speed.
The alternatives given are:
$$\begin{array}{ll} 1.&12.5\,s\\ 2.&13.5\,s\\ 3.&14.5\,s\\ 4.&15.5\,s\\ 5.&16.5\,s\\ \end{array}$$
What I thought doing here was to use the fact that the combined displacement for going up and deccelerating will add to $$90\,m.$$
This is summarized as follows:
$$y=y_{o}+v_ot+\frac{1}{2}at^2$$
The first part reduces to:
$$y_{h}=\frac{1}{2}(4)t^2=2t^2$$
Then for the second equation is:
$$90=y_{h}+6t-\frac{1}{2}4t^2$$
But adding the two expressions result into:
$$90=6t$$
$$t=\frac{90}{6}$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9861513910054508,
"lm_q1q2_score": 0.8108029633269598,
"lm_q2_score": 0.8221891392358014,
"openwebmath_perplexity": 370.418315619764,
"openwebmath_score": 0.8530460596084595,
"tags": null,
"url": "https://math.stackexchange.com/questions/3523025/how-to-find-the-minimum-time-for-an-elevator-going-up-and-deccelerating-in-a-bui"
} |
are vectorized: >> [1,5,3] < [2,2,4] ans = 1 0 1 Two three-element arrays are compared per-element. When you want to access selected elements of an array, use indexing. Defining a Vector; Accessing elements within a vector; Basic operations on vectors; Introduction to Matrices in Matlab. MATLAB uses 0 to represent a logical false, for example 3. octave:3> A = [1, 1, 2; 3, 5, 8; 13, 21, 34] A 1 1 2 3 5 8 13 21 34. MATLAB - Arrays and Matrices 1. ©F 2j0 b131 W IK su ytxa r QS6o0f 7tqw Jakr 1ey DLvLaC8. It was originally designed for solving linear algebra type problems using matrices. MATLAB MATLAB is a software package for doing numerical computation. Stanford Libraries' official online search tool for books, media, journals, databases, government documents and more. A and B must either be the same size or have sizes that are compatible (for example, A is an M-by-N matrix and B is a scalar or 1-by-N row vector). size Determine the number of rows & columns linspace Build a vector | {
"domain": "yiey.pw",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9840936068886641,
"lm_q1q2_score": 0.8478342404928155,
"lm_q2_score": 0.8615382058759128,
"openwebmath_perplexity": 1096.4066404855716,
"openwebmath_score": 0.4491199851036072,
"tags": null,
"url": "http://sgix.yiey.pw/matlab-array-operations.html"
} |
is frequently met in practice). If a coin that comes up heads with probability is tossed times the number of heads observed follows a binomial probability distribution. Variance of Negative Binomial Distribution. success or failure. Functions List of the most important Excel functions for financial analysts. The binomial distribution is a discrete distribution and has only two outcomes i.e. Fixed probability of success. Binomial distribution probability calculator, formulas & example work with steps to estimate combinations, probability of x number of successes P(x), mean (μ), variance (σ²) & standard deviation (σ), coefficient of skewness & kurtosis from n … A machine manufacturing screws is known to produce 5 % defectives. Example of Binomial Distribution. for toss of a coin 0.5 each). The Binomial distribution can be used under the following conditions : 1. It turns out the Poisson distribution is just a… Binomial Distribution. The binomial distribution is a common discrete | {
"domain": "damrell4supervisor.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9736446502128796,
"lm_q1q2_score": 0.8070918299041295,
"lm_q2_score": 0.8289388019824947,
"openwebmath_perplexity": 590.658206810498,
"openwebmath_score": 0.9050467610359192,
"tags": null,
"url": "https://www.damrell4supervisor.com/2l289/binomial-distribution-mean-50dcf8"
} |
newtonian-mechanics, rotational-dynamics, rigid-body-dynamics, gyroscopes
Title: Are these equations correct for the motion of a gyroscope? I was coding a gyroscope simulation and came up with some equations that I used for it.
So firstly,
torque = (change in angular momentum)/(change in time) = (vertical moment of inertia)(vertical angular acceleration) + (gyroscopic angular momentum)(perpendicular angular velocity)
Where vertical MoI = MoI about axis of falling and vertical AngAccel = AngAccel about axis of falling (so like, ignoring its precession) and gyroscopic AM is the AM of the spinning part of the gyroscope and perpendicular AngVel is the AngVel perpendicular to the falling AngVel (so in the direction of the cross product of gyroscopic AM and torque)
and then
(Gyroscopic angular momentum)(vertical angular velocity) = (vertical moment of inertia)(perpendicular angular acceleration) | {
"domain": "physics.stackexchange",
"id": 83936,
"lm_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, rotational-dynamics, rigid-body-dynamics, gyroscopes",
"url": null
} |
c, interpreter, brainfuck
The problem here is that inssize is declared as type size_t but %d expects an int and they might not be the same size (and may be different signedness). Better would be to use %zd which is a modifier that is specifically for a size_t type.
Return an error code
The bf_data_from_file function can detect errors, but summarily exits the entire program rather than returning an error code that would allow the calling function to decide how to handle the error. A more robust design that might allow the code to be reused would return an error code. That way, the calling program could figure out what to do.
Here's how it might work for this program. First, define some error codes:
// Error codes
enum {
BF_OK,
BF_ERR_UNBALANCED_LOOP,
BF_PROGRAM_TOO_LARGE,
BF_LOOP_END_BEFORE_START
}; | {
"domain": "codereview.stackexchange",
"id": 21514,
"lm_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, interpreter, brainfuck",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.