text stringlengths 1 1.11k | source dict |
|---|---|
php, html, comparative-review
echo '<h1>'. $this->escape($tparams->get('page_heading')) . '</h1>';
echo '<div class="page-header">';
echo '<h2>';
if ($this->item->published == 0){
echo '<span class="label label-warning">' . JText::_('JUNPUBLISHED') . '</span>';
}
echo '<span class="contact-name" itemprop="name">'. $this->contact->name . '</span>';
echo '</h2>';
echo '</div>'; | {
"domain": "codereview.stackexchange",
"id": 28661,
"lm_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, html, comparative-review",
"url": null
} |
python
Title: How to read and edit a FASTA file with python using regular expression? I have a file containing protein sequence information of 100 odd proteins. Each sequence starts with a header that looks like this:
>sp|Q9UDW1|QCR9_HUMAN Cytochrome b-c1 complex subunit 9 OS=Homo sapiens OX=9606 GN=UQCR10 PE=1 SV=3
I want to edit these header to look like this:
>Q9UDW1
I have tried the following code:
import re
with open ('WT.fasta', 'r+') as f:
contents = f.readlines()
for i in range(len(contents)-1):
target = re.compile(r'>..\|(.*)\|.*', contents[i])
target.sub(r'\1', contents[i]) | {
"domain": "bioinformatics.stackexchange",
"id": 1920,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python",
"url": null
} |
quantum-mechanics, eigenvalue, laplace-runge-lenz-vector
And finally minimization of its variance. Note that we don't need to actually calculate an integral as in variational methods: we only need a "close enough" approximation of the parameters, the rest can be left to Rationalize. So we use a coarse mesh of points to evaluate the function on. Note also that here we let Mathematica go to complex domain, although the parameters should be real-valued. This lets it avoid singularities in the function by simply going around them, and thus gives much faster convergence.
(* Table is generated not on integers to avoid problems like
division by zero on evaluation *)
With[{
var = Total[Abs[#-Mean@#]^2]& @ Flatten @
Table[test[x,y,z,α,βR + I βI,γR + I γI],
{x,-10.123,10,4},
{y,-10.541,10,5},
{z,-10.07,10,5}
]
},
{minVal,minim} = NMinimize[{var,Total[#^2] == 1 &[{α,βR,βI,γR,γI}] && α>0.1},
{α,βR,βI,γR,γI}]
] | {
"domain": "physics.stackexchange",
"id": 54062,
"lm_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, eigenvalue, laplace-runge-lenz-vector",
"url": null
} |
electromagnetism, boundary-conditions, gauge, magnetostatics
I think that the solution is actually $${\vec A}({\vec r})= \frac{\mu_0}{4\pi}\int\frac{{\vec J}({\vec r}')d^3r'}{|{\vec r}-{\vec r}'|}+\nabla\phi(\vec r)$$ where $\phi(\vec r)$ is a solution of $\nabla^2\phi=0$. I think that to set $\phi=0$, we need additional conditions on $\vec A$. Please explain what condition do we need to invoke, such that we can get Griffiths' solution. The Helmholtz Theorem says that a vector field $\mathbf{A}$ is uniquely determined by ${\rm div}\,\mathbf{A}$, ${\rm curl}\,\mathbf{A}$, and $\mathbf{A}\rightarrow0$ as $r\rightarrow\infty$. So, when dealing with a localized source, as described in the question, there is only a single transverse $\mathbf{A}$ that will vanish at spatial infinity. | {
"domain": "physics.stackexchange",
"id": 88644,
"lm_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, boundary-conditions, gauge, magnetostatics",
"url": null
} |
c++, beginner, multithreading, sorting, mergesort
poolLock.unlock();
pPT = &*itPT;
}
else
m_activeThreads.emplace_back( this ),
itPT = --m_activeThreads.end(),
pPT = &*itPT,
poolLock.unlock(); | {
"domain": "codereview.stackexchange",
"id": 34090,
"lm_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, multithreading, sorting, mergesort",
"url": null
} |
rviz, plugin
Originally posted by gvdhoorn with karma: 86574 on 2021-11-03
This answer was ACCEPTED on the original site
Post score: 1
Original comments
Comment by jasr on 2021-11-04:
Thank you very much for the answer, now I understand what's happening. Do you think there's a way to make this work in foxy? I'm thinking maybe modifying the files with the changes listed in the commit can work, but I can't find in my local foxy files all the files listed in the commit, I can see the .hpp, but the .cpp I don't know where they are. Any suggestions? Really appreciate your help, thanks again!
Comment by gvdhoorn on 2021-11-05:
You could try and see whether you can build Rolling's RViz2 on Foxy, but there are no guarantees it will work.
Failing that, you could try to backport the changes from just the PR to a Foxy source checkout of RViz2 in a Colcon workspace.
Comment by jasr on 2021-11-05:
Got it, thanks again for your help! | {
"domain": "robotics.stackexchange",
"id": 37079,
"lm_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, plugin",
"url": null
} |
quantum-mechanics, photons, heisenberg-uncertainty-principle, lenses
How would the growing uncertainty of the position of photons be manifested if my assumption is true? Is it like photons can suddenly be in a position different from the position it should have been if nothing happened after entering the lens? | {
"domain": "physics.stackexchange",
"id": 72380,
"lm_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, photons, heisenberg-uncertainty-principle, lenses",
"url": null
} |
All that said, one needs to comment that such models are possible, but not for things like dice. For example, in particle physics based on empirical observations it appeared that Bose-Einstein statistic of non-distinguishable particles (see also the stars-and-bars problem) is more appropriate than the distinguishable-particles model. You can find some remarks about those models in Probability or Probability via Expectation by Peter Whittle, or in volume one of An introduction to probability theory and its applications by William Feller. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9867771786365549,
"lm_q1q2_score": 0.8445343783231644,
"lm_q2_score": 0.8558511451289038,
"openwebmath_perplexity": 220.2446653340933,
"openwebmath_score": 0.944078266620636,
"tags": null,
"url": "https://stats.stackexchange.com/questions/225552/how-do-we-know-that-the-probability-of-rolling-1-and-2-is-1-18"
} |
c#, asynchronous, task-parallel-library, async-await
var firstStage = firstStageFunc();
bulkCopy.DestinationTableName = "#temp";
var mappedReader = reader as IDataReaderWithMappings;
if (mappedReader != null)
{
var mappings = mappedReader.GetMappings();
foreach (var sqlBulkCopyColumnMapping in mappings)
{
bulkCopy.ColumnMappings.Add(sqlBulkCopyColumnMapping);
}
}
//Wait for the connection opening and the create table task to finish.
await firstStage.ConfigureAwait(false);
var bulkCopyTask = bulkCopy.WriteToServerAsync(reader);
command.CommandType = CommandType.StoredProcedure;
command.CommandText = loadingStoredProcedureName;
if (args != null)
command.Parameters.AddRange(args); | {
"domain": "codereview.stackexchange",
"id": 6610,
"lm_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#, asynchronous, task-parallel-library, async-await",
"url": null
} |
c++, game, snake-game, fltk
Although it would be simpler to either use body.front() to get the head element, and write:
const Rectangle &Snake::body_head() const {
assert(!body.empty());
return body.front();
}
Although personally, in this particular case, if it is clear that the Snake always has a non-zero body length, I wouldn't write those assert() statements at all; they just clutter the code, and tools like Valgrind can catch out-of-bounds errors as well.
Regardless, I would use an assert in the constructor of Snake to check the length parameter instead of throwing an exception.
Asserts should generally be used to check for assumptions about your own code. But use if (...) plus some kind of error reporting (like throwing an exception) when the condition is something that depends on user input. | {
"domain": "codereview.stackexchange",
"id": 39152,
"lm_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++, game, snake-game, fltk",
"url": null
} |
newtonian-mechanics, friction, work
If it isn't $0$ , where is static friction increasing net Kinetic Energy of the rolling sphere?
The mass of the block which is on smooth surface $\rightarrow \infty$.
Additional comment : Because when we consider rolling w.r.t. ground of a new sphere, the net kinetic energy doesn't change . Rolling KE changes to translation KE or vice-vera depending upon situation . And now static friction should also do this in this case also , however , the deinition of work is also $\vec {F}\cdot \vec {dx}$ for point of application and and now point of application is always moving with $v$ w.r.t. ground, so according to this definition work is not $0$ . So is Kinetic Energy increasing somewhere w.r.t. ground? And if it isn't increasing there's something wrong with the way I am defining work ? | {
"domain": "physics.stackexchange",
"id": 7744,
"lm_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, friction, work",
"url": null
} |
python, python-3.x, dice
# Used as a separator for each round, purely to be aesthetically pleasing
SEP = '------------------------------------------'
CREDENTIALS = {
'user': '2369',
'admin': '1642',
}
def get_logged_on_player(credentials, exclude_players=set()):
"""Ask a user for their name and their PIN and return the username
if successfully authenticated.
This function checks the :credentials: dictionnary for valid usernames
and ask the players to authenticate using their PIN. Keep asking until
a valid username and the corresponding PIN are entered by a player.
If a provided username is found in :exclude_players:, this function
forbids them for logging again.
""" | {
"domain": "codereview.stackexchange",
"id": 42203,
"lm_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, dice",
"url": null
} |
quantum-chemistry, molecular-orbital-theory
So if we take one 1s orbital of one hydrogen atom and another 1s orbital of another hydrogen atom, we need to create two new orbitals by linear combination if we choose to do so. The two orbitals we create correspond to σ and σ*, respectively. (In a spintastic sense, we would have taken two orbitals of each hydrogen, one corresponding to α the other to β. We would receive four orbitals: $\unicode[Times]{x3c3}_\unicode[Times]{x3b1}, \unicode[Times]{x3c3}_\unicode[Times]{x3b2}, \unicode[Times]{x3c3}^*_\unicode[Times]{x3b1}$ and $\unicode[Times]{x3c3}^*_\unicode[Times]{x3b2}$. The electrons now occupy the lowest energy orbitals which are $\unicode[Times]{x3c3}_\unicode[Times]{x3b1}$ and $\unicode[Times]{x3c3}_\unicode[Times]{x3b2}$.) | {
"domain": "chemistry.stackexchange",
"id": 4405,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-chemistry, molecular-orbital-theory",
"url": null
} |
ros, ros-kinetic, rosbridge-server
The rights of the [copied] files are different that they're on the previous pc. Could that be the problem?
yes, the missing permissions are most likely the problem.
You still haven't answered how you copied 'the packages'.
I did the sudo apt-get install... process because i thought that i have to do that.
no, that is not needed (but it should also not matter, as the pkgs in your workspace will/should take precedence over the ones installed in /opt/ros/$distro).
See #q252478 for the process that is typically used for building packages from sources. Note that instead of using git clone .., you copied the packages, but the idea is the same.
Edit:
sry. yes i copied them via usb stick. and i added the python link-files by hand, because they could not be copied by usb stick
If you still have the packages on your 'other pc', I would recommend creating a tarbal of your source space, copying the archive and then extract it on the other machine. That way, permissions should be retained. | {
"domain": "robotics.stackexchange",
"id": 29970,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, ros-kinetic, rosbridge-server",
"url": null
} |
transformer, pytorch, attention
def _in_projection_packed(
q: Tensor,
k: Tensor,
v: Tensor,
w: Tensor,
b: Optional[Tensor] = None,
) -> List[Tensor]:
r"""
Performs the in-projection step of the attention operation, using packed weights.
Output is a triple containing projection tensors for query, key and value.
Args:
q, k, v: query, key and value tensors to be projected. For self-attention,
these are typically the same tensor; for encoder-decoder attention,
k and v are typically the same tensor. (We take advantage of these
identities for performance if they are present.) Regardless, q, k and v
must share a common embedding dimension; otherwise their shapes may vary.
w: projection weights for q, k and v, packed into a single tensor. Weights
are packed along dimension 0, in q, k, v order.
b: optional projection biases for q, k and v, packed into a single tensor
in q, k, v order.
Shape: | {
"domain": "ai.stackexchange",
"id": 3326,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "transformer, pytorch, attention",
"url": null
} |
python, python-3.x, tic-tac-toe
class Game(TicTacToe):
def start(self):
try :
inputnumber = int(input('Input number 0 to 8 \n'))
except ValueError :
self.start()
if 0 <= inputnumber <= 8 :
if (self.draw[inputnumber] == '\U00002B55') or (self.draw[inputnumber] == '\U0000274C') :
print("This place is already paused")
self.start()
else :
self.fillNumber(inputnumber)
else :
self.start()
self.Print()
self.check()
def check(self):
if self.condition() == False :
self.start()
elif self.condition() == '\U00002B55' :
print(self.condition()," Player one is winner")
elif self.condition() == '\U0000274C' :
print(self.condition()," player two is winner") | {
"domain": "codereview.stackexchange",
"id": 36574,
"lm_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, tic-tac-toe",
"url": null
} |
complexity-theory, graphs, optimization, integer-programming
In order to easily build a solution to the original Exact Cover instance from $(X, f)$, we want the ground-set elements having some particular colour to be exactly the ground-set elements in some set in $A$: then we can simply go through each colour present in the solution to the your problem (i.e., in the range of $f$) and include the corresponding set from $A$ in the Exact Cover solution. So in other words, we would like to have a solution $(X, f)$ that has $f(x_i) = c_i$ for each $x_i \in X$. But this is complicated by the fact that $X$ could contain sets that overlap, which is of course forbidden in an Exact Cover solution. Between any pair $x \in X, x' \in X$ there are two kinds of potential overlap: containment (either $x \subset x'$ or vice versa), and "proper overlapping", where $x \cap x' \neq \emptyset$ but neither set contains the other. | {
"domain": "cs.stackexchange",
"id": 8328,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "complexity-theory, graphs, optimization, integer-programming",
"url": null
} |
php, url-routing
class Router
{
private $segments = array();
private $parameters = array();
/*
* When a new Router instance is created,
* fill it with information of the visited route
*/
public function __construct()
{
$this->getSegments();
$this->getParameters();
}
/*
* Get the current requested URL
*/
private function getURI()
{
return rtrim(substr($_SERVER['REQUEST_URI'], 1), '/');
}
/*
* Store the route segments (controller, method, parameters)
*/
private function getSegments()
{
$uri = $this->getURI();
$this->segments = explode('/', $uri);
} | {
"domain": "codereview.stackexchange",
"id": 23804,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "php, url-routing",
"url": null
} |
black-hole, supermassive-black-hole
Title: If a black hole has a mass of a universe what will be the volume of it? Will it suck the entire universe in? What will the black hole look like to us, assuming we do not immediately get sucked in? According to measurements of the cosmic microwave background the universe is geometrically flat - which means that the mass/energy density of the universe is close to the "critical value" of $\sim 10^{-26}$ kg/m$^{3}$.
The radius of the observable universe is 46.6 billion light years, so the mass/energy contained within it is equivalent to $3.6\times 10^{54}$ kg.
The Schwarzschild radius of a black hole is $2GM/c^2$. If the mass/energy of the universe is spherically symmetric then its Schwarzschild radius is 560 billion light years and thus larger than the observable universe.
Note though that the Schwarzschild solution in General Relativity is static. The universe is definitely not static. | {
"domain": "astronomy.stackexchange",
"id": 6553,
"lm_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, supermassive-black-hole",
"url": null
} |
gazebo
It would be especially helpful if someone could give me pointers on doing this using the rospy ServiceProxy.
Originally posted by Ben B on Gazebo Answers with karma: 175 on 2014-02-24
Post score: 1
Got it. The answer is that the SDF argument is not a location to an SDF file -- it's the whole content of the SDF file.
To access this in rospy, you can do this:
import rospy
from gazebo_msgs.srv import SpawnModel
from geometry_msgs.msg import Pose
rospy.init_node('insert_object',log_level=rospy.INFO)
initial_pose = Pose()
initial_pose.position.x = 1
initial_pose.position.y = 1
initial_pose.position.z = 1
f = open('/home/benb/Dropbox/RoboticsResearch/WAMInProgress/tp/AllInOne/Trajectory_Phonebook/ros_stuff/src/iiim_wam_description/wam.sdf','r')
sdff = f.read()
rospy.wait_for_service('gazebo/spawn_sdf_model')
spawn_model_prox = rospy.ServiceProxy('gazebo/spawn_sdf_model', SpawnModel)
spawn_model_prox("some_robo_name", sdff, "robotos_name_space", initial_pose, "world") | {
"domain": "robotics.stackexchange",
"id": 3556,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gazebo",
"url": null
} |
physics
Originally posted by gianluca.bardaro on Gazebo Answers with karma: 3 on 2016-03-24
Post score: 0
The title of your question is about using your own physics engine, but you also mention altering the behavior of simulation elements . To me this implies you'd like to use an existing physics engine but change its behavior. I'll try to answer both versions.
Use a new physics engine
Option 1 : Implement the physics API
If you have an existing physics engine, you can implement Gazebo's physics interface just as ODE, Bullet, Simbody, and DART have done. This is a non-trivial amount of work. Take a look at the PhysicsFactory, and at the ODE implementation for reference.
Option 2: Use gazebo as a library
You can use gazebo as a library, which would allow your physics engine to control simulation. Take a look here for a simple example of using gazebo in a custom main loop.
Option 3: Write a plugin | {
"domain": "robotics.stackexchange",
"id": 3894,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "physics",
"url": null
} |
ruby, functional-programming
inject({}) do |result, element|
key = yield element
result.merge({ key => result.fetch(key, []) + [element] })
end
end | {
"domain": "codereview.stackexchange",
"id": 38338,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ruby, functional-programming",
"url": null
} |
machine-learning, python, tools, xgboost
So, yes it is a complete paradigm in itself. But, when you want more than the limitations of xgboost like linear and tree models, then you can use the concept of ensembling.
In the case of ensembles, the tools/libraries which can be used depends on the data scientist who is conducting the experiment. It can be Keras or Theano or TensorFlow, or anything which he/she is comfortable with. (opinion-based) | {
"domain": "datascience.stackexchange",
"id": 528,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "machine-learning, python, tools, xgboost",
"url": null
} |
java, asynchronous, error-handling, http, guava
First, to DRY the code, I'd try to extract out some hostname list handling logic to a separate class:
public class Hosts {
private final LinkedList<String> hostsnames = newLinkedList();
public Hosts(final List<String> hosts) {
checkNotNull(hosts, "hosts cannot be null");
this.hostsnames.addAll(hosts);
}
public Optional<String> getNextAvailableHostname() {
while (!hostsnames.isEmpty()) {
String firstHostname = hostsnames.removeFirst();
if (!ClientUtils.isEmpty(firstHostname) && !ShardMapping.isBlockHost(firstHostname)) {
return Optional.of(firstHostname);
}
}
return Optional.absent();
}
public boolean isEmpty() {
return hostsnames.isEmpty();
}
} | {
"domain": "codereview.stackexchange",
"id": 13125,
"lm_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, asynchronous, error-handling, http, guava",
"url": null
} |
homework-and-exercises, electrostatics, voltage
$$ \nabla^2 \Phi = \frac{J}{\sigma} \delta(\vec{r}) $$
with $\Phi(\vec{r}=R\vec{e_r})=0$ for $\vec{e_r}$ being the boundary condition. And you are right, this can be solved using the method of a Green's function, the one obeying the auxiliary problem:
$$ \nabla^2 \Phi' = \delta(\vec{r}) $$
with the same boundary condition $\Phi'(\vec{r}=R\vec{e_r})=0$.
Mathematically, what you have done seems to be fine to me, assuming that your $x$ is the radial coordinate of canonical spherical coordinates. | {
"domain": "physics.stackexchange",
"id": 31688,
"lm_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, electrostatics, voltage",
"url": null
} |
fft, window-functions
The amplitudes for the rectangle window do not match if I apply this scaling. Is this rather caused by spectral leakage?
Do I have to apply an additional scaling to account for the shape of the window function, i.e. so the integral remains the same? I do not immediately see any SNR advantage to splitting and averaging assuming you are dealing with additive white noise. I will explain why in case there are other possible approaches- but before detailing in simple terms, the SNR for the case of additive white noise is directly related to the bin width in frequency, and the bin width in frequency is inversely related to the length. For the rectangular window, the equivalent noise bandwidth is 1 bin wide. If we halve the number of bins, the bin width will double and therefore noise will double (+3 dB). If we average the result of two bins, the noise will go down by 1/2 relative to the signal (-3dB). So we ended up doing a lot of work to get back to where we started. | {
"domain": "dsp.stackexchange",
"id": 4978,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fft, window-functions",
"url": null
} |
functional-programming, matrix, f#
combining the foralls
let isColumnFeasible =
List.forall (fun (n, q) -> (n <> 0 || q >= 100) && q <> 0)
let isMatrixFeasible =
List.exists isColumnFeasible
we arrive at "a matrix is feasible when there exists a feasible column, i.e. a column containing no significant zeros" (significant = q < 100).
Finally, use "%b" to print bools and _ for unused args:
[<EntryPoint>]
let main _ =
printf "%b" <| isMatrixFeasible exampleMatrix
System.Console.ReadKey() |> ignore
0
Whether that's equivalent to the paper, I don't know. For sure it is easier to understand than the original version. | {
"domain": "codereview.stackexchange",
"id": 23190,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "functional-programming, matrix, f#",
"url": null
} |
That worked beautifully!! Thank you
Thanks for the help. Looks like great minds think alike
Oh wow, that does look a LOT more elegant.
Drawing that final vector from P2 will end up somewhere inside the triangle right? | {
"domain": "physicsforums.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.98504291340685,
"lm_q1q2_score": 0.8468056835817306,
"lm_q2_score": 0.8596637487122111,
"openwebmath_perplexity": 309.51398753979566,
"openwebmath_score": 0.6619112491607666,
"tags": null,
"url": "https://www.physicsforums.com/threads/putting-a-point-inside-a-triangle-in-3d-space.933690/"
} |
context-free, automata, trees
The Assignment: https://i.stack.imgur.com/E3Xqx.jpg
Previous Assignment + Answers:https://i.stack.imgur.com/ryM2Q.jpg (1) It's always helpful to start listing some strings to get an idea of what kind of language we accept. I'm going to be making some assumptions here, but you should verify that these assumptions are true with whoever gave the assignment (they might be bad assumptions).
$\delta$ is the start symbol. We want to derive this until we get a string of only terminal symbols, either $0$s or $1$s. What's the smallest string we can derive? Well, we can get $0A$ from $\delta$, and from $\alpha A$ (I assume $\alpha$ is any string), we can derive $\alpha^T \alpha \alpha^T$; therefore, from $0A$ we can derive $0^T 0 0^T$. Since $T$ isn't defined, I assume it's a free variable - from context, I assume an integer - which means it can assume any natural value. Therefore, we can derive $0$, $00$, ... (i.e., $0^+ = 00^*$) from $0A$. | {
"domain": "cs.stackexchange",
"id": 2811,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "context-free, automata, trees",
"url": null
} |
swift, quiz
// The previous is exactly the same as the following:
answerLabel.text = (currentQuestion.answer == true) ? "correct" : "Incorrect"
You can read more about the Ternary Conditional Operator here.
You can see my result from trying to recreate your current setup as inspiration (FYI, my buttons have the titles "True" and "False", which I make use of to turn them into booleans):
//
// ViewController.swift
// TrueFalseQuiz
//
// Created by Stefan Veis Pennerup on 06/06/15.
// Copyright (c) 2015 Kumuluzz. All rights reserved.
//
import UIKit
class ViewController: UIViewController { | {
"domain": "codereview.stackexchange",
"id": 13956,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "swift, quiz",
"url": null
} |
performance, c, linux, curses, tetris
void ManipulateCurrent(int action){
Shape temp = CopyShape(current);
switch(action){
case 's':
temp.row++; //move down
if(CheckPosition(temp))
current.row++;
else {
WriteToTable();
Halleluyah_Baby(); //check full lines, after putting it down
GetNewShape();
}
break;
case 'd':
temp.col++; //move right
if(CheckPosition(temp))
current.col++;
break;
case 'a':
temp.col--; //move left
if(CheckPosition(temp))
current.col--;
break;
case 'w':
RotateShape(temp); //yes
if(CheckPosition(temp))
RotateShape(current);
break;
}
DeleteShape(temp);
PrintTable();
} | {
"domain": "codereview.stackexchange",
"id": 44596,
"lm_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, c, linux, curses, tetris",
"url": null
} |
Therefore, the matrix representation of $T-S$ with respect to $B$ is again diagonal, with diagonal entries $\lambda_1-\alpha, \lambda_2-\alpha, ..., \lambda_n-\alpha$ because $(T-S)(v_i) = T(v_i) - S(v_i) = (\lambda_i - \alpha)(v_i)$, $v_i \in B, 1 \leq i \leq n$.
Is my conclusion correct?
• yes it is correct Jun 10 '18 at 14:07
• @ Hello: Thank you! Jun 10 '18 at 14:07
A different way to formulate it is by using the following properties of basis representation:
Let $B$ be any basis of $\Bbb R^n$:
• The matrix representation is linear:
If $\mathcal L,\mathcal L'\colon \Bbb R^n \to \Bbb R^n$ are linear mappings and $r,s\in\Bbb R$ , then $[r\mathcal L+s\mathcal L']_B=r[\mathcal L]_B+s[\mathcal L']_B$.
• The matrix representation of identity is basis invariant:
If $\mathcal{I}(x)=x$ for all $x\in\Bbb R^n$, and $B'$ is a basis of $\Bbb R^n$ then $[\mathcal{I}]_B=[\mathcal{I}]_{B'}$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9865717448632122,
"lm_q1q2_score": 0.8199822428300871,
"lm_q2_score": 0.8311430436757312,
"openwebmath_perplexity": 79.66070550698147,
"openwebmath_score": 0.9810378551483154,
"tags": null,
"url": "https://math.stackexchange.com/questions/2814609/matrix-representation-of-linear-operators"
} |
python, object-oriented, design-patterns, flask
Fourth, the register_user() method is a natural fit for a classmethod in
the User class:
class User:
@classmethod
def register_user(cls, email, password):
# Python allows you to call functions in keyword style even if the
# function defines arguments as required positionals. You can use
# this feature to simplify the code (eliminate some temporary
# variables in this case) while still preserving code readability.
today = datetime.today().strftime('%Y-%m-%d')
return cls(
email,
password,
registration_date = today,
active = 1,
sign_in_count = 2,
current_sign_in_on = today,
last_sign_in_on = today,
) | {
"domain": "codereview.stackexchange",
"id": 40726,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, object-oriented, design-patterns, flask",
"url": null
} |
of differential eqauations, series solutions as well as a brief introduction to boundary value problems, Fourier series and partial differntial equations. the equation is called a linear homogeneous difference equation. MichaelExamSolutionsKid 2020-11-10T08:37:24+00:00. Within this String Function example query, we used this difference function to find the SOUNDEX difference between the variable @Str and ‘SQL Server’.. (The Mathe- matica function NDSolve, on the other hand, is a general numerical differential equation solver.) 1 ENGG 1203 Tutorial Systems and Control 12 April Learning Objectives Difference Equations Z-transform Poles Ack. SELECT DIFFERENCE(@Str, 'SQL Server') AS 'SQL_Difference 1' DIFFERENCE Function Example 2. 26 May 2009 Solution of difference equations using Z - transform. are links to short tutorial videos posted on YouTube. 4 questions. Z Transform of Difference Equations. 3. Definition 2. Practice. Usually the actual values of the parameters are found from | {
"domain": "bonto.cz",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9752018441287092,
"lm_q1q2_score": 0.8249646267838173,
"lm_q2_score": 0.845942439250491,
"openwebmath_perplexity": 1386.4110616944672,
"openwebmath_score": 0.4894700050354004,
"tags": null,
"url": "https://www.bonto.cz/portland-protest-geynxq/a9f864-difference-equation-tutorial"
} |
java, object-oriented, tree, search, generics
protected MctsTreeNode(StateT representedState, Cloner cloner) {
this(null, null, representedState, cloner);
}
private MctsTreeNode(MctsTreeNode<StateT, ActionT, AgentT> parentNode, ActionT incomingAction,
StateT representedState, Cloner cloner) {
this.parentNode = parentNode;
this.incomingAction = incomingAction;
this.representedState = representedState;
this.visitCount = 0;
this.totalReward = 0.0;
this.childNodes = new ArrayList<>();
this.cloner = cloner;
}
protected MctsTreeNode<StateT, ActionT, AgentT> getParentNode() {
return parentNode;
}
protected ActionT getIncomingAction() {
return incomingAction;
}
protected int getVisitCount() {
return visitCount;
}
protected int getParentsVisitCount() {
return parentNode.getVisitCount();
} | {
"domain": "codereview.stackexchange",
"id": 15754,
"lm_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, tree, search, generics",
"url": null
} |
strings, file, integer, common-lisp
Title: Reading lines of integers into a list of lists I have a text file containing integers in different lines which I want to read into a list of lists.
So
01
11 14
45 50 09
should become
((1)
(11 14)
(45 50 9))
The real file is longer so I want to read it in using CL instead of transforming it using Emacs' macros etc. It is important that every line becomes exactly one list and the data is stored as integers, i.e. 09 becomes 9.
I ended up with the following (using the external library split-sequence):
(defun read-data (&optional (file "data.txt"))
"Returns the numerical data in FILE as a list of lists."
(with-open-file (data file)
(loop :for line = (read-line data nil nil)
:while line
:collect (map 'list #'parse-integer (split-sequence #\Space line))))) | {
"domain": "codereview.stackexchange",
"id": 28805,
"lm_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, file, integer, common-lisp",
"url": null
} |
# Tag Info
20
There are, in fact, two different formulas for standard deviation here: The population standard deviation $\sigma$ and the sample standard deviation $s$. If $x_1, x_2, \ldots, x_N$ denote all $N$ values from a population, then the (population) standard deviation is $$\sigma = \sqrt{\frac{1}{N} \sum_{i=1}^N (x_i - \mu)^2},$$ where $\mu$ is the mean of the ...
17
Your guess is correct: least absolute deviations was the method tried first historically. The first to use it were astronomers who were attempting to combine observations subject to error. Boscovitch in 1755 published this method and a geometric solution. It was used later by Laplace in a 1789 work on geodesy. Laplace formulated the problem more ...
9 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9773707986486797,
"lm_q1q2_score": 0.8058050135458591,
"lm_q2_score": 0.8244619285331332,
"openwebmath_perplexity": 570.8981582830204,
"openwebmath_score": 0.9024236798286438,
"tags": null,
"url": "http://math.stackexchange.com/tags/standard-deviation/hot"
} |
perhaps on a set of measure zero integral symbol, a definite is. ( in Russian ) classical and modern integration theories '', Springer ( 1965 ) K.R! By V.A the # 1 tool for creating Demonstrations and anything technical functions was stated A.L! M. Symbolic integration I: Transcendental functions perhaps on a set of measure zero 14! Of spectral decompositions ) and using partial integration, integration is one the. Our graphing tool Irresistible integrals: Symbolics, analysis and Experiments in the upper lower! Finite Terms: Liouville 's Theory of functions and functional analysis '', Acad a. England: Cambridge University Press, p. 29, 1988 the slices in. Real analysis '', Acad interesting case for applications is when the function area... However, the first fundamental theorem of calculus go in the study of spectral decompositions the... Points and many useful quantities such as areas, volumes, central points and many useful things originator ) its! Analysis '', Hafner ( 1952 ) ( in | {
"domain": "grecotel.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.984093606422157,
"lm_q1q2_score": 0.8601738073467186,
"lm_q2_score": 0.8740772236840656,
"openwebmath_perplexity": 1183.2569398418889,
"openwebmath_score": 0.9133315682411194,
"tags": null,
"url": "http://dreams.grecotel.com/white-background-dtksbvo/a7dd49-integral-meaning-in-maths"
} |
set U which are not in A. Scroll down the page … The complement of A, denoted by , is the complement of A with respect to U (which is U-A). Set Operations include Set Union, Set Intersection, Set Difference, Complement of Set, and Cartesian Product. Set Operations •Let A be the set of students who live within one mile of school and let B be the set … The complement of relation R can be written. Here four basic operations are introduced and their properties are discussed. Bringing the set operations together. Online set theory calculator which helps to find complement of given sets. Complement of Sets Calculator. A set is a collection of items. Without a definition of the universal set, you can't really give a standard-library definition of the complement of a set.. = {x | x A} U A. The following identities capture important properties of absolute complements: Relationships between relative and absolute complements: The first two complement laws above show that if A is a non-empty, | {
"domain": "slow-wine.net",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9752018405251303,
"lm_q1q2_score": 0.8327372919519038,
"lm_q2_score": 0.8539127566694177,
"openwebmath_perplexity": 517.7025355493508,
"openwebmath_score": 0.7289803624153137,
"tags": null,
"url": "https://slow-wine.net/e5otta77/a5217d-set-operations-complement"
} |
# [SOLVED]How to use Taylor series to represent any well-behaved f(x)
#### DeusAbscondus
##### Active member
Does one assess $x$ at $x=0$ for the entire series? (If so, wouldn't that have the effect of "zeroing" all the co-efficients when one computes?)
only raising the value of $k$ by $1$ at each iteration?
and thereby raising the order of derivative at each iteration?
$$\sum_{k=0}^{\infty}\frac{f^{k}(0)}{k!} x^k= f(0)+\frac{df}{dx}|_0 \ x + \frac{1}{2!}\frac{d^2f}{dx^2}|_0 \ x^2+ \frac{1}{3!}\frac{d^3f}{dx^3}|_0 \ x^3+ ....$$
I have no experience with series or sequences, so, I know I have to remedy this gap in my knowledge.
In the interim, however, I am currently enrolled in a Math course that looks at Calculus by beginning with Taylor series.
I am an adult beginner at Math, having done an introductory crash course in Calculus last year; I wanted to flesh this out: hence my current enrolment. | {
"domain": "mathhelpboards.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.977022625406662,
"lm_q1q2_score": 0.8605586766336222,
"lm_q2_score": 0.880797081106935,
"openwebmath_perplexity": 391.1908091856933,
"openwebmath_score": 0.949510395526886,
"tags": null,
"url": "https://mathhelpboards.com/threads/how-to-use-taylor-series-to-represent-any-well-behaved-f-x.4960/"
} |
formal-languages, formal-grammars
For example, a string generated by the grammar is $((\:)(\:)((\:]\,(((\:)(\:)))$, where I've separated the $N$ and $B$ substrings for clarity.
As I said at the start, not pretty. | {
"domain": "cs.stackexchange",
"id": 7341,
"lm_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, formal-grammars",
"url": null
} |
sql, vb.net, authorization
MyConnection.Dispose()
sqlCmd.Dispose()
End Try
End Function
Code for getDataTableFromSqlCMD:
Public Shared Function getDataTableFromSqlCmd(ByVal sqlCmd As SqlCommand) As DataTable
Dim dt As New DataTable
Dim MyAdapter As New SqlDataAdapter(sqlCmd)
Try
sqlCmd.CommandTimeout = m_iSQLTimeOut
MyAdapter.Fill(dt)
getDataTableFromSqlCmd = dt
Catch ex As Exception
Throw New ApplicationException("GET DATA TABLE ERROR")
Finally
sqlCmd.Dispose()
MyAdapter.Dispose()
dt.Dispose()
End Try
End Function | {
"domain": "codereview.stackexchange",
"id": 22614,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "sql, vb.net, authorization",
"url": null
} |
computability, primitive-recursion
So $A$ is a primitive recursive set.
Now, to prove that $g$ is primitive recursive can I take :
$g(i)=\sum\limits_{i=0}^{n} \chi_{A}(i)$ with $χ_A(i)=1$ if $i∈A$.and $g$ is a finite sum of primitive recursive functions so it is primitive recursive? A computable function is primitive recursive if and only if it can be computed by a program whose running time is upper-bounded by some primitive recursive function. Your function (usually known as Euler's totient function $\varphi$) can be computed in exponential time, and so is primitive recursive. | {
"domain": "cs.stackexchange",
"id": 6909,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "computability, primitive-recursion",
"url": null
} |
python, animation, pygame, python-2.x
Grid lines remain parallel and evenly spaced (algebraically): $$T(ax + by) = aT(x) + bT(y)$$
The origin remains fixed:
$$T(0) = 0$$
It is easy to show (and very important in their study) that a linear transformation is fully defined by its effects on the basis vectors, that are just four numbers.
These numbers are usually put in a matrix A associated with T:
$$A=\begin{pmatrix}a&b\\c&d\end{pmatrix}$$
Such that $$T(1, 0) = (a, b) $$
$$ T(0, 1) = (c, d) $$
(Putting these results in rows or columns is just a convention). | {
"domain": "codereview.stackexchange",
"id": 31537,
"lm_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, animation, pygame, python-2.x",
"url": null
} |
neural-networks, deep-learning, reference-request, c
This following paper describes a DL approach to what is almost the 'reverse problem' to yours - generating the source code for a program described in natural language.
I found the strength of the results reported in this paper surprising, but it does give me some hope that what you are asking might be possible. | {
"domain": "ai.stackexchange",
"id": 2437,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "neural-networks, deep-learning, reference-request, c",
"url": null
} |
algorithms, graphs, correctness-proof, minimum-spanning-tree
Why does this theorem require that the cut $(S,V-S)$ respect $A$? How is this requirement used in the correctness proof? I do not see what would fail if the requirement was removed.
Some Definitions:
Cut: A cut $(S, V-S)$ of an undirected graph $G=(V,E)$ is a partition of $V$.
Cross: An edge $(u,v) \in E$ crosses the cut $(S,V-S)$ if one of its endpoints is in $S$ and the other is in $V-S$.
Respect: A cut respects a set $A$ of edges if no edge in $A$ crosses the cut.
Light edge: An edge is a light edge crossing a cut if its weight is the minimum of any edge crossing the cut. I don't have the book handy. I assume that
"safe" means that $(u,v)$ can be added to $A$ and we get another subset of a minimal spanning tree of $G$, and
the goal is a correctness proof of Prim's algorithm¹. | {
"domain": "cs.stackexchange",
"id": 6779,
"lm_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, correctness-proof, minimum-spanning-tree",
"url": null
} |
php, mysql, security, captcha
Title: Detecting if a CAPTCHA is needed I wish to ask if the code written below has any holes (probably it will be useful for someone else). This code checks, by IP and by userid, if more than 5 attempts within the last 5 minutes were made to login. Every attempt to log in is stored in the history table (MySQL).
The history table is needed only for the purpose of CAPTCHA displaying. ENGINE=InnoDB is chosen for history table.
No indexes were put on Time or userid or remote_addr.
Any suggestions about optimization?
$query1="SELECT id FROM history
WHERE (Time>date_sub(now(), interval 5 minute))
AND remote_addr='" . ip2long($_SERVER['REMOTE_ADDR']) . "' limit 6";
//limit 6 is for performance, 6+ means 6, we only care if it less than 5
$result1=mysql_query($query1);
//so we know mysql_num_rows($result1) | {
"domain": "codereview.stackexchange",
"id": 1619,
"lm_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, mysql, security, captcha",
"url": null
} |
line AC is a diameter, the angle ABC is a right angle.Thales's theorem is a special case of the inscribed angle theorem and is mentioned and proved as part of the 31st proposition in the third book of Euclid's Elements. We have thus shown:For any triangle, the center of its inscribed circle is the intersection of the bisectors of the angles.We will use Figure 2.5.6 to find the radius $$r$$ of the inscribed circle. For an obtuse triangle, the circumcenter is outside the triangle. The Top Notes, Premium A-to-Z Microsoft Excel Training Bundle, 97% off The Ultimate 2021 White Hat Hacker Certification Bundle, 98% off The 2021 Accounting Mastery Bootcamp Bundle, 99% off The 2021 All-in-One Data Scientist Mega Bundle, 59% off XSplit VCam: Lifetime Subscription (Windows), 98% off The 2021 Premium Learn To Code Certification Bundle, 62% off MindMaster Mind Mapping Software: Perpetual License, 41% off NetSpot Home Wi-Fi Analyzer: Lifetime Upgrades, What's New in iOS 14? Move one or more of the | {
"domain": "com.pl",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9664104924150546,
"lm_q1q2_score": 0.8115277171957763,
"lm_q2_score": 0.8397339676722393,
"openwebmath_perplexity": 814.5840034889102,
"openwebmath_score": 0.5601709485054016,
"tags": null,
"url": "http://www.zwg.com.pl/4160fs/right-triangle-inscribed-in-a-circle-1f17a4"
} |
electromagnetism, magnetic-fields, electric-fields, thermal-radiation, electromagnetic-induction
In this sense, radiation is harder to destructively cancel than stationary fields. You often still get things propagating out to infinity like $1/r$ even when you contrive things, like using two or three radio antennas and perfectly adjust the phase offsets to get better coverage of a distant metro area by constructive interference at the expense of some of the countryside.
Of course in blackbody radiation, all of these charges whose fields cancel are bumping around randomly and accelerating that way: so they still emit radiation as they accelerate, but they are in absolutely no sort of order to cancel that radiation over any sort of long range. | {
"domain": "physics.stackexchange",
"id": 68068,
"lm_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, magnetic-fields, electric-fields, thermal-radiation, electromagnetic-induction",
"url": null
} |
java, game, dice
This is both bad practise and a bug. NPE has a very specific meaning and it should not be used to convey information of invalid input. Catching NPE is always a result of programming error. Also, catching this breaks the loop that was supposed to run 15 times, and then exeutes the last method call from the loop once. In no way can it be intended functionality if the loop exits from first round.
Yahtzee is supposed to be played so that each player plays one round a time. In the code one player plays all 15 rounds immediately before passing turn to next player. Something like this:
for (int turn = 1; turn <= 15; turn++) {
for (Player: players) {
// Play one turn.
}
}
I don't see the scanner being passed to the Player objects so they can read the input for the category selection. I hope they are not constructing their own scanners that read from System.in... | {
"domain": "codereview.stackexchange",
"id": 34609,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, game, dice",
"url": null
} |
ruby, datetime, regex, interview-questions
For example, add_minutes('9:13 AM', 10) would return 9:23 AM
Additional notes:
We just want to see how you code, so this exercise is not meant to be too hard or take too long.
If you spend an hour on this, stop coding and finalize by adding some notes about what you would do if you had more time.
Although my Ruby proficiency has somewhat atrophied due to primarily working with php for the last 8 months, I was able to produce the following well-within one-hour of beginning the challenge:
# FIRST ATTEMPT
# require 'time'
# def flux_capacitor(time,mins)
# the_time = Time.parse(time.to_s)
# mins = the_time + 10*60
# end
# FINAL REFACTOR
def flux_capacitor(time,mins)
the_time = time.scan(/\d/).join('').to_i
meridian = time.scan(/(A|M|P)/).join('')
new_time = the_time + mins
back_in_time = new_time.to_s.insert(-3,':') + " #{meridian}"
end
puts flux_capacitor("9:13 AM",10)
puts flux_capacitor("9:13 PM",10)
p flux_capacitor("10:13 PM",10).class
# DOX | {
"domain": "codereview.stackexchange",
"id": 18757,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ruby, datetime, regex, interview-questions",
"url": null
} |
c++, reinventing-the-wheel, mergesort, c++17
The standard-library already has to do that in many places, and thankfully it is available to the public as std::move_if_noexcept() analogous to std::move.
I suggest adding your own helper which does that for iterators.
You know, it's itching in my fingers to modify merge() to use the conditional operator. Especially after applying the above point, which makes the common part even bigger.
One of the advantages moveing is that it allows for guaranteed success in more cases. Yes, writing flexible and comprehensive noexcept-specifications can be a pain, but your callers will thank you.
Without doing that work, a good part of the advantage of the two-range version is lost.
I would suggest renaming your iterator-ranges source and target respectively, neither is properly scratch. Also, I would use the more common temp as a name in merge_sort(begin, end).
Are you aware of the sordid tale that is std::vector<bool>?
I'm not saying it won't work in this case, though slowly. | {
"domain": "codereview.stackexchange",
"id": 31650,
"lm_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, mergesort, c++17",
"url": null
} |
specify the direction angles of the vector forms with the direction cosines direction! Thing is to say 23 km/h, a better way is to say 23 km/h, better! - Examples axes are called direction angles find the direction cosines and direction angles of the vector to the nearest degree. number has been announced a with. Is to say 23 km/h, a better way is to say km/h... Step 2: direction angles of the vector are angles correct to nearest... Coordinate axes made by a line or a vector with the direction Angels of Vectos! To Find the direction angles of the vector a are the cosines of angles find the direction cosines and direction angles of the vector the vector are, c... Which your vector is applied angles correct to the nearest degree. question Find. Find the direction angles correct to the nearest degree. has been announced better way is to say km/h... A are the cosines of angles that the vector 1 2, √ 2 2 only!: direction angles correct to the nearest degree. are called direction angles of | {
"domain": "vftr.es",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9724147201714922,
"lm_q1q2_score": 0.8226068822333621,
"lm_q2_score": 0.8459424411924673,
"openwebmath_perplexity": 970.986567644874,
"openwebmath_score": 0.712080180644989,
"tags": null,
"url": "http://vftr.es/assassin-s-tnlu/find-the-direction-cosines-and-direction-angles-of-the-vector-eb69b2"
} |
opencv, windows
Title: Displaying openCV's windows
Hello,
I made a program on OpenCV that used fonctions like "NamedWindow" wich display a window with GTK, or Qt, etc..
Now in my ROS program, "autopilote.cpp" i've included "<opencv2/opencv.hpp>" and put my OpenCV code into it. It seems to correctly get the video capture, analyse it, and correctly publish results. But no windows are displaying. And I can't see somes errors or warning about this.
Have you got somes advices to display the windows ? Is this feature enabled in opencv in ros ? Should I create windows in another way ?
Thanks you
Originally posted by AntKa on ROS Answers with karma: 1 on 2014-05-08
Post score: 0
Have you included opencv's waitKey command after updating the windows?
From opencv user interface docs on the waitKey function: | {
"domain": "robotics.stackexchange",
"id": 17881,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "opencv, windows",
"url": null
} |
13
Hint: Fair coin $\implies$ Probability of tails occurring more $=$ probability of heads occurring more $= p$, say. Probability of exactly equal number of heads and tails $=1-2p$. Can you find this one?
13
Consider $$f(x)=\begin{cases}0&\text{if }x<0\\1&\text{if }x\ge 0\end{cases}$$ Any continuous $g$ with $||f-g||_\infty<\frac 13$ must have $g(x)<f(x)+\frac13=\frac13$ for all $x<0$. By countinuity, $g(0)\le \frac13$, contradicting $g(0)>f(0)-\frac13=\frac 23$. Even if we only require $|f(x)-g(x)|<\frac13$ for almost all $x$, the ...
13
The probability that you get no tails when you flip a fair coin $10$ times is $\left(\frac12\right)^{10}$. The probability that you get at least one tail is therefore $1-\left(\frac12\right)^{10}$. The probability that each of the $1000$ coins comes up tails at least once is then $$\left(1-\left(\frac12\right)^{10}\right)^{1000}\approx0.37642\;.$$ We want ...
Only top voted, non community-wiki answers of a minimum length are eligible | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.974434788304004,
"lm_q1q2_score": 0.8033843889977533,
"lm_q2_score": 0.824461932846258,
"openwebmath_perplexity": 211.42318618170574,
"openwebmath_score": 0.9148450493812561,
"tags": null,
"url": "http://math.stackexchange.com/tags/probability-theory/hot?filter=all"
} |
rosjava, android, image-transport
Originally posted by Tuan with karma: 111 on 2011-08-05
This answer was ACCEPTED on the original site
Post score: 3 | {
"domain": "robotics.stackexchange",
"id": 6346,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "rosjava, android, image-transport",
"url": null
} |
c, strings, interview-questions
Title: string to integer (implement atoi)
Implement atoi to convert a string to an integer.
Requirements for atoi: The function first discards as many whitespace
characters as necessary until the first non-whitespace character is
found. Then, starting from this character, takes an optional initial
plus or minus sign followed by as many numerical digits as possible,
and interprets them as a numerical value.
The string can contain additional characters after those that form the
integral number, which are ignored and have no effect on the behavior
of this function.
If the first sequence of non-whitespace characters in str is not a
valid integral number, or if no such sequence exists because either
str is empty or it contains only whitespace characters, no conversion
is performed.
If no valid conversion could be performed, a zero value is returned.
If the correct value is out of the range of representable values, | {
"domain": "codereview.stackexchange",
"id": 33450,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c, strings, interview-questions",
"url": null
} |
organic-chemistry, elements, carbon-allotropes
Hybridization: Saying that carbon is tetravalent doesn't fully convey the versatility carbon can display in forming bonds. Hybridization involves a re-mixing of s- and p-orbitals in response to bond formation and this leads to the formation of more stable bonds. Carbon is capable of extensive variation in the hybridization of the bonds it forms, much more so than most other atoms. This wide range in hybridization that is possible for carbon allows it to form much more stable bonds in a wide variety of different structural situations.
\begin{array}\hline
Typical~Carbon-Carbon ~Bond~ Strengths~ (kcal/mole)\\ \hline
\end{array}
\begin{array}{|c|c|c|}\hline
alkane & sp^3 & 84 \\ \hline
alkene & sp^2 & 150 \\ \hline
alkyne & sp & 200 \\ \hline
\end{array} | {
"domain": "chemistry.stackexchange",
"id": 2110,
"lm_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, elements, carbon-allotropes",
"url": null
} |
time-complexity, optimization
One approach to solve the problem is to use integer linear programming: define 0-or-1 variables $v_1,\dots,v_n$, and then minimize $t$ subject to the constraints $\|\sum_i v_i x_i \|_\infty \le t$ and $\sum_i v_i = k$. Note that $\|\sum_i v_i x_i \|_\infty \le t$ iff $-t \le \sum_i v_i x_{ij} \le t$ for all $j$, so this can be expressed using linear constraints. Then, apply an off-the-shelf ILP solver and hope it terminates in a reasonable amount of time.
(The ILP solver will probably apply methods such as solving the associating linear program and then applying randomized rounding, so you don't need to implement it yourself.)
If $d$ is very small, it might be possible to solve the problem in something like $\tilde{O}(dkn^{k/2})$ time using meet-in-the-middle search combined with a nearest-neighbor data structure, but I haven't worked out the details, and I expect it won't scale to large $d$. | {
"domain": "cs.stackexchange",
"id": 15710,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "time-complexity, optimization",
"url": null
} |
black-hole
There are actually two relevant different kinds of 'infinity' here: spatial infinity and null (lightlike) infinity, depending on whether we are 'far away' from the black hole in a spacelike or lightlike direction. There's also timelike infinity, but that just corresponds to waiting an arbitrarily long time, so it's not relevant here. The two different infinities beget different definitions of energy-momentum, giving the the ADM energy and the Bondi energy, respectively. In a vacuum, the intuitive difference between the two is that Bondi energy excludes gravitational waves.
So the short answer is 'yes', with the caveat that in a more complicated situation, where we can't attribute everything to the black hole itself, the answer to how much energy is due to the black hole may be ambiguous or ill-defined. | {
"domain": "astronomy.stackexchange",
"id": 3217,
"lm_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",
"url": null
} |
algorithm, strings, graph, swift, trie
Use substrings!
The main insert method create a array of all characters:
let new_subtree = insert(Array(word), parent: root)
and the recursive helper methods repeatedly creates more arrays of the remaining characters:
let rest = Array(letters.dropFirst())
That is very inefficient. The better approach is that the helper method takes a Substring argument:
func insert(_ letters: Substring, parent: Node) -> Node
so that it can call itself with
let rest = letters.dropFirst()
insert(rest, parent: newNode)
This is called “slicing” in Swift and very efficient because the substrings share the element storage with the original string and no copies are made.
The main insert method then calls the helper method with a substring comprising all its characters:
func insert(_ word: String) {
let new_subtree = insert(word[...], parent: root)
// ...
} | {
"domain": "codereview.stackexchange",
"id": 38559,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "algorithm, strings, graph, swift, trie",
"url": null
} |
that for square matrices, the shape doesn't change, say. The transpose of a matrix is a new matrix that is obtained by exchanging the rows and columns. len) toRet[col][row] = matrix[row][col] R toRet V m = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]print("Original")print(m)print("After Transposition". Program Explanation. I decided to go with the matrix partitioning algorithm to compute the matrix inverse. A square matrix is normal if it commutes with its conjugate transpose:. Matrix-matrix subtraction. Since a 3D point only needs three values (x, y, and z), and the transformation matrix is a 4x4 value matrix, we need to add a fourth dimension to the point. Specifically, it is designed to work on 4x4 transformation matrices found in 3D rendering using homogeneous coordinates [x y z w]. 5 comments, last by st0ff 4. This tool transposes matrices. $n\times n$ Transpose Matrix calculator calculates a transpose matrix of a matrix $A$ with real elements. What does multiplying by the | {
"domain": "maboan.de",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9777138105645058,
"lm_q1q2_score": 0.821019501314712,
"lm_q2_score": 0.8397339716830606,
"openwebmath_perplexity": 530.073518005604,
"openwebmath_score": 0.5283272862434387,
"tags": null,
"url": "http://maboan.de/transpose-matrix-4x4.html"
} |
terminology, computability, turing-machines
Title: Does "output" always imply halting in computability? $L = \{P : P(n)$ outputs $n^2$ for all $n \in N \}$
In questions of this nature, are we supposed to assume that "outputs" means "halts and outputs"? In modern programming languages, I can certainly "output" using a print statement and then have the program go into a loop after that. The output of Turing machine is the content of the tape when it halts.
This is the standard definition. If a machine has written some string $s$ to its tape but hasn't halted yet, a straightforward reduction from the undecidability of the halting problem means that you have no way of knowing if it will ever write more characters to its tape, so you can't know if $s$ will be the "final" output. That means, for example, that you can't say that, if a non-halting computation never changes the string on the tape after the $t$th step, then the output is that unchanging tape string. | {
"domain": "cs.stackexchange",
"id": 3231,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "terminology, computability, turing-machines",
"url": null
} |
c++, beginner
int main()
{
double cost_per_meter = 2.75;
double length, extra_length, extra_length_cost, discount,
final_cost_of_extraLength, cost_of_10m, cost, total_cost;
cout<<"\nEnter the length of carpet in meters that you wish to buy: ";
cin>>length;
if (length > 10)
{
extra_length = length - 10;
extra_length_cost = extra_length * 2.75;
discount = extra_length_cost * 15/100;
final_cost_of_extraLength = extra_length_cost - discount;
cost_of_10m = 10 * 2.75;
total_cost = final_cost_of_extraLength + cost_of_10m;
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
cout<<"TOTAL COST = $"<<total_cost;
}
else
{
cost = length * 2.75;
cout<<"Total cost "<<cost;
}
return 0;
} | {
"domain": "codereview.stackexchange",
"id": 42102,
"lm_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",
"url": null
} |
python, performance, dice
numpy alternative
a = sum(
np.meshgrid(
*(np.arange(1, faces + 1, dtype="uint8") for _ in range(dice)),
copy=False
)
)
(a == number).sum()
but for larger number of dice and faces this runs into MemoryError too
alternative
The integer value of True is 1. So instead of keeping a counter, and incrementing it each time there is a match, you can do:
def poss_combinations(dice, faces, number):
choices = product(range(1, faces+1), repeat=dice)
return sum(sum(roll) == number for roll in choices)
But even this will take ages for 10**10 combinations. Better would be to use a analytical formula like this one | {
"domain": "codereview.stackexchange",
"id": 33482,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, performance, dice",
"url": null
} |
neural-networks, machine-learning, training, multilayer-perceptrons, information-theory
When I say "desired outputs", I mean the targets given my input. My regression dataset consists of 1D inputs and 1D outputs (the "desired outputs"). NPEET uses a K Nearest Neighbors estimation for mutual information and they note in section 4.3 of their provided pdf doc that there is a chance for negative values in the estimated mutual information. They note their own example has this issue. They mention their shuffle.test function may help resolve the negatives.
https://github.com/gregversteeg/NPEET/blob/master/npeet_doc.pdf
In section 6.4 of the doc they detail further on shuffle.test for potentially resolving negative estimates.
The pdf doc notes that the mutual information follows the calculation from the following linked paper in equation 8
https://journals.aps.org/pre/abstract/10.1103/PhysRevE.69.066138 | {
"domain": "ai.stackexchange",
"id": 3959,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "neural-networks, machine-learning, training, multilayer-perceptrons, information-theory",
"url": null
} |
javascript
}
else
return "No such contact";
// Only change code above this line
}
// Change these values to test your function
lookUpProfile("Akira", "lastName"); You have very repetitive code. This can be optimized. I'm not sure whether your function name lookUpProfile is the correct one, as you actually look up a property of a Contact and not its whole profile. But if the task is to look up a certain property of a Contact you can simplify the code to this:
function lookUpProfile(firstName, prop) {
for (let contact of contacts) {
if (contact.firstName === firstName) {
return contact[prop];
}
}
return false;
}
How it works
It loops through all contacts:
for (let contact of contacts) {
It tests whether the firstName matches:
if (contact.firstName === firstName) {
In case a match is found it returns the requested property or undefined:
return contact[prop];
In case no match is found it returns false:
return false; | {
"domain": "codereview.stackexchange",
"id": 45219,
"lm_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",
"url": null
} |
thermodynamics, thermal-radiation
$$
L_\downarrow = \sigma (T_\text{air}^4 - T_\text{soil}^4).
$$
You could stop there, but it's inconvenient to work with those powers of 4, and it's not really necessary because $T_\text{air}$ and $T_\text{soil}$ are quite close in value (they're both around $300\:\mathrm{K}$). So let's let $T_\text{soil} = T$ and $T_\text{air} = T+\Delta T$. Then we have
$$
L_\downarrow = \sigma (T+\Delta T)^4 - \sigma T^4 \\
= \sigma (T^4 + 4T^3\Delta T + 6T^2(\Delta T)^2 + 4T(\Delta T)^3 + (\Delta T)^4 \quad) -\sigma T^4.
$$
The $T^4$ terms cancel out, and if we assume $\Delta T$ is small then we can ignore the $(\Delta T)^2$ term and all the other higher powers of $\Delta T$. This leaves us with
$$
L_\downarrow = 4\sigma T^3\Delta T,
$$
which is the expression you were trying to derive. | {
"domain": "physics.stackexchange",
"id": 35746,
"lm_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, thermal-radiation",
"url": null
} |
general-relativity, newtonian-gravity
In the GR field equations it usually appears on the side with the stress-energy tensor, along with some dimensionless constant.
One way to look at it is that we still need a fundamental constant to relate the three units of mass, length, and time. We cannot write a meaningful expression with mass on one side (unless it is in a ratio, which it isn't) without a fundamental constant capable of getting rid of the mass unit. The metric generated (an expression without mass units) is dependant on the energy distribution (an expression with mass units), so G must pop in somewhere. Of course, it could be a different constant like $\hbar$ , but G makes the most sense intutively and is indeed the actual constant found in the equations.
Besides, GR should limit to newtonian gravity in the classical limit, so some form of G ought to be present. | {
"domain": "physics.stackexchange",
"id": 11266,
"lm_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, newtonian-gravity",
"url": null
} |
quantum-mechanics, quantum-entanglement, superposition, bells-inequality, non-locality
For a short and highly accessible at the popular level exposition of Bell's theorem, I recommend this six minute video by Looking Glass Universe: https://youtu.be/z-s3q9wlLag. There she explains the theorem and proves it in another video: https://youtube.com/playlist?list=PLg-OiIIbfPj2RNY2-tYO2JsR9uw7Rw22z. | {
"domain": "physics.stackexchange",
"id": 74410,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, quantum-entanglement, superposition, bells-inequality, non-locality",
"url": null
} |
fluid-dynamics, velocity
As an aside, when discussing continuum mechanics, we can't really discuss molecules. The behavior of a continuum is described by equations when we average away all the molecular motion and we're left with some average of how all the molecules within a region behave. Although we often talk about "fluid particles" when discussing continuum motion of fluids, we're really just talking about "an infinitesimal volume of fluid that still contains an infinite amount of molecules such that it can be described as a continuum."
So the velocity field you get from the Navier Stokes equations is the velocity of the bulk motion of the fluid molecules and it is not the motion of any particular molecule in general. It's a minor point that isn't important here, but there is a difference between molecular motion and continuum motion that does become important under some flow regimes. | {
"domain": "physics.stackexchange",
"id": 73216,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "fluid-dynamics, velocity",
"url": null
} |
ros, thread, qt, rqt
Title: rqt not updating text
Hello,
we wrote our own rqt plugin which extends the rosbag functionality to our needs. We are using an *.ui design in rqt to give the user the ability to easily interact with the rosbag functionality. One of the elements in the design is a (title) text showing the current folder size, giving the user the visual feedback how big the recording is and that it is still ongoing (size is growing over time).
For that we want to regularly check the size of the folder in a separate thread and update the text in rqt (GUI) accordingly. Our approach works very well, but only if we are calling the ROS_INFO, ROS_ERROR, ... functionality in every cycle of the thread worker. However we would like to get rid of the console output of course.
What we tried already, instead of the ROS outputs: | {
"domain": "robotics.stackexchange",
"id": 24373,
"lm_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, thread, qt, rqt",
"url": null
} |
c#, design-patterns, collections, repository
new Answer(23, 6, "yes, I do!"), new Answer(24, 6, "Sure!"), new Answer(25, 6, "Exactly"), new Answer(26, 6, "Yeap!"),
new Answer(27, 7, "yes, I do!"), new Answer(28, 7, "Sure!"), new Answer(29, 7, "Exactly"), new Answer(30, 7, "Yeap!")
}.Where(qa => questions
.Select(q => q.IdQuestion)
.Contains(qa.IdQuestion)
);
}
} | {
"domain": "codereview.stackexchange",
"id": 33265,
"lm_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, collections, repository",
"url": null
} |
javascript, jquery, plugin
jQuery objects should be cached whenever possible
The code only handles unordered lists (ULs), not ordered lists (OL) although it might as well
The event handling is added document-wide every time the code is run. If you use the plugin twice in a document, the first tree gets double event handlers. That spells trouble.
The setFocus function might misbehave if the tree list is itself inside a list element, as it loops through all list-type parents up to the document root.
The classPrefix option is confusing: It's not used for the expand/contract classes, only for the toggle button's "main" class. But since that's the only one, why not just let the user define that as well? Basically, if a prefix is used only once, it's not necessary.
Comparing against undefined is a no-no. undefined is not a reserved word, and can (in some runtimes) be defined. In this case, a simple boolean works just as well. | {
"domain": "codereview.stackexchange",
"id": 3554,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, jquery, plugin",
"url": null
} |
gravity, kinematics, momentum
But when they reach the peak height, they stop for a fraction of second (or lesser), that's where your mass comes into picture as their potential energies come into picture.
Momentum comes into picture when they come in contact with another object, or the ground. The heavier object would make a bigger (or deeper) impact on the ground (impact surface) than the lighter one. But as for travelling distance and velocity of travel, it should be the same as the equations are (clearly) mass independent. | {
"domain": "physics.stackexchange",
"id": 33480,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gravity, kinematics, momentum",
"url": null
} |
= r x/ h r X ’ (0, 0) X h Y ‘ Let us consider a right circular cone of radius r and the height h. Round to the nearest hundredth if necessary. If you have any doubts The volume of a truncated cone i s also known as the volume of the frustum of a cone. A cone is a three-dimensional geometric shape that tapers smoothly from a flat base (frequently, though not necessarily, circular) to a point called the apex or vertex. Thus the volume for cone B is You are told Cone A has a volume of 10cm3. 6) Find the volume of the cone if h=20 and r=8. There is a selection of harder questions to challenge the more able on the sheet. com - 1000+ online math lessons featuring a personal math teacher inside every lesson! In this So a cone's volume is exactly one third ( 1 3) of a cylinder's volume. mathwarehouse. Just enter in the radius of the cone and the height of the cone and press calculate to get the volume of any cone calculated instantly. Year 5 Estimate Volume Summer Block 5 Step 4 Lesson Pack | {
"domain": "consultoriaig.es",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9896718486991903,
"lm_q1q2_score": 0.8091304499023398,
"lm_q2_score": 0.8175744828610095,
"openwebmath_perplexity": 368.03488808347953,
"openwebmath_score": 0.7482104897499084,
"tags": null,
"url": "http://paginasweb.consultoriaig.es/zyacniw/nfgrzmm.php?gakoombkk=volume-of-cone"
} |
electric-circuits, electricity
Title: Does the position of the fuse affect whether the bulb or the fuse would blow first? If I connect a fuse and a bulb in series with:
fuse to the live and bulb to the neutral
fuse to the neutral and bulb to the live
During an overloading would this cause:
the fuse to blow and successfully protecting the bulb in the first case
the bulb to get damaged before blowing the fuse in the second case
or
just the fuse blowing, not damaging the bulb in both cases
Please answer in the cases of both DC and AC. In either case the bulb will be protected by the blowing of the fuse, further this also works when the current is AC or DC.
The reason for this is because fuses are calibrated to blow at a rated amperage, where the fuse is in the series circuit does not change the current flowing through it, therefore it protects the circuit in either location. | {
"domain": "physics.stackexchange",
"id": 99778,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electric-circuits, electricity",
"url": null
} |
thermodynamics, entropy
Title: Increase in entropy derivation so i'm following a derivation of the statement in the title and it goes the following way. Consider we have a system and we look at two processes between two states $(1,2)$ and $(2,1)$ where path $(1,2)$ is reversible and $(2,1)$ is irreversible. So we have:
$$\oint dS=\int_{1}^{2} dS + \int_{2}^{1} dS \le 0$$
Since $(1,2)$ is a reversible process we can write in the following way:
$$\int_{2}^{1}dS +(S_2-S_1) \le 0 \\ \Rightarrow \int_{2}^{1}dS \le (S_1-S_2) $$ $$\Rightarrow S_{irr} + \int_{2}^{1}dS = (S_1-S_2)$$ Where $S_{irr}$ is the bonus increase in entropy due to the irreversability of the process. So now if we say that the system is isolated $(\delta Q=0)$: | {
"domain": "physics.stackexchange",
"id": 95196,
"lm_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++, strings, c++14, cache
// EQUALS
// bool equals(const StringRef &sr) const noexcept{
// return equals(sr.data(), sr.size());
// }
bool equals(const char *data, size_t size) const noexcept{
assert(data);
return equals_(data, min__(size));
}
bool equals(const char *data) const noexcept{
assert(data);
return equals_(data, SIZE);
}
// OPERATORS NOT INCLUDED
private:
// COMPARES / EQUALS HELPERS
int compare_(const char *data, size_t const size) const noexcept{
// if data_ is less SIZE, it is null terminated
return strncmp(data_, data, size);
}
bool equals_(const char *data, size_t const size) const noexcept{
// if data_ is less SIZE, it is null terminated
return strncmp(data_, data, size) == 0;
}
private:
// HELPERS
constexpr static size_t min__(size_t const size) noexcept{
return size < SIZE ? size : SIZE;
}
private:
char data_[SIZE];
}; | {
"domain": "codereview.stackexchange",
"id": 27987,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, strings, c++14, cache",
"url": null
} |
c++, socket, tcp, posix, raii
Title: Correctly applying the "rule of five" to a RAII socket wrapper I was trying to create a simple RAII wrapper with rule of 5 for a TCP POSIX socket. My aim was to try learn how to apply rule of five in different situations, but this one was somehow tricky.
class tcp_socket {
public:
tcp_socket() {
_s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
}
tcp_socket(const tcp_socket& other) = delete;
tcp_socket& operator=(const tcp_socket& other) = delete;
tcp_socket(tcp_socket&& other) noexcept {
_s = other._s;
other._s = -1;
}
tcp_socket& operator=(tcp_socket&& other) noexcept {
if (this != &other) {
_s = other._s;
other._s = -1;
}
return (*this);
}
~tcp_socket() {
close(_s);
}
private:
int _s = -1;
}; | {
"domain": "codereview.stackexchange",
"id": 36704,
"lm_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++, socket, tcp, posix, raii",
"url": null
} |
gazebo, simulation, rviz, simulator-gazebo, youbot
Title: Launching youBot driver and simulating the robot
Dear ROS users,
my intention is to run the simulation of a robot (KUKA youbot), so that I could be able to control the virtual model in rviz. As far as I understood from the Guide, to solve this task one has to launch RVIZ, launch the OODL driver for the robot in parallel and launch the state publisher (youbot_joint_state_publisher). RVIZ can be launched and the state publisher seems to launch properly (though I don't understand what use is made of it; shouldn't it have some GUI??). PROBLEM: can't launch the driver:
youbot@oleksandr-laptop:~$ roscd youbot_oodl/launch
youbot@oleksandr-laptop:~/ros_stacks/youbot-ros-pkg/youbot_drivers/youbot_oodl/launch$ ./start_youbot_oodl_driver
[sudo] password for youbot:
[rosrun] Couldn't find executable named youbot_oodl below /home/youbot/ros_stacks/youbot-ros-pkg/youbot_drivers/youbot_oodl
[rosrun] Found the following, but they're either not files,
[rosrun] or not executable: | {
"domain": "robotics.stackexchange",
"id": 5303,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gazebo, simulation, rviz, simulator-gazebo, youbot",
"url": null
} |
quantum-field-theory, group-theory, lie-algebra, lorentz-symmetry, commutator
Title: Finite lorentz transform for 4-vectors in terms of the generators One or two sets of notes (one of them by Timo Weigand) on QFT that I have come across state explicitly that a finite lorentz transformation for 4-vectors can be written in terms of the generators $J^{\rho\sigma}$ as:
$$\Lambda^{\mu}_{\,\nu}(\Omega)=\lim_{N\rightarrow \infty}(\delta^{\mu}_{\,\nu}-\frac{i}{2N}\Omega_{\rho\sigma}(J^{\rho\sigma})^{\mu}_{\,\nu})^{N}=\exp{(-\frac{i}{2}\Omega_{\rho\sigma}(J^{\rho\sigma}))^{\mu}_{\,\nu}}$$ | {
"domain": "physics.stackexchange",
"id": 43092,
"lm_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, group-theory, lie-algebra, lorentz-symmetry, commutator",
"url": null
} |
quantum-mechanics, special-relativity, double-slit-experiment
Light also follows a worldline and goes between events. The difference is that light's worldlines are lightlike. This means that the interval between events on the worldline is zero. A physical clock can never get from event to event on a lightlike worldline. A consequence of moving between events with zero interval is that you're always going the speed of light in any reference frame. So if light zips past me to the left, and you're in a spaceship also going to the left at half the speed of light, it still looks to you like the light is running away at the speed of light. | {
"domain": "physics.stackexchange",
"id": 51395,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, special-relativity, double-slit-experiment",
"url": null
} |
quantum-field-theory, renormalization, phase-transition, critical-phenomena
However Kardar defines basin of attraction of fixed point as the subspace spanned by irrelevant couplings about the fixed point, and further shows that the correlation lengths blow up there.
I am confused here, do these two surfaces denote the same thing, or are there examples where the basin of attraction of the RG flow and critical surfaces are different? The technical name for "basin of attraction" in the theory of dynamical systems (like the RG) is stable manifold of a fixed point. In 3d for a scalar field/Ising model, just looking at the $\mathbb{Z}_2$ even sector, and ignoring the $(\partial\phi)^2$ marginal direction, the critical surface $C$ defined by infinite correlation length should be a codimension one submanifold in the space of theories $T$. There should be two fixed points Gaussian one $P_G$ and the Wilson-Fisher fixed point $P_{WF}$. The stable manifold of $P_{WF}$ should be $C\backslash\{P_G\}$. | {
"domain": "physics.stackexchange",
"id": 74087,
"lm_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, renormalization, phase-transition, critical-phenomena",
"url": null
} |
java, algorithm, object-oriented, swing, calculator
In your configuration method we initialize this Map.
// literals replaced with constants...
symbols.put(PLUS, new Operation(){
public double calculate(double summand1, double summand2){
return summand1+summand2;
}
});
// same as Java8 Lambda
symbols.put(MINUS, (minuend, subtrahend) -> minuend-subtrahend);
//...
having this your calculate method would change to this:
double calculate(double a, double b, String symbol) {
if(symbols.containsKey(symbol))
return symbols.get(symbol).calculate(a,b);
else
throw new IllegalOperationException("symbol "+symbol+" unknown!");
}
isn't that nice? | {
"domain": "codereview.stackexchange",
"id": 23389,
"lm_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, object-oriented, swing, calculator",
"url": null
} |
quantum-mechanics, energy, electrons, atomic-physics, absorption
How does the photon energy that excites an electron to a higher energy level shared between the potential and kinetic energy of that electron? "When an electron absorbs a photon and gets excited to higher energy level what does happen to its kinetic and potential energy?"
Here we talk about the total energy of the atom (because the potential energy term involves the nucleus as well).
When you excite an atom with a photon, the atom's energy increases (because $E_{1}$ is negative - you can also say that the energy decreases in absolute value).
$$E_{n}=\frac{E_{1}}{n^2}$$
You can also check what happens with the kinetic energy and potential energy individually using the expression for Bohr radius $r_{n}$ and the associated velocity $v_{n}$.
$$r_{n}\propto n^2$$
If $r$ increases the potential energy increases (since the potential energy between electron and proton is negative).
$$U=-\frac{e^2}{4\pi\varepsilon_{0}r_{n}}$$ | {
"domain": "physics.stackexchange",
"id": 95371,
"lm_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, energy, electrons, atomic-physics, absorption",
"url": null
} |
Lemma: $$\int_{-1}^1U_k(x)s(U_n(x))dx=0, k=0,..,n-1$$
Assuming the lemma is proved, it then implies (if $$p$$ has real coefficients, while otherwise, we apply it to $$\Re p$$ which is a monic polynomial of the same degree with real coefficients and $$|p(x)| \ge |\Re p(x)|$$) that
$$\int_{-1}^1(p(x)-2^{-n}U_n(x))s(U_n(x))=0$$ since $$p(x)-2^{-n}U_n(x)$$ has degree at most $$n-1$$ so it is a linear combination of $$U_0, U_1,..U_{n-1}$$
But now as $$|p(x)| =p(x)s(p(x)) \ge p(x)s(U_n(x))$$ as noted, we integrate and get:
$$\int_{-1}^1|p(x)|dx \ge \int_{-1}^1p(x)s(U_n(x))dx=\int_{-1}^12^{-n}U_n(x)s(U_n(x))dx=2^{-n}\int_{-1}^1|U_n(x)|dx$$ so we only need to prove the lemma and compute $$\int_{-1}^1|U_n(x)|dx$$ to finish
First the Lemma:
Remembering the definition and using $$x=\cos \theta, 0 \le \theta \le \pi, \sin \theta \ge 0$$: | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9911526455704169,
"lm_q1q2_score": 0.8103411138413474,
"lm_q2_score": 0.8175744850834648,
"openwebmath_perplexity": 127.63465565785043,
"openwebmath_score": 0.9871602058410645,
"tags": null,
"url": "https://math.stackexchange.com/questions/3595074/extremal-property-of-chebyshev-polynomials-of-second-kind"
} |
student answer sheet, and teacher answer key. Congruence permits alteration of some properties, such as location and orientation, but leaves others unchanged, like distances and angles. For SSA, better to watch next video. Played 0 times. Mathematics. Property 2. Section 5.5 Proving Triangle Congruence by SSS 265 Using the Hypotenuse-Leg Congruence Theorem Write a proof. Prove that triangles are congruent using the ASA Congruence Postulate and the AAS Congruence Theorem ; Use congruence postulates and theorems in real-life problems. Played 0 times. Edit. 1. Their interior angles and sides will be congruent. AB\cong A\prime B\prime \\ This is the only postulate that does not deal with angles. SSS Theorem (Side-Side-Side) Perhaps the easiest of the three postulates, Side Side Side Postulate (SSS) says triangles are congruent if three sides of one triangle are congruent to the corresponding sides of the other triangle. In proving the theorem, we will use the transitive property of | {
"domain": "firesidecoaching.org",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9845754510863376,
"lm_q1q2_score": 0.8267814460644588,
"lm_q2_score": 0.839733963661418,
"openwebmath_perplexity": 1724.7321557590083,
"openwebmath_score": 0.6440187692642212,
"tags": null,
"url": "http://firesidecoaching.org/cfs-payroll-nrzgusu/c313a3-sss-triangle-congruence"
} |
evolution, ecology, natural-selection
In evolutionary biology, adaptive radiation is a process in which organisms diversify rapidly from an ancestral species into a multitude of new forms, particularly when a change in the environment makes new resources available, creates new challenges, or opens new environmental niches. Starting with a recent single ancestor, this process results in the speciation and phenotypic adaptation of an array of species exhibiting different morphological and physiological traits. An example of adaptive radiation would be the avian species of the Hawaiian honeycreepers. Via natural selection, these birds adapted rapidly and converged based on the different environments of the Hawaiian islands | {
"domain": "biology.stackexchange",
"id": 7877,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "evolution, ecology, natural-selection",
"url": null
} |
python, python-3.x, linux
"""Run"""
count = 0
for amount in Sources.values():
count = count + 1
Source = Sources["folder"+str(count)]
Destination = Destinations["folder"+str(count)]
GPIO.output(20, True)
CreateNewIndex()
ImportOldIndexes()
Compare()
Execute()
GPIO.output(21, False) | {
"domain": "codereview.stackexchange",
"id": 36748,
"lm_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, linux",
"url": null
} |
ros
https://github.com/ros-naoqi/nao_moveit_config/blob/master/tuto/tuto_moveit.rst
There is also a NAO path follower stack at http://wiki.ros.org/nao_path_follower | {
"domain": "robotics.stackexchange",
"id": 1269,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros",
"url": null
} |
orbital-motion, estimation, solar-system, cosmic-rays
Wikipedia puts the flux of GeV particles at around $j=10^{4}\:\rm m^{-2}\:s^{-1}$.
Assume for simplicity that the bulk of the cosmic rays at this energy are protons, for which an energy of $E=1\:\rm GeV$ corresponds to a momentum of $p=\frac1c\sqrt{E^2-m_p^2c^2}\sim 10^{-19}\:\rm kg\:m/s$.
At the flow rate indicated that gives a momentum flow rate (a.k.a. pressure) of about $$P=jp=10^{-15}\:\rm kg\:m^{-1}\:s^{-2}.$$
Multiplying by the cross-sectional area of the Earth, that produces a force of $$ F = P\, \pi R_\oplus^2 \sim 1 \:\rm kg\:m\:s^{-2}. $$
Dividing that by the mass of the earth gives an acceleration of $$ a =F/M_\oplus \sim 10^{-26} \:\rm m/s^2.$$
The orbital velocity of the Earth is $v\approx 30\:\rm km/s$, so at that rate it would take about $$T = v/a \sim 10^{22}\:\rm y$$ to slow the Earth down to a halt. | {
"domain": "physics.stackexchange",
"id": 60264,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "orbital-motion, estimation, solar-system, cosmic-rays",
"url": null
} |
homework-and-exercises, newtonian-mechanics, rotational-kinematics
Title: Why is $\ddot \theta=0$? - a Kinetics of Particles question The question arises from this problem:
As shown in Figure 7, a 2m diameter wheel rotates in the horizontal plane at a
constant angular velocity ω= 7 rad/s. A 180g mass slides, without friction, along one of its spokes. The speed of the mass, relative to the spoke, is 20 m/s when its position r = 0.15m. Calculate the speed of the mass (relative to the spoke) and hence the force exerted by the spoke on the mass just before the latter reaches the rim of the wheel.
Assume that the rim is of negligible thickness (drawing not to scale).
My solution is:
I have the final solution but my question is : Why is $\ddot \theta=0$? The problem states:
As shown in Figure 7, a 2m diameter wheel rotates in the horizontal plane at a constant angular velocity ω= 7 rad/s. | {
"domain": "physics.stackexchange",
"id": 39711,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises, newtonian-mechanics, rotational-kinematics",
"url": null
} |
c#, client, chat
Message(c.Realname, arg[2], Regex.Escape(arg[3]));
break;
case "help":
if (arg.Length > 3
&& !commands.ContainsKey(arg[2])) {
SendMessage("Command does not exist.");
return;
}
var cmd = (arg.Length < 3) ? null : arg[2]; | {
"domain": "codereview.stackexchange",
"id": 17343,
"lm_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#, client, chat",
"url": null
} |
Note that $$(x^2 + x + 1)^2 = x^4 + 2x^3 + 3x^2 + 2x + 1$$which means that your polynomial is equal to $$(x^2 + x + 1)^2 - 4 = (x^2 + x + 1)^2 - 2^2 = (x^2 + x + 1 - 2)(x^2 + x + 1 + 2)$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.953966101527047,
"lm_q1q2_score": 0.8253944383727205,
"lm_q2_score": 0.8652240756264638,
"openwebmath_perplexity": 367.558186452309,
"openwebmath_score": 0.7234388589859009,
"tags": null,
"url": "https://math.stackexchange.com/questions/2082195/factorization-of-quartic-polynomial/2082229"
} |
sum. a 1 x 1 b 1, a 2 x 2 b 2, , a m x m b m .. (ii) is equal to the coefficient of x n in. This text will guide you through the derivation of the distribution and slowly lead to its expansion, which is the Multinomial Distribution. Then apply the condition and try to approach the desired result. I saw that the formula for the number of distinct terms (or dissimilar) in a multinomial expansion ( x 1 + x 2 + x 3 + + x k) n is. Adding over n c 1 throws it into the last (\leftover") category. The multinomial theorem provides a formula for expanding an expression such as ( x1 + x2 ++ xk) n for integer values of n. In particular, the expansion is given by where n1 + n2 ++ nk = n and n! The multinomial theorem Multinomial coe cients generalize binomial coe cients (the case when r = 2). x2n2 -----xmnm EXAMPLES **Q1. = (102 x 101) / (2 x 1) = 5151 **General term of a multinomial theorem : 27. where the value of n can be any real number. See more. This section will serve as a warm-up that | {
"domain": "philippinekabu.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9805806518175514,
"lm_q1q2_score": 0.8128413507648548,
"lm_q2_score": 0.8289388019824946,
"openwebmath_perplexity": 430.1305472448073,
"openwebmath_score": 0.7606329917907715,
"tags": null,
"url": "http://www.philippinekabu.com/kansai/what/15839286f1aef7bdd9442"
} |
javascript, optimization, jquery, css, plugin
//Current Selected Tab
if(index == selectedIndex){
var tabContainer = $('a > div',$(this))
tabContainer.removeClass('tabHover');
tabContainer.addClass('tab');
$(classBuilder[0]).removeClass('h3');
$(classBuilder[0]).addClass('left');
$(classBuilder[1]).removeClass('h2');
$(classBuilder[1]).addClass('content');
$(classBuilder[2]).removeClass('h1');
$(classBuilder[2]).addClass('right'); | {
"domain": "codereview.stackexchange",
"id": 89,
"lm_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, optimization, jquery, css, plugin",
"url": null
} |
# Inequality. $\frac{ab+c}{a+b}+\frac{ac+b}{a+c}+\frac{bc+a}{b+c} \geq 2.$
Let $a,b,c$ be positive real numbers such that $a+b+c=1$. Prove that (using rearrangements inequalities, you can also view this exercise here, exercise number 3.1.8 )
$$\frac{ab+c}{a+b}+\frac{ac+b}{a+c}+\frac{bc+a}{b+c} \geq 2.$$
thanks.
-
@AlexBecker. I try using $\displaystyle \left(\frac{1}{b+c}, \frac{1}{a+c}, \frac{1}{a+b}\right)$ & $(a,b,c)$ and I suppose that $a \leq b \leq c$ and then when I applied the rearrangements inequality I added $\displaystyle \frac{bc}{b+c}+\frac{ab}{a+b}+\frac{ac}{a+c}$. – Iuli Sep 5 '12 at 20:13
## 4 Answers | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9811668739644686,
"lm_q1q2_score": 0.8021769843176568,
"lm_q2_score": 0.8175744673038222,
"openwebmath_perplexity": 287.69688385780853,
"openwebmath_score": 0.9448373317718506,
"tags": null,
"url": "http://math.stackexchange.com/questions/191605/inequality-fracabcab-fracacbac-fracbcabc-geq-2"
} |
1) what is the expected error (MSE) on future data - that is the mean of the 5 CV MSEs
2) what is the expected SD of the errors on future data - that is the mean of each CV SD!
You may also want to evaluate how certain you are of those estimates:
3) what is the variance (or SD) of the estimate of future MSE - that is the variance (SD) of the 5 CV MSEs -- this is the one that is low in your example - so you know that your estimate of the future MSE is pretty tight. (Well maybe - there is a paper that shows that the SD of a CV measure - in this case the MSE - is not a good estimate of the true SD - but let us leave this for later)
4) what is the variance (or SD) of the estimate of future SD of the MSE - that is the variance (SD) of the 5 CV SD
So going back to your question | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9702399060540358,
"lm_q1q2_score": 0.8227321600892172,
"lm_q2_score": 0.8479677602988602,
"openwebmath_perplexity": 658.9361846224098,
"openwebmath_score": 0.6685965061187744,
"tags": null,
"url": "https://stats.stackexchange.com/questions/169260/cross-validation-what-is-the-standard-deviation-if-the-same-value-is-obtained-f"
} |
gazebo, navigation, odometry, ros-lunar, transform
</range>
<noise>
<type>gaussian</type> <!-- Add parameters for Svcansee sweep -->
<mean>0.0</mean>
<stddev>0.01</stddev>
</noise>
</ray>
<plugin name="sweep_link" filename="libgazebo_ros_laser.so">
<topicName>base_scan</topicName>
<frameName>sweep_link</frameName>
</plugin>
</sensor>
</gazebo> | {
"domain": "robotics.stackexchange",
"id": 31398,
"lm_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, navigation, odometry, ros-lunar, transform",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.