text stringlengths 1 1.11k | source dict |
|---|---|
java, algorithm, comparative-review, graph, library
Not
Map<Key,Value>
This might seem like such a big deal but from experience it can lead to really stupid bugs and unintended behavior that is a pain to track down. A simple example. Say we have an interface like so:
public interface Foo {
public void fizz();
}
And two classes:
public class Bar implements Foo {
public void fizz(){
System.out.println("Bar");
}
}
public class Baz implements Foo {
public void fizz(){
System.out.println("Baz");
}
}
And finally you have a class like this:
public class FooBarBaz<Bar extends Foo> {
private Bar bar;
public FooBarBaz(Bar bar){
this.bar = bar;
}
public void callFizzOnBar(){
this.bar.fizz();
}
public void main(String[] args){
Baz baz = new Baz();
FooBarBaz<Baz> fbb = new FooBarBaz<>(baz);
fbb.callFizzOnBar();
}
} | {
"domain": "codereview.stackexchange",
"id": 27979,
"lm_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, comparative-review, graph, library",
"url": null
} |
python, algorithm, python-3.x, lambda, quick-sort
return qsort(sublist(lesser))+ [pivot] + qsort(sublist(greater))
It seems like an overkill to have two lambdas in the sublist definition. How can I refactor the sublist lambda function to not include lambda at all? I think having one lambda in your definition of sublist is perfectly appropriate, but the use of filter isn't appropriate because you are going to need a list anyway. You aren't using it wrong, there are just better solutions.
Also, as noted in the other answer, you can avoid repeated slicing L by creating a copy of the list on the first run of the function through an optional default argument (see first in the code below).
Finally, summing three lists in your return statement is probably less than optimal. With unpacking in Python 3, you can turn this into a single comprehension which should be better in terms of intermediate object creation.
from operator import ge, lt
def qsort(L, first=True):
if len(L) <= 1:
return L | {
"domain": "codereview.stackexchange",
"id": 26146,
"lm_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, algorithm, python-3.x, lambda, quick-sort",
"url": null
} |
thermodynamics, conventions
The first law considers the heat added to the system as positive, and the heat removed from the system as negative. The first law considers the work done on the system as positive and the work done by the system as negative. The first law considers mass flow into the system as positive and mass flow out of the system as negative.
The heat added to the system is the negative of the heat lost by the surroundings.
Similarly for a mass, a force that "increases motion" causes positive acceleration and a force that "retards motion" causes negative acceleration (deacceleration).
In your question considering B as the system, the heat into B is +Q and the heat from A is -Q as you say. In your question you have acceleration negative and deacceleration positive, which is not correct considering the system as the mass affected by a force. | {
"domain": "physics.stackexchange",
"id": 81483,
"lm_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, conventions",
"url": null
} |
performance, objective-c, ios, hash-map
Now the property list can be dumped with
[plist dumpPlist];
This is slightly more code, but no if-statements at all, and it can easily be extended
if you need a special "treatment" for some object types. | {
"domain": "codereview.stackexchange",
"id": 10331,
"lm_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, objective-c, ios, hash-map",
"url": null
} |
neural-network, deep-learning, clustering, training, rbm
tl;dr: yes, the problem is intractable, which is why we use the contrastive divergence algorithm by Hinton, which is only an approximation but works well in practice. | {
"domain": "datascience.stackexchange",
"id": 3031,
"lm_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-network, deep-learning, clustering, training, rbm",
"url": null
} |
# Thread: Volume of a cylindrical shell
1. ## Volume of a cylindrical shell
(a) Use differentials to find a formula for the approximate volume of a thin cylindrical shell with height $h$, inner radius $r$, and thickness $\Delta r$.
This part is fairly simple-- $dV=f'(r)*dr$, assuming $h$ is a constant. This yields $dV=2\pi rh\Delta r$.
(b) What is the error involved in using the formula from part (a)?
This is where I'm stuck. The formula in part (a) assumes $h$ is a constant, and thus doesn't account for the change in $h$, even though the thickness does affect the top of the shell. Seeing this, I would assume the error to be in the volume of the "lid", or $\pi r^2 \Delta r$. However, my book gives me an answer of $\pi (\Delta r)^2 h$. What am i doing wrong?
2. $
V(r)=\pi r^2 h
$
$
V'(r)=2 \pi r h
$
$
V''(r)=2 \pi h
$
$
\Delta V(r)=V'(r) \Delta r+ \frac {1}{2}V''(r) (\Delta r)^2
$
The second term may be considered to be an error term for the first one. | {
"domain": "mathhelpforum.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9793540734789342,
"lm_q1q2_score": 0.8096435652068497,
"lm_q2_score": 0.8267117962054048,
"openwebmath_perplexity": 244.40265117834684,
"openwebmath_score": 0.9730561971664429,
"tags": null,
"url": "http://mathhelpforum.com/calculus/157966-volume-cylindrical-shell.html"
} |
ros, compile, ros-kinetic, raspberrypi, jessie
#include "ros/connection.h"
#include "ros/transport/transport.h"
#include "ros/file_log.h"
#include <ros/assert.h>
#include <boost/shared_array.hpp>
#include <boost/bind.hpp>
namespace ros
{
Connection::Connection()
: is_server_(false)
, dropped_(false)
, read_filled_(0)
, read_size_(0)
, reading_(false)
, has_read_callback_(0)
, write_sent_(0)
, write_size_(0)
, writing_(false)
, has_write_callback_(0)
, sending_header_error_(false)
{
}
Connection::~Connection()
{
ROS_DEBUG_NAMED("superdebug", "Connection destructing, dropped=%s", dropped_ ? "true" : "false");
drop(Destructing);
}
void Connection::initialize(const TransportPtr& transport, bool is_server, const HeaderReceivedFunc& header_func)
{
ROS_ASSERT(transport);
transport_ = transport;
header_func_ = header_func;
is_server_ = is_server;
transport_->setReadCallback(boost::bind(&Connection::onReadable, this, 1));
transport->setWriteCallback(boost::bind(&Connection::onWriteable, this, 1)); | {
"domain": "robotics.stackexchange",
"id": 26623,
"lm_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, compile, ros-kinetic, raspberrypi, jessie",
"url": null
} |
qiskit, programming, vqe
# exact classical result
exact_result = NumPyMinimumEigensolver(qubit_op, aux_operators=aux_ops).run()
exact_result = operator.process_algorithm_result(exact_result)
# VQE
optimzer = SLSQP(maxiter=1000)
initial_state = HartreeFock(operator.molecule_info['num_orbitals'],
operator.molecule_info['num_particles'],
qubit_mapping=operator._qubit_mapping,
two_qubit_reduction=operator._two_qubit_reduction)
var_form = UCCSD(num_orbitals=operator.molecule_info['num_orbitals'],
num_particles=operator.molecule_info['num_particles'],
initial_state=initial_state,
qubit_mapping=operator._qubit_mapping,
two_qubit_reduction=operator._two_qubit_reduction)
algo = VQE(qubit_op, var_form, optimzer, aux_operators=aux_ops) | {
"domain": "quantumcomputing.stackexchange",
"id": 2101,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "qiskit, programming, vqe",
"url": null
} |
java, sorting, generics, mergesort
Note that this doesn't return the list. It actually sorts the list you pass into it.
If you're looking for more improvements to the merge algorithm itself you could look up how it's implemented in java. (Although recently it's changed into a Tim sort which is a combination of merge sort and insertion sort).
As a final note: if your intention was to actually use your code in a project other than studying how merge sort is implemented or practicing your java skills I would advise against it. Just use the built-in functions if available. | {
"domain": "codereview.stackexchange",
"id": 26434,
"lm_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, sorting, generics, mergesort",
"url": null
} |
quantum-field-theory, operators, hilbert-space, interactions, s-matrix-theory
As I illustrated above with the quantum mechanical case, I do not think that (2) and (3) are true.
How things work, to the best of my understanding
There should be a ground energy state $|\Omega\rangle$ in interacting QFT, which is, in general, different from $|0\rangle$. It is not annihilated by $a_p$ from the free theory. There are still exact energy eigenstates, which are analogous to $|\Omega_1\rangle$. These are the single-particle states $|p^{int}\rangle$ associated with stable particles. Indeed, considering that these are stable and have no other particles to interact with (it is a single-particle state), they just travel in time with energy defined by their effective mass and spatial momentum. | {
"domain": "physics.stackexchange",
"id": 94268,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-field-theory, operators, hilbert-space, interactions, s-matrix-theory",
"url": null
} |
newtonian-mechanics, newtonian-gravity, angular-momentum, conservation-laws, orbital-motion
That alone says that the magnitude of angular momentum is constant.
Your textbook's $v_\phi$ is the component of the velocity vector that is normal to the radial vector: $\vec v = v_r \hat r + v_\phi \hat \phi$. Thus $\vec L = m \vec r \times \vec v = m r v_\phi\,\hat r \times \hat \phi$. Since since $||\hat r \times \hat \phi|| \equiv 1$, the magnitude of a planet's angular momentum vector is $||\vec L|| = m r v_\phi$. Since mass is constant and since $\int_{t_1}^{t_2} r v_\phi dt = C(t_2-t_1)$, the magnitude of the angular momentum vector is constant.
To arrive at the angular momentum vector being constant, we need to know that it's direction is constant as well. This is a consequence of orbits being planar, which is part of Kepler's first law. | {
"domain": "physics.stackexchange",
"id": 37686,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "newtonian-mechanics, newtonian-gravity, angular-momentum, conservation-laws, orbital-motion",
"url": null
} |
homework-and-exercises, electromagnetism, magnetic-fields, inductance
Therefore, the induced field $\vec E$, will be in a direction opposite to the $\vec v\times \vec B$. The emf will be given by $\int \vec E.\vec{dl}$, which will thus be negative with respect to the direction of cross product (taken as positive). | {
"domain": "physics.stackexchange",
"id": 10253,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises, electromagnetism, magnetic-fields, inductance",
"url": null
} |
reference-request, papers, model-request
Title: Is there any work done on topic agnostic binary topic classification? In the recent preprint paper Tree-based Focused Web Crawling with
Reinforcement Learning a new model is introduced to classify web pages called KwBiLSTM.
The input to this model is a featurized webpage which, later in the forward pass, is concatenated with a featurized version of a list of keywords. Together, these features are passed to the classification layer, which determines whether the webpage and the keywords correspond to the same topic (label 1 or 0).
From literature research I could not find any other work using this novel approach, namely that the topic being classified is supplied as an argument, rather than learned explicitly by providing a set of webpages labeled for a certain topic.
My question is: Are there other works using a similar topic-agnostic binary topic classifier? I realized the problem can be solved as such: | {
"domain": "ai.stackexchange",
"id": 3483,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "reference-request, papers, model-request",
"url": null
} |
scale with intention. Find information on our most convenient and affordable shipping and mailing services. Consider two eigenfunctions ψ 1 and ψ 2 of an operator Oˆ with corresponding eigen-values λ 1 and λ 2 respectively. These two proofs are essentially the same. Hamilton Burr to Hamilton, June 21, 1804. If is then measured and then again, show that the probability of obtaining a second time is. expectation values of the operator over an orthonormal basis set, trAˆ= X n hnjAˆjni: (1. Hamilton & Elizabeth Petroelje Stolle, GVSU Faculty W hat does it mean to read, write, think, and com-. The Thermal Density Matrix. The interest coupon rate is 8%, and the required rate of return is 10%. Empirical Example in R. thinkstep, a Sphera company, enables organizations worldwide to succeed sustainably. is described by a potential energy V = 1kx2. The expectation value of the spin along x given by hχ(t)|Sx|χ(t)i can be calculated. Defining the transfer matrix. 2) therein), the expectation values | {
"domain": "gipad.it",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9669140177976359,
"lm_q1q2_score": 0.8015125557055082,
"lm_q2_score": 0.8289388104343893,
"openwebmath_perplexity": 1101.7371464684404,
"openwebmath_score": 0.6746727824211121,
"tags": null,
"url": "http://gipad.it/anmp/expectation-value-of-hamiltonian.html"
} |
c, literate-programming
int main(int argc, char *argv[])
{
int status = EXIT_SUCCESS;
/* The test is superfluous */
if (argv[0])
argv0 = argv[0];
parse_options(argc, argv);
if (optind == argc)
status = process(stdin, "standard input");
else
{
for (int i = optind; i < argc; i++)
{
FILE *fp = fopen(argv[i], "r");
if (fp == NULL)
{
fprintf(stderr, "%s: failed to open file '%s' for reading: %d (%s)\n",
argv0, argv[i], errno, strerror(errno));
status = EXIT_FAILURE;
}
else
{
int rc = process(fp, argv[i]);
if (status == EXIT_SUCCESS)
status = rc;
fclose(fp);
}
}
}
if (fclose(output) != 0)
{
fprintf(stderr, "%s: failed to close output file\n", argv0);
status = EXIT_FAILURE;
}
return status;
} | {
"domain": "codereview.stackexchange",
"id": 45531,
"lm_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, literate-programming",
"url": null
} |
cardiology, action-potential, electrocardiography
This whole condition is referred to as 'depolarization block.'
Here's a helpful review on voltage-gated sodium channels that contains information covering what I discussed in my answer:
Catterall, W. A. (2000). From ionic currents to molecular mechanisms: the structure and function of voltage-gated sodium channels. Neuron, 26(1), 13-25.
You can also find lots more information in textbooks and elsewhere if you look for the term 'depolarization block.' Note also that I have simplified the gating transitions for voltage-gated sodium channels for the purpose of this answer, so some sources might explain a more complicated system; the general principles still apply to the question, though. | {
"domain": "biology.stackexchange",
"id": 8065,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "cardiology, action-potential, electrocardiography",
"url": null
} |
objective-c, ios
- (NSString *)SettingsPlist
{
NSString *paths = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *PlistPath = [paths stringByAppendingPathComponent:@"Settings.plist"];
return PlistPath;
}
- (NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection:(NSInteger)section
{
return [[self list] count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *contentForThisRow = [[self list] objectAtIndex:[indexPath row]];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
if(cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"];
}
NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:[self SettingsPlist]];
NSString *row = [NSString stringWithFormat:@"%d",indexPath.row]; | {
"domain": "codereview.stackexchange",
"id": 2790,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "objective-c, ios",
"url": null
} |
kalman-filter
Title: Complementary and Kalman filter don't work for Y angle I'm working on a Python script which reads the data from the MPU6050 IMU and returns the angles using sensor fusion algorithms: Kalman and Complementary filter. Here is the implementation:
Class MPU6050 reads the data from the sensor, processes it. Class Kalman is the implementation of the Kalman filter. The problem is the next: None of the Kalman, neither the Complementary filter returns appropriate angle values from the Y angle. The filters work fine on the X angle, but the Y angle values make no sense. See the graphs below. I've checked the code million times, but still can't figure out where the problem is.
class MPU6050():
def __init__(self):
self.bus = smbus.SMBus(1)
self.address = 0x68
self.gyro_scale = 131.072 # 65535 / full scale range (2*250deg/s)
self.accel_scale = 16384.0 #65535 / full scale range (2*2g)
self.iterations = 2000 | {
"domain": "robotics.stackexchange",
"id": 779,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "kalman-filter",
"url": null
} |
python, embedded, raspberry-pi
def validate_job_number_barcode_scan(x):
log_print("validate_job_number_barcode_scan(%s) called" % x.strip())
try:
if len(x) > 0 and (int(x.strip()) > 999 and int(
x.strip()) < 100000000):
code_validity = True
else:
code_validity = False
except ValueError:
log_print("Invalid Job Number")
code_validity = False
return code_validity
log_print("validate_job_number_barcode_scan() returning")
return code_validity
def jobnumber_capture():
global JOB_NUMBER
log_print("jobnumber_capture() called")
for attempts in range(3):
JOB_NUMBER, jobnumber_validity = barcode_scanner()
if len(JOB_NUMBER) > 1:
if validate_job_number_barcode_scan(JOB_NUMBER):
log_print("jobnumber_capture() returning")
return True
else:
log_print("jobnumber_capture() returning")
return False | {
"domain": "codereview.stackexchange",
"id": 44727,
"lm_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, embedded, raspberry-pi",
"url": null
} |
array, vba, excel
ResultArr(0) = "Round to " & DecPlace & " decimal places:" & vbCrLf & "Rounded diff ; Rounded total"
For Lcol = 1 To Xcol
For Lrow = 1 To Xrow
RoundedSum = RoundedSum + WorksheetFunction.Round(CDec(DataRange(Lrow, Lcol)), DecPlace) 'vba round uses banker's rounding so call excel round instead
PrecSum = PrecSum + DataRange(Lrow, Lcol) 'index(arr,0,col) does not work for manually populated array variant
Next Lrow
ResultArr(Lcol) = "Col " & Lcol & vbTab & FormatNumber(RoundedSum - PrecSum, DecPlace, , vbFalse, vbTrue) & vbTab & FormatNumber(RoundedSum, DecPlace, , vbFalse, vbTrue)
RoundedSum = 0
PrecSum = 0
Next Lcol
ans = MsgBox(Join(ResultArr, vbCrLf) & vbCrLf & vbCrLf & "Set new decimal place?", vbYesNo + vbDefaultButton2)
If ans = 6 Then '6 = yes
DecPlace = InputBox("Input rounding decimal places:", , 2)
End If
Exit Sub
ender:
boo1 = 0
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub | {
"domain": "codereview.stackexchange",
"id": 39350,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "array, vba, excel",
"url": null
} |
astrophysics, stars, hydrogen, fusion, stellar-physics
In space what happens is that the warm gas radiates away some heat as blackbody radiation, cools off, and implodes a bit more. If you confine it inside a too reflective sphere the energy cannot escape and the gas stays hot (this is also the mainstream idea of why dark matter halos are big and diffuse: there is no counterpart to photons for dark matter to radiate away, so they don't implode well under gravity).
How big sphere do you need? If we start with hydrogen gas ($\mu=3.32\times 10 ^{-27}$ kg) at room temperature $T=300$ K and one atmosphere $\rho=0.0899$ kg/m$^3$ I get $\lambda_J=498,000$ km. That is however just 0.0000234 solar masses (about 7.8 earth masses), so it will be a dud. It is not the Jeans length that sets the necessary radius of your container. | {
"domain": "physics.stackexchange",
"id": 48768,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "astrophysics, stars, hydrogen, fusion, stellar-physics",
"url": null
} |
modulation, frequency-modulation, amplitude-modulation
Same with any other mechanism that combines multiple frequencies or time values into one "meta-symbol" that thus has a multiple of the original degrees of freedom: You only get as many degrees of freedom as you use by defining the complex values your meta-symbol has, so, no free lunch here, spectrally. You'll find such scheme as CDMA, SC-FDMA and a lot of other methods that all increase the bandwidth or duration of the channel usage by the same factor as they increase the degrees of freedom. Well, an invertible base transform is an invertible base transform. | {
"domain": "dsp.stackexchange",
"id": 11920,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "modulation, frequency-modulation, amplitude-modulation",
"url": null
} |
homework-and-exercises, newtonian-mechanics, power, drag, software
Title: How to Calculating power using smart phone? I'm writing a smart phone app and one of it's functions is to calculate power of the vehicle that the phone is travelling in. The user enters the total weight of the vehicle and the app uses the accelerometer to get the acceleration rate and the GPS to get the velocity. My working out is below but I'm getting some odd results but I think its a code problem not a power calculation problem. Can some one tell me if the my formula is correct?
a = accelerometerReading; // In m/s/s
F = (m * a)/1000; // F (kN) = m (kg) * a (m/s/s)
P = F * v; // P (kW) = F (kN) * v (m/s) | {
"domain": "physics.stackexchange",
"id": 23255,
"lm_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, power, drag, software",
"url": null
} |
physical-chemistry, quantum-chemistry, molecular-orbital-theory
However you can make the assumption, without any loss of generality, that the wavefunctions of both 1s orbitals in dihydrogen ($\ce{H2}$) are of the same phase (i.e. both normalisation constants have the same value of $N$ and $\phi$). As a simple example we can just let $N$ be a positive real number. With this, the wavefunction of the 1s orbitals always have a positive value, and the overlap integral
$$S_\mathrm{AB} = \left<\psi_\mathrm{1s,A} \middle| \psi_\mathrm{1s,B} \right> = \int \psi_\mathrm{1s,A}\psi_\mathrm{1s,B}\,\mathrm{d}\tau$$
always has a positive integrand (no imaginary components, so I dropped the complex conjugate). The integral is therefore positive.
(Note that even though both 1s orbitals have the same exponential form, $\psi_\mathrm{1s,A}$ is not equal to $\psi_\mathrm{1s,B}$ since the orbitals are centred at different points in space.) | {
"domain": "chemistry.stackexchange",
"id": 7318,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "physical-chemistry, quantum-chemistry, molecular-orbital-theory",
"url": null
} |
Let $f(n)$ be the number of $k$'s between $0$ and $n$ where $n \mid {n\choose k}$. By the proposition we have $\varphi(n)< f(n) < n$.
Question: is $$\text{lim sup } \frac{f(n)-\varphi(n)}{n}=1?$$
Here is a list plot of $\frac{f(n)-\varphi(n)}{n}$. The max value reached for $1<n<2000$ is about $0.64980544$. The blue dots at the bottom are the $n$'s such that $f(n) = \varphi(n)$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.98409360595565,
"lm_q1q2_score": 0.8403300783944698,
"lm_q2_score": 0.8539127510928476,
"openwebmath_perplexity": 422.3019225152912,
"openwebmath_score": 0.8366022109985352,
"tags": null,
"url": "https://math.stackexchange.com/questions/545962/when-is-binomnk-divisible-by-n"
} |
lagrangian-formalism, string-theory, stress-energy-momentum-tensor, action, ghosts
Title: Energy-momentum tensor of Bosonic Ghost Action in String Theory When quantizing bosonic string theory by means of the path integral, one inverts the Faddeev-Popov determinant by going to Grassmann variables, yielding:
$$
S_{\mathrm{ghosts}} = \frac{-i}{2\pi}\int\sqrt{\hat{g}}b_{\alpha\beta}\hat{\nabla^{\alpha}}c^{\beta}d^2\tau,
$$
where the $-i/2\pi$ just comes from convention/Wick rotated or not. My first problem is the notion of the 'fudicial' metric $\hat{g}$. I find its role in the path integral procedure a bit confusing. What is its relation to the 'normal' metric $g$? Why is it introduced? Related to this confusion is that fact in my lecture notes it is said that the energy momentum tensor is given by:
$$ | {
"domain": "physics.stackexchange",
"id": 95421,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "lagrangian-formalism, string-theory, stress-energy-momentum-tensor, action, ghosts",
"url": null
} |
quantum-mechanics, quantum-information, density-operator
Let us now prove the inequality for the case of two outcomes. To this end,
let $\sigma_x\le 1\!\!1$. It holds that
$$\mathrm{tr}[\sigma_x\rho]^2 = \mathrm{tr}[(\rho^{1/4}\sigma_x \rho^{1/4})(\rho^{1/2})]
\stackrel{(*)}{\le} \mathrm{tr}[\rho]\,\mathrm{tr}[\sigma_x\sqrt{\rho}\sigma_x\sqrt{\rho}]\ ,
$$
where in $(*)$ we have used Cauchy-Schwarz, and also repeatedly the cyclicity of the trace.
It is now straightforward to check that the above inequality is equivalent to
$$
\frac{\mathrm{tr}[\sigma_x\sqrt{\rho}(1\!\!1-\sigma_x)\sqrt{\rho}]}{
\mathrm{tr}[\rho]-\mathrm{tr}[\rho\sigma_x]}
\le
\frac{\mathrm{tr}[\sigma_x\sqrt{\rho}\sigma_x\sqrt{\rho}]}{
\mathrm{tr}[\rho\sigma_x]}\ .
$$
By choosing $\sigma_x = p_x\rho^{-1/2}\rho_x\rho^{-1/2}\equiv F_x$, this immediately yields the inequality
$$
\mathrm{tr}\left[F_x\frac{\rho-p_x\rho_x}{1-p_x}
\right]\le
\mathrm{tr}\left[F_x\rho_x\right]\ ,
$$
where we have used that $\mathrm{tr}[\rho]=\mathrm{tr}[\rho_x]=1$, and thus | {
"domain": "physics.stackexchange",
"id": 29528,
"lm_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-information, density-operator",
"url": null
} |
ruby, ruby-on-rails
Is this a right approach? Does anyone have better idea than this? So far as I can tell without seeing the rest of your of your application structure this seems fine. I am making the assumption that this is small app and that performance is not a real concern as of yet. One suggestion though, you could take those where statements and internalize them in their respective models as scopes.
scope :task_count, -> (date) { where(:adate => date).count }
scope :profile_count, -> (date) { where(:ad_date => date).count }
This would at least neaten things up a bit and is a good habit to form, because it will insure consistency in behavior. Even though these are simple queries if you are reimplementing them (or any query) everywhere it creates the possibility to introduce errors; this is a benefit of code reuse. | {
"domain": "codereview.stackexchange",
"id": 22259,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ruby, ruby-on-rails",
"url": null
} |
each case, choose the sign which makes the left side non-negative. How can I cut 4x4 posts that are already mounted? Suppose three vectors and in three dimensional space are given so that they do not lie in the same plane. Click here to toggle editing of individual sections of the page (if possible). It follows that is the volume of the parallelepiped defined by vectors , , and (see Fig. Tetrahedron in Parallelepiped. Change the name (also URL address, possibly the category) of the page. By the theorem of scalar product, , where the quantity equals the area of the parallelogram, and the product equals the height of the parallelepiped. View and manage file attachments for this page. See pages that link to and include this page. Wikidot.com Terms of Service - what you can, what you should not etc. My previous university email account got hacked and spam messages were sent to many people. Then the area of the base is. Finally we have the volume of the parallelepiped given by Volume of | {
"domain": "com.br",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9777138157595305,
"lm_q1q2_score": 0.8329660230218748,
"lm_q2_score": 0.8519528000888386,
"openwebmath_perplexity": 672.3718183009221,
"openwebmath_score": 0.9352316856384277,
"tags": null,
"url": "http://gasmar.com.br/transworld-cfs-sibfp/5ede8b-volume-of-parallelepiped-proof"
} |
thermodynamics
$$
with no inbetween steps given.
From a previous derivation of $C_v$ I know that:
$$
C_v = \frac{\left(\frac{\partial U}{\partial S}\right)_v}{\left(\frac{\partial ^2 U}{\partial S^2}\right)_v}
$$
and I think I understand at the least how to express the $\left(\frac{\partial p}{\partial T}\right)_v$ term, because you can express $p$ and $T$ in terms of $U, S, V$ like so:
$$
\begin{align*}
-p &= \left(\frac{\partial U}{\partial V}\right)_s \\
T &= \left(\frac{\partial U}{\partial S}\right)_v
\end{align*}
$$
The real killer is the second term $\left(\frac{\partial V}{\partial T}\right)_p$, because the only thing I know I can do with this equation is use the Maxwell relation:
$$
-\left(\frac{\partial V}{\partial T}\right)_p = \left(\frac{\partial S}{\partial p}\right)_T
$$ | {
"domain": "chemistry.stackexchange",
"id": 10010,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "thermodynamics",
"url": null
} |
javascript, react.js
return {
rotateLeft,
rotateRight,
move,
degrees,
position,
placeCar,
carPlaced,
chooseDirection,
initiatedGame,
onKeyDown
}
}
export const Controller = createContainer(useController)
export default useController I'm trying to address the same issue.
What I'm currently doing is splitting my big hooks into smaller hooks, each with a single responsability.
For example, in your example, you could split your onKeyDown, rotateRight and rotateLeft functions into a hook which takes a state with values and setters as only parameter:
const useCarRotation = state => {
const changeDirection = direction => {
if(direction === -1) {
state.setDirection(3)
} else if(direction === 4) {
state.setDirection(0)
} else {
state.setDirection(direction)
}
}
const rotateLeft = () => {
state.setDegrees(state.degrees - 90)
changeDirection(state.direction - 1)
} | {
"domain": "codereview.stackexchange",
"id": 35987,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, react.js",
"url": null
} |
c#, beginner, tree, ftp
}
}
}
FtpItem Class interface:
namespace FtpLibrary
{
public interface ftpItem
{
string GetName { get; }
string GetPath { get; }
int GetFileSize { get; }
void AddItem( ftpItem item );
SortedList<string, ftpItem> GetList { get; }
ftpItem GetListItem( string name );
void Download( string s, string t );
ftpItem GetPreviousItem { get; }
int GetCount { get; }
void AddFolder( string key, ftpItem item );
}
Class FtpItem : file
public class file : ftpItem
{
private string _fileName;
private int _fileSize;
private string _filePath;
private static int _fileAmount = 0;
public file( string filename, string filesize, string filepath )
{
_fileName = filename;
_fileSize = Int32.Parse( filesize );
_filePath = filepath;
_fileAmount += 1;
} | {
"domain": "codereview.stackexchange",
"id": 17056,
"lm_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, tree, ftp",
"url": null
} |
performance, object-oriented, json, go
// ArrayGenerator struct that implements Generatorer. Used to
// generate random array
type ArrayGenerator struct {
common CommonProperties
size int
generator Generatorer
}
// ObjectGenerator struct that implements Generatorer. Used to
// generate random object
type ObjectGenerator struct {
common CommonProperties
generatorList []Generatorer
}
func (c CommonProperties) exist(r rand.Rand) bool { return r.Intn(100) > c.nullPercentage }
func (c CommonProperties) getKey() string { return c.key } | {
"domain": "codereview.stackexchange",
"id": 26463,
"lm_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, object-oriented, json, go",
"url": null
} |
python, email, pandas, beautifulsoup, data-visualization
def counter(bins):
print 'Emails from Ted Cruz:',len(cruzbin)
print 'Emails from Donald Trump:',len(trumpbin)
print 'Emails from Hillary Clinton:',len(clintbin)
print 'Emails from Marco Rubio:',len(rubiobin)
print 'Emails from Chris Christie:',len(christiebin)
print 'Emails from Jeb Bush:',len(jebbin)
def q():
ans = input('Whose e-mails do you want to analyze?\n')
return ans | {
"domain": "codereview.stackexchange",
"id": 18183,
"lm_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, email, pandas, beautifulsoup, data-visualization",
"url": null
} |
image-processing, gradient, pca
Unless you have prior information (or assumptions) about the direction of the flow / filaments, it is impossible to derive their orientation. In other words, you can get some indication about the local orientation of (something that looks like) an edge, but not the orientation of the flow of the filament. You can assume, for example, that there is a particular intensity profile along the body of the filament which could then be used to determine "which part is the 'head' ".
The first thing to do (anyway) is to obtain the image gradient. The image gradient will give you the local slope of the intensity field (a.k.a image). All code here in Octave but only for demonstration. The operators are easily transferable across to scipy.
%Load the image
Q = imread('someImage.jpg');
%Resize it to 1/4 of its original scale, this is not essential but it helps with visualisation.
Qs = imresize(Q,0.25)
%
% Get the gradient
% [gradMag, gradDir] = imgradient(Qs); | {
"domain": "dsp.stackexchange",
"id": 6004,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "image-processing, gradient, pca",
"url": null
} |
• A composite function can be evaluated from a graph. See [link] .
• A composite function can be evaluated from a formula. See [link] .
• The domain of a composite function consists of those inputs in the domain of the inner function that correspond to outputs of the inner function that are in the domain of the outer function. See [link] and [link] .
• Just as functions can be combined to form a composite function, composite functions can be decomposed into simpler functions.
• Functions can often be decomposed in more than one way. See [link] . | {
"domain": "jobilize.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9732407168145568,
"lm_q1q2_score": 0.8213130687949989,
"lm_q2_score": 0.8438950966654774,
"openwebmath_perplexity": 496.3159780045672,
"openwebmath_score": 0.9224351644515991,
"tags": null,
"url": "https://www.jobilize.com/trigonometry/test/key-equation-composition-of-functions-by-openstax"
} |
calls for an 8-iron because the ball will travel in the air. Do a "Remove baseline" analysis, choosing to subtract column B from column A and column D from column C. If you’re looking to calculate the change in prices or numbers, a percentage difference calculator can allow you to figure out: Increases. 73 is R-squared =. For example, if the baseline number is 100, and the new number is 110: This formula can be used to calculate things like variance between this year and last year, variance between a budgeted and actual values. 049 in December 2013 and 234. Sample variance formula. Reduction from 25 to 20 will result in a 20%. By the scientific percent difference method, the percent difference is 200%. Qlikview, Aggregation, Percentage, Dimension. While calculating the VAT, Insurance premium or Tips at restaurant, we thought of percentages or perhaps if we are earning then we would have thought about percentage of our salary we are paying for rent, food or fuel. It is important to | {
"domain": "citreagiancarlo.it",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9848109529751892,
"lm_q1q2_score": 0.8051562990284533,
"lm_q2_score": 0.8175744761936437,
"openwebmath_perplexity": 766.3587739289256,
"openwebmath_score": 0.6256626844406128,
"tags": null,
"url": "http://citreagiancarlo.it/yazb/how-to-calculate-percentage-variation.html"
} |
javascript, jquery, html, form
Title: Submit an array as an HTML form value using JavaScript I'm sending data from a form with a variable number of fields via an Ajax call. Some of the fields are grouped together so I have opted to send them as an array of JSON objects to keep the groupings, but there are a number of ways of doing this. For client-side, is it better to read the form as JavaScript objects and stringify them or just directly work with strings from the start?
Here's an example:
I want to group the data so I know which date goes with which member, so I have created a bunch of objects and added them to an array. This seems to work but there are issues with using JSON.stringify because it's not supported in IE7. I don't know if modifying the form is very efficient either. How would you manage this? Or would you submit the form as is and sort it out on the server? What's the most widely accepted approach?
HTML:
<form id="form">
<h3>Group Name</h3>
<input type="text" name="group_name"><br> | {
"domain": "codereview.stackexchange",
"id": 14271,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, jquery, html, form",
"url": null
} |
newtonian-mechanics, forces, power
We see that the existence of force is time dependent. That means force may exist for a definite period in time. So thus should work. And thus should energy! Energy, thereby, is much like a 'field' - much like a phenomenon that exists as long as its "sidekick", force, exists.
Finally, power. What are we trying to do in case of power? Divide energy by time? Why? Why are we trying to distribute a phenomenon (energy) into parcels of time? Why then are we not distributing force in the same way? How does it make sense?
(Edit: I have kind of built a heuristic (?) explanation for myself. I want to see if that is correct. A little indication of your thoughts would do.) Field has a specific definition in physics. You can have force fields, and energy density can be a field, but I don’t think I have ever seen energy as a field. | {
"domain": "physics.stackexchange",
"id": 65226,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "newtonian-mechanics, forces, power",
"url": null
} |
This just shows you the background proof for the exponent rule of dividing x^a by x^b.
Hope this isn't too confusing and that it helps! If you know the exponent rule for dividing numbers with exponents that's all you need to remember, not the background proof!
• At Sal writes m^7/9+^1/3=m^k/9. I am confussed on how Sal got rid of the m under the division line. why isn't it m^7/9*m^1/3=m^k/9?
• Sal is using the property of exponents for division. When we divide and have a common base, we subtract the exponents: m^7 / m^2 = m^(7-2) = m^5
Sal's problem is a little more complicated because the exponents are fractions. But, he is using the same property: m^(7/9) / m^(1/3) = m^(7/9-1/3)
In your version: m^7/9*m^1/3, you have changed the division into multiplication which can't be done without changing the exponent on the 2nd m to be -1/3.
Hope this helps.
• How would you solve 1 over z to the -1/2 power?
• Cierra, | {
"domain": "khanacademy.org",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9678992960608888,
"lm_q1q2_score": 0.8023292972324328,
"lm_q2_score": 0.82893881677331,
"openwebmath_perplexity": 1042.711985963731,
"openwebmath_score": 0.8468808531761169,
"tags": null,
"url": "https://en.khanacademy.org/math/get-ready-for-ap-calc/xa350bf684c056c5c:get-ready-for-differentiation-1/xa350bf684c056c5c:properties-of-exponents/v/simplifying-exponent-expression-with-division"
} |
homework-and-exercises, field-theory, dimensional-analysis, scale-invariance
Based on this quote, I have tried using the lagrangian $\mathcal L = \partial_\mu \phi_i \partial^\mu \phi_i$ which is the Klein Gordon lagrangian with $m=0$. Computing $\mathcal L[\phi + \delta \phi] - L[\phi]$ gives the variation of the action which should be 0 up to a total derivative when $d_{ij} = 1 \cdot \delta_{ij}$. However I find terms with extra derivatives that do not cancel. I would like to know how to find the 1 and 3/2 for bosons and fermions. I guess this is a general result and there is no need to pick a specific lagrangian. For a massless scalar field, $$I[\phi] :=\int g^{\mu\nu}\frac{\partial \phi(x)}{\partial x^\mu}\frac{\partial \phi(x)}{\partial x^\nu} dx^0dx^1 dx^2dx^3$$
where $g = diag(-1,1,1,1)$.
If replacing $\phi \to \phi_\lambda$ where $$\phi_\lambda(x) := \lambda \phi(\lambda x) \quad \mbox{for $\lambda >0$}$$ (evidently $\lambda = e^\alpha$), we have | {
"domain": "physics.stackexchange",
"id": 36650,
"lm_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, field-theory, dimensional-analysis, scale-invariance",
"url": null
} |
ros-melodic
2020-04-04 18:04:03 remove ros-melodic-desktop-full:amd64 1.4.1-0bionic.20200320.170844 <none>
2020-04-04 18:04:04 remove ros-melodic-perception:amd64 1.4.1-0bionic.20200320.161440 <none>
2020-04-04 18:04:05 remove ros-melodic-desktop:amd64 1.4.1-0bionic.20200320.165834 <none>
2020-04-04 18:04:05 remove ros-melodic-viz:amd64 1.4.1-0bionic.20200320.155640 <none>
2020-04-04 18:04:06 remove ros-melodic-geometry-tutorials:amd64 0.2.2-0bionic.20200320.154702 <none>
2020-04-04 18:04:06 remove ros-melodic-turtle-tf2:amd64 0.2.2-0bionic.20200320.123541 <none>
2020-04-04 18:04:07 remove ros-melodic-common-tutorials:amd64 0.1.11-0bionic.20200320.124359 <none>
2020-04-04 18:04:08 remove ros-melodic-turtle-actionlib:amd64 0.1.11-0bionic.20200320.123504 <none>
2020-04-04 18:04:08 remove ros-melodic-turtle-tf:amd64 0.2.2-0bionic.20200320.145720 <none>
2020-04-04 18:04:09 remove ros-melodic-actionlib-tutorials:amd64 0.1.11-0bionic.20200320.123237 <none> | {
"domain": "robotics.stackexchange",
"id": 34709,
"lm_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-melodic",
"url": null
} |
machining
If you want to get into power tapping (And need more precision than a cordless drill with the clutch turned down,) there are reversing tapping heads you can attach to a drill which reverses the tap out when threading is complete. These are available for drill presses or hand-held drills. They run around \$500-$1,000. here's another style of tap chuck called a tension compression chuck, which allows a little vertical give but I believe that is only of much use if your spindle is computer controlled.
If you want a more robust solution and have some money, there are tapping presses that start at around $3,000. It's not quite 6 figures, but they aren't cheap.
Depending on what you are making, self threading screws may also be a valid option. There are a wide variety of types that work in different situations. | {
"domain": "engineering.stackexchange",
"id": 12,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "machining",
"url": null
} |
python, python-3.x
# ... code here
#close the output file
outFile.close()
Becomes:
with open("output.count.txt", "w+") as outFile:
# ... code here
This is ugly and unreadable:
outFile.write("FileName\tTotal\tSecondary\tSupplementary\tduplicates\tmapped\tpaired in sequencing\tread1\t"
"read2\tproperly paired\twith itself and mate mapped\tsingletons\twith mate mapped to a different chr\twith mate mapped to a different chr (mapQ>=5)\n")
The \t runs into the next field name, so the eye sees "tTotal".
It would be better to actually list your field names in a readable form,
and let the computer properly separate them:
fields = ["FileName", "Total", "Secondary", "Supplementary", "duplicates", "mapped",
"paired in sequencing", "read1", "read2", "properly paired",
"with itself and mate mapped", "singletons", "with mate mapped to a different chr",
"with mate mapped to a different chr (mapQ>=5)"]
outFile.write("\t".join(fields) + '\n') | {
"domain": "codereview.stackexchange",
"id": 32132,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, python-3.x",
"url": null
} |
c++, performance, machine-learning
That’s just “zip the elements of y_true and y_pred together, then count the ones that are equal” (and convert to double and divide by the size for the final answer, of course).
But even today, you can still do this with std::inner_product() or std::transform_reduce()… easy to spot, because there are very few algorithms that take two ranges, and even fewer that take two ranges and produce a single value (rather than another range). These functions are a bit more verbose because they don’t support ranges, but:
auto accuracy(
std::vector<double> const& y_true,
std::vector<double> const& y_pred)
{
return -(double{
std::transform_reduce(
std::ranges::begin(y_true),
std::ranges::end(y_true),
std::ranges::begin(y_pred),
std::plus<>{},
[] (auto&& a, auto&& b) { return a == b ? std::size_t{1} : std::size_t{0}; })}
/ y_true.size());
}
// or: | {
"domain": "codereview.stackexchange",
"id": 42488,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, performance, machine-learning",
"url": null
} |
time-domain
Title: What is the relationship between the discrete time and continuous time variables? While going through Proakis's Digital Signal Processing (page 21) ,he stated that
if a continuous time signal $~x(t)~$ that has been sampled each $~T~$ seconds to produce a discrete time signal $~x(n)~$ then the relationship between the variables $t$ and $n$ is :
$$ t=nT \tag($$
Question : in the LHS we have a continuous variable whereas in the RHS we have a variable that can only take step sizes of $T$ , so clearly $t$ and $nT$ do not span the same range , then how is the formula above justified ? It's about the relationship between the discrete time signal $x_d[n]$ and the continuous-time signal $x_c(t)$:
$$x_d[n]=x_c(nT)\tag{1}$$
So you formally replace the variable $t$ by $nT$ but this just means that you sample the continuous-time signal at sample instants $t_n=nT$. So $t=nT$ is only true for the values of $t$ that we're interested in, and these are the discrete values $t_n=nT$. | {
"domain": "dsp.stackexchange",
"id": 6998,
"lm_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-domain",
"url": null
} |
optics
Finally: Assuming that all the normalization conditions are met, the integral above can be seen as an inner product of a vector of your decomposed coefficients with itself so:
$$\sigma^2 = \int_\text{unit disk} (W(\rho, \theta))^2 \rho \text{d}\rho\text{d}\theta = \langle W, W \rangle = \sum C_j^2$$. | {
"domain": "physics.stackexchange",
"id": 93452,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "optics",
"url": null
} |
# Evaluate $\int_0^{\infty} {\sin(\tan(x)) \over x}dx$
I tried to solve it the Feynman way and defined:
$$I(a):=\int_0^{\infty} {\sin(\tan(a \cdot x)) \over x} \ dx$$
And look what happens when one substitutes $u=ax$ $(a>0)$:
$$I(a)=\int_0^{\infty} {\sin(\tan(u)) \over u} \ du = I(1)$$
Which implies that $I(a)=const$ for $a>0$. More generally $I(a)=c \cdot sign(a)$. I wonder whether this can help.
I recalled that in order to solve $\int_0^{\infty} {\sin(x) \over x} \ dx$ using the Feynman technique one had to define $I(a):=\int_0^{\infty} {\sin(x) \over x} e^{-a \cdot x}\ dx$ and differentiate it. Consequently I suspect we should define $I(a):=\int_0^{\infty} {\sin(\tan x) \over x} e^{-a \cdot x}\ dx$, but differentiation yields:
$$I'(a)=-\int_0^{\infty} {\sin(\tan x)} e^{-a \cdot x}\ dx$$
Which is another difficult integral.
Any help?
(please try to avoid gamma functions) | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9759464506036181,
"lm_q1q2_score": 0.8024125679098985,
"lm_q2_score": 0.822189134878876,
"openwebmath_perplexity": 657.0728970539656,
"openwebmath_score": 0.9817501306533813,
"tags": null,
"url": "https://math.stackexchange.com/questions/1271585/evaluate-int-0-infty-sin-tanx-over-xdx"
} |
c#, performance, excel
using (var input = File.OpenRead(inputPath))
using (var output = new FileStream(outputPath, FileMode.OpenOrCreate, FileAccess.Write))
{
XLS_to_XLSX_Converter.Convert(input, output);
}
return outputPath;
}
The change in Convert() should be trivial.
Also note that I'm using Path.ChangeExtension() instead of manually adding a character, code is clear without any comment and it handles special cases for you (for example a trailing space).
In CopyRows() you create an empty List<ICell>, you do not need to and you can avoid the initial allocation simply using Enumerable.Empty<ICell>() (and changing your code to work with an enumeration) or - at least - reusing the same empty object (move it outside the loop and create it with an initial capacity of 0). | {
"domain": "codereview.stackexchange",
"id": 33222,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, performance, excel",
"url": null
} |
action, ros-control, ros-kinetic, actionlib, server
Title: ros_control combination with actionlib
Hi there,
This is probably a noob question, but after spending some hours trying to figure this out and asking google, I decided to ask it nonetheless.
I am building an interface to a robot that does not have any ros packages yet, I have an interface that reads from a command topic and writes to a state topic. Now I want to use a action server to connect this interface to moveit (which has an action client how I understood it so far?) and other motion planners.
But before I continue down this road writing an action server, I wanted to ask if actionlib is the way to go for this.
Many thanks in advance!
EDIT: | {
"domain": "robotics.stackexchange",
"id": 32410,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "action, ros-control, ros-kinetic, actionlib, server",
"url": null
} |
machine-learning, classification, random-forest
From the comments:
The issue is 92% for 30:70% train-test split and 80% for 70:30% train-test split.
You could simply say 80% is good enough I'll proceed with the orthodox 70:30 split. If you are proceeding with 30:70 split you would need to be clear about that, if it's a manuscript the reviewer would likely return it. Personally, I don't think it's cool.
I get the impression that 3 of the targets under classification have approximately equal proportions (just guessing). The issue is whether there is a minority part of the classification which is getting misrepresented in the testing split.
There are two approaches I would use (as a data scientist):
Reduce the problem to the 3 majority categories and see if the discrepancy continues between 30:70 and 70:30
Augment the data and use a standard 70:30 split, however now the 30% is more like the original 70% due to augmentation. | {
"domain": "datascience.stackexchange",
"id": 11710,
"lm_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, classification, random-forest",
"url": null
} |
newtonian-mechanics, gravity, orbital-motion, velocity
The development of the above is rather straight forward. I used a parametrization of the ellipse, not using the angle $\varphi$, nor the typical $(x = a \cos t, y = a \sin t)$, but rather I used a tan-half-angle substituion
$$ \pmatrix{x \\ y} = \pmatrix{c + d \cos \varphi \\ d \sin \varphi} = \pmatrix{ a \frac{1-\gamma^2}{1+\gamma^2} \\ b \frac{2 \gamma}{1+\gamma^2} } $$
and the relationship between the observation angle and the parametrization $\gamma$ being
$$ \gamma = \frac{ (1-\epsilon) \tan \left( \tfrac{\varphi}{2} \right)}{\sqrt{1-\epsilon^2}} $$ | {
"domain": "physics.stackexchange",
"id": 82992,
"lm_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, gravity, orbital-motion, velocity",
"url": null
} |
parent function 3√x domain: ( -∞, ). Parameters a, c, and k in the x- and y-values so that you can the! Parent cube root and cube root functions into complex equations do to for! Function, find the appropriate graph … Play this game to review.. And solutions given the formula of a square to its side length have chosen thesection where x −3... P ( x ) = square root of x translating as indicated, the. 3Rd and 4th quadrants domain restriction ) -charts are extremely useful tools when dealing with transformations of parent! ) =3√x get started Examples... for instance, consider the families of root! Your math skills are advanced, you 're seeing this message, it will be a great point... Both left and right terms in x3 + 3x2 − 4x − 12 in other words it. Of a, h, and problems, it exactly matches the original image find the inverse of! & Examples... for instance, consider the families of square root functions parent answer: 1 question Analyze graph! Of cubic functions ( sometimes requiring a | {
"domain": "seowonstay.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9539660989095221,
"lm_q1q2_score": 0.803073132456219,
"lm_q2_score": 0.8418256512199032,
"openwebmath_perplexity": 566.2049900574576,
"openwebmath_score": 0.5762942433357239,
"tags": null,
"url": "http://seowonstay.com/sharekhan-charges-viddhm/cube-root-parent-function-8f07ca"
} |
All these numbers have one thing in common : throwing them out cost one set but that set only contains 1 number which can be thrown out. However if I throw 1 I'd be able to throw 6 and 46 for free.
I could sort it by (1/S) where S is the sum of (1/number of appearances) of each number in each set the number appears in. For instance, in your exemple, 1 would be weighted 2/7 but 4 would be weighted 1.
I coded it in haskell (real nice for list manipulation) and it outputs your last solution (not a proof). | {
"domain": "projecteuler.chat",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9715639694252315,
"lm_q1q2_score": 0.8352183293095687,
"lm_q2_score": 0.8596637541053281,
"openwebmath_perplexity": 471.2014865749079,
"openwebmath_score": 0.36823469400405884,
"tags": null,
"url": "https://projecteuler.chat/viewtopic.php?f=4&t=3581&p=38948"
} |
c#, performance, object-oriented, xamarin
public const string COLUMN_IdTarefaMov = "Id Tarefa Mov";
public const string COLUMN_Recorrente = "Recorrente";
public const string COLUMN_IdAtividade = "Id Atividade";
public const string COLUMN_NoEntidade = "No Entidade";
public const string COLUMN_NoCliente = "No Cliente";
public const string COLUMN_NoContrato = "No Contrato";
public const string COLUMN_NoLinhaContrato = "No Linha Contrato";
public const string COLUMN_NoProduto = "No Produto";
public const string COLUMN_NoInvestimento = "No Investimento";
public const string COLUMN_SegProcesso = "Seg Processo";
public const string COLUMN_Eliminado = "Eliminado";
public const string COLUMN_Concluido = "Concluido";
public const string COLUMN_Cor = "Cor"; | {
"domain": "codereview.stackexchange",
"id": 32648,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, performance, object-oriented, xamarin",
"url": null
} |
algorithms, graphs, graph-traversal, dag, topological-ordering
Title: Getting all vertices with fixed index in their topological ordering of a DAG During my self study for graphs, I'm currently learning about topological sorting and ran into a question I'm not sure how to solve.
There are typically more than one order of a topological ordering for any given DAG. Some vertices will always be in the same index regardless of the ordering. Find a linear algorithm to get all fixed vertices in the topological order for a DAG.
From what I've gathered, this means that that fixed vertex is related to all vertices after it in the ordering AND it depends on all vertices before it in the ordering. | {
"domain": "cs.stackexchange",
"id": 20561,
"lm_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, graph-traversal, dag, topological-ordering",
"url": null
} |
By the division algorithm, $$x = 3q + r,\text{ where } r \in \{0, 1, 2\}.$$ So express $$x^2 = 9q^2 + r^2 + 6qr = 3(3q^2 + 2qr) + r^2.$$ For a given $x$ if $r = 0$ or $1,$ then we're done. If $r = 2$ then $r^2 = 4 = 3 + 1,$ and hence $$x^2 = 3\times\text{integer} + 3 + 1 = 3\times(\text{integer} + 1) + 1.$$ We are done.
-
This makes sense to me and I am able to finish problem thank you – user968102 Jul 18 '12 at 19:32
Let $x = 3k+r, r = 0, 1, 2$ by the division algorithm. Squaring $x$, we find $x^2 = 9k^2+6kr+r^2$, or $x^2 = (9k+6r)k+r^2$.
Since $9k+6r$ is divisible by 3 for all integers $k, r$, then we may re-write this as $x^2 = 3k_1 + r^2$.
Using the division algorithm again, we see that $x^2 = 3k_1+r_1, r_1 = 0, 1, 2$. If $r_1 = 2$, then $r = \pm \sqrt{2}$, which is not an integer. Therefore, only $r=0$ and $r=1$ are acceptable.
-
Hint $\$ Below I give an analogous proof for divisor $5$ (vs. $3),$ exploiting reflection symmetry. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9869795072052384,
"lm_q1q2_score": 0.8557465218523387,
"lm_q2_score": 0.8670357546485407,
"openwebmath_perplexity": 152.49878714121635,
"openwebmath_score": 0.901091992855072,
"tags": null,
"url": "http://math.stackexchange.com/questions/172535/use-the-division-algorithm-to-show-the-square-of-any-integer-is-in-the-form-3k"
} |
energy, electrostatics, electric-fields, potential, textbook-erratum
Why do I get a minus sign? What did I do wrong? The electrostatic energy is actually minus the work done by the electric force, so that more the work done by the electric force the more you lose the potential energy (and gain kinetic energy in its place).
So, start with
$$U = -\int_{\boldsymbol a}^{\boldsymbol b}\boldsymbol F_e \cdot d\boldsymbol s$$ where $\boldsymbol F_e $ is the force due to electic field. | {
"domain": "physics.stackexchange",
"id": 40245,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "energy, electrostatics, electric-fields, potential, textbook-erratum",
"url": null
} |
Remark 2. That is linked to the concept of quasi-commutative matrices. There are two non-equivalent definitions:
i) $A,B$ are quasi-commutative iff $AB-BA$ commute with $A,B$. By a result from McCoy, $A,B$ are always ST.
ii) $A,B$ are quasi-commutative iff $AB=kBA$ where $k$ is a complex number. This is the definition we are interested in. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9793540680555949,
"lm_q1q2_score": 0.8118245940987354,
"lm_q2_score": 0.8289388083214156,
"openwebmath_perplexity": 273.324286600367,
"openwebmath_score": 0.9905948042869568,
"tags": null,
"url": "https://math.stackexchange.com/questions/2240983/detab-ba-0/2241200"
} |
of the application areas. Mathematica) can be used. 2 \\ \end{array}\right]$. Eigenvectors and Eigenvalues were originally used to study rotational motion of rigid bodies, but now are mostly used for dynamic problems or situations involving change over time, growth, decay, or oscillation. A good example of the need for these is the exponential increase of some matrix A (A, A2, A3, …, An). What are the eigenvalues for the matrix A? \end{array}\right|=0\], $\begin{array}{l} This chapter constitutes the core of any first course on linear algebra: eigenvalues and eigenvectors play a crucial role in most real-world applications of the subject. To solve this equation, the eigenvalues are calculated first by setting det(A-λI) to zero and then solving for λ. In Mathematica the Dsolve[] function can be used to bypass the calculations of eigenvalues and eigenvectors to give the solutions for the differentials directly. \frac{d Z}{d t} &=9 X-2 Z+F Suppose you have some amoebas in a petri dish. 3 | {
"domain": "com.br",
"id": null,
"lm_label": "1. Yes\n2. Yes",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9890130593124399,
"lm_q1q2_score": 0.8263041290358484,
"lm_q2_score": 0.8354835371034368,
"openwebmath_perplexity": 402.3403455863307,
"openwebmath_score": 0.9638453722000122,
"tags": null,
"url": "https://www.cerenge.com.br/docs/applications-of-eigenvalues-and-eigenvectors-52eeb8"
} |
ros, pcl, pcl-1.7
Title: Mixing pcl versions inside ros?
I am trying to use RegionGrowingRGB and other functions which are available in pcl 1.7 but not 1.5. The issue I am having is that 1.7 does not contain the recent patch that was applied to 1.5 (which solved my segfault issue here).
My question is, is there any way I can mix versions in my code? I either want to use 1.5 but be able to call functions implemented in 1.7, or use 1.7 but be able to use the 1.5 version of files which were affected by the patch. Is there any easy way to do this?
I don't think I can simply copy the missing files into the 1.5 directory because I'm sure there are tons of dependencies. | {
"domain": "robotics.stackexchange",
"id": 14531,
"lm_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, pcl, pcl-1.7",
"url": null
} |
hundreds of ways to aggregate the variable. In many contexts we find ourselves in the situation where the number of independent variables exceeds the number of data points. The risk with this type of analysis is that if we test many models, there is a good chance we might find a model that fits the data well just due to random chance. It is always important to keep this in mind when you are doing an exploratory analysis: the goal is to identify interesting patterns and generate hypotheses, but finding a strong relationship should not be taken as strong evidence for a hypotheses. Hypothesis testing must be conducted on a independent data set that wasn’t used to generate the hypothesis. Testing hypotheses with the data used to generate them is much like noticing a coincidence, and then assuming it can’t be a coincidence because the odds are too low. For example, it would be like finding out an acquaintance has the same birthday as you, and coming to the conclusion that it can’t be a | {
"domain": "bookdown.org",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9780517450056274,
"lm_q1q2_score": 0.8018981122129847,
"lm_q2_score": 0.8198933403143929,
"openwebmath_perplexity": 431.8432274751122,
"openwebmath_score": 0.5763149261474609,
"tags": null,
"url": "https://bookdown.org/btmarti25/FD2E/comparing-models.html"
} |
I was going to ask about the independence number about the higher-dimensional simplicial rook graph. The computational evidence I have suggests that the least eigenvalue is $\min(-n,-\binom{d}{2})$. E.g., for $d=4$, $n\geq 6$, this would imply that the independence number $\alpha(n)$ is at most $a(n)=\lfloor(n+1)(n+3)/3\rfloor$. This is not a tight bound (e.g., $a(6)=21$, $\alpha(6)=16$) and I would guess that it is not even asymptotically tight. – Jeremy Martin Aug 1 '12 at 14:36
The eigenvalue bound (which you probably mean to be $\max(-n,-{d\choose 2})$, not $\min$) can be proved in the same way, by writing the adjacency matrix as the sum of $d\choose 2$ adjacency matrices (one for each direction) each with minimal eigenvalue $-1$. – Noam D. Elkies Aug 1 '12 at 14:47 | {
"domain": "mathoverflow.net",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9773707946938299,
"lm_q1q2_score": 0.8608653431254909,
"lm_q2_score": 0.8807970811069351,
"openwebmath_perplexity": 208.61710808626438,
"openwebmath_score": 0.9519979953765869,
"tags": null,
"url": "http://mathoverflow.net/questions/103540/hexagonal-rooks"
} |
python, python-2.x, tic-tac-toe
def pretty_print(b):
for row in b:
print row
gameboard = [[0,0,1],[0,1,0],[1,1,0]]
pretty_print(gameboard)
tictac(gameboard)
gameboard = [[0,1,1],[0,0,0],[1,1,0]]
pretty_print(gameboard)
tictac(gameboard)
gameboard = [[1,0,1],[0,0,1],[0,1,0]]
pretty_print(gameboard)
tictac(gameboard)
gameboard = [[0,0,1,0],[1,1,0,1],[0,1,1,1],[0,1,0,1]]
pretty_print(gameboard)
tictac(gameboard) Missing handling for incomplete boards of finished games
The program works only with complete boards. It won't work with this finished game with incomplete board, which is kind of a big drawback for a game evaluator:
o
x o o
o x x | {
"domain": "codereview.stackexchange",
"id": 11941,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, python-2.x, tic-tac-toe",
"url": null
} |
function. In fact, we offer an entire algebra 2 curriculum: fourteen units covering all topics equations, to conic sections, and even trig. The inverse of the exponential function y = a x is x = a y. Logical Functions / 10 M-Files / 11 Timing /11 Mathematical Functions Exponential and Logarithmic Functions / 12 Trigonometric Functions / 12 Hyperbolic Functions / 12 Complex Functions / 13 Statistical Functions / 13 Random Number Functions / 13 Numeric Functions / 13 String Functions / 13 Numerical Methods Polynomial and Regression Functions / 14. Properties of Exponents 4. Explore the graph of an exponential function. 02) to the 𝘵 power, 𝘺 = (0. Find the coordinates of the. Explore Exponential Functions 1. Chapter 8 : Exponents and Exponential Functions 8. exponential definition: The definition of exponential refers to a large number in smaller terms, or something that is increasing at a faster and faster rate. If you need to contact the Course-Notes. You don't write a function for this | {
"domain": "umood.it",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.981735720045014,
"lm_q1q2_score": 0.8511999843866641,
"lm_q2_score": 0.8670357683915538,
"openwebmath_perplexity": 944.1857117142524,
"openwebmath_score": 0.4596410393714905,
"tags": null,
"url": "http://pziq.umood.it/exponential-functions-game.html"
} |
quantum-state, error-correction, hamiltonian-simulation, error-mitigation
Consider an arbitrary observable $O$ which will time evolve under application of $H$ in the Heisenberg picture (with $\hbar = 1$) according to
\begin{align}
O(t) &= e^{i H t} O e^{-i H t} \tag{1}
\\&= \sum_{j, k} e^{i(\omega_j - \omega_k) t} \langle \omega_j|O |\omega_k\rangle |\omega_j \rangle \langle \omega_k | \tag{2}
\end{align}
where for simplicity I consider the finite-dimensional case such that $H$ admits a spectral decomposition
\begin{equation}
H = \sum_{k} \omega_k |\omega_k\rangle\langle\omega_k |\tag{3}
\end{equation}
Take any initial state $|\psi_0\rangle$ and define $c_{jk} = \langle \omega_j|O |\omega_k\rangle \langle \psi_0|\omega_j \rangle \langle \omega_k | \psi_0\rangle$ for housekeeping, and we find that the expected value of $O(t)$ is
\begin{align}
\langle O(t) \rangle &= \sum_{j,k} c_{jk} e^{i(\omega_j - \omega_k) t}\tag{4}
\end{align}
Then defining the discrete set of frequency differences
\begin{align} | {
"domain": "quantumcomputing.stackexchange",
"id": 3378,
"lm_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-state, error-correction, hamiltonian-simulation, error-mitigation",
"url": null
} |
opencv2, ros-indigo
Hope this helps
Originally posted by ct2034 with karma: 862 on 2014-10-07
This answer was ACCEPTED on the original site
Post score: 0
Original comments
Comment by K. Zeng on 2014-10-08:\
Would something like the code below work?
catkin_package(
INCLUDE_DIRS include
LIBRARIES image_mover
CATKIN_DEPENDS cv_bridge image_transport
DEPENDS system_lib opencv2
)
I don't have a .cpp file in the package's src folder yet. Should I write that out first?
Comment by K. Zeng on 2014-10-08:
UPDATE: What I did in the above comment didn't work.
Comment by ct2034 on 2014-10-08:
What is not working? Which steps are you taking? What is the output of catkin_make?
Comment by K. Zeng on 2014-10-09:
Never mind. What I ended up doing was the following:
find_package(OpenCV REQUIRED)
find_package(catkin REQUIRED COMPONENTS
cv_bridge
image_transport
) | {
"domain": "robotics.stackexchange",
"id": 19662,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "opencv2, ros-indigo",
"url": null
} |
temperature, reference-request, units
Title: How to determine omitted units in a publication I have found a 1954 paper in J. Am. Chem. Soc. which gives various temperatures in degrees but does not specify units.
A snippet of the introduction is:
Titanium reacts appreciably with fluorine above 150°… | {
"domain": "chemistry.stackexchange",
"id": 11744,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "temperature, reference-request, units",
"url": null
} |
quantum-mechanics, condensed-matter, hamiltonian
&=
-a_{i\alpha}^\dagger a_{i\beta} a_{j\gamma}^\dagger a_{j\delta}
\delta_{\alpha\delta}\delta_{\beta\gamma}\\
&=
-\frac{1}{2}
a_{i\alpha}^\dagger a_{i\beta} a_{j\gamma}^\dagger a_{j\delta}
\left(
\vec{\sigma}_{\alpha\beta}\cdot \vec{\sigma}_{\gamma\delta} +
\delta_{\alpha\beta}\delta_{\gamma\delta}
\right).
\end{align}
Using $\mathbf{S}_{i;\alpha\beta} = \frac{1}{2}a_{i\alpha}^\dagger a_{i\beta}\vec{\sigma}_{\alpha\beta}$ and $n_i = a_{i\alpha}^\dagger a_{i\alpha}$, the above becomes
\begin{align}
a_{i\alpha}^\dagger a_{j\beta}^\dagger a_{i\beta}a_{j\alpha}
&=
-2
\left(
\mathbf{S}_i \cdot \mathbf{S}_j + \frac{1}{4}
n_i n_j
\right).
\end{align}
Multiplying this equality by $J^F_{ij}\equiv U_{ijji}$ and summing over $i \neq j$, we find
$$H_{x} = -2\sum_{ij}J^F_{ij}\left(
\mathbf{S}_i \cdot \mathbf{S}_j + \frac{1}{4}
n_i n_j
\right),$$
as desired. | {
"domain": "physics.stackexchange",
"id": 89759,
"lm_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, condensed-matter, hamiltonian",
"url": null
} |
java, beginner, api, collections, client
Map<String, Object> mapSystemProvided = environments.getSystemProvided();
LinkedHashMap<String, Object> SERVICES = (LinkedHashMap<String, Object>) mapSystemProvided.get("SERVICES");
ArrayList<Object> apps = (ArrayList<Object>) SERVICES.get("apps");
LinkedHashMap<String, Object> appsList = (LinkedHashMap<String, Object>) apps.get(0);
LinkedHashMap<String, Object> credentials = (LinkedHashMap<String, Object>) appsList.get("credentials");
HashMap<String, String> parameters = new HashMap<String, String>();
parameters.put(ID, credentials.get(ID).toString());
parameters.put(DEFAULTS, credentials.get(DEFAULTST).toString());
return parameters; Consider breaking this into more, reusable methods. E.g.
public Map<String, Object> getCredentials(String url, String org, String space, String app)
throws MalformedURLException { | {
"domain": "codereview.stackexchange",
"id": 25078,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, beginner, api, collections, client",
"url": null
} |
dataset, csv, matrix
Title: Removing # from header I have a $(418,2)$ matrix and I want to convert it to csv. so I write:
np.savetxt('titanic1.csv', Sol, fmt='%.2f', delimiter=",",header="PassengerId,Survived")
But the header I get is "# PassengerId" instead of "PassengerId" which is what I want. How can I solve this? The documentation of numpy says you can add the parameter comments='', but warns that np.loadtxt() might not work on the resulting file. | {
"domain": "datascience.stackexchange",
"id": 5466,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "dataset, csv, matrix",
"url": null
} |
-
"$\emptyset$ is a basis for {0}" is an immediate consequence of the definitions. There is no false belief in this point. – Johannes Hahn May 12 '10 at 15:14
Dear Johannes, please reread my post. – Pierre-Yves Gaillard May 12 '10 at 15:18
Your opinions are normative statements: "one should" and "it is better". It is naive to suppose that there is one best method that one should use to compute the matrix exponential. – Robin Chapman May 15 '10 at 14:07
I don't think the OP wants examples of normative statements. As I read it, the question is about conceptual errors regarding non-normative mathematical statements. – Qiaochu Yuan May 17 '10 at 6:19
An elementary false belief in elementary number theory: for $a, b, c\hspace{.1cm}\varepsilon\hspace{.1cm} \mathbb{N}$
$LCM\left(a,b\right)\times GCF\left(a,b\right) = ab$ .
Thus, $LCM\left(a,b,c\right)\times GCF\left(a,b,c\right) = abc$.
In general, $\left(a_1,a_2,\ldots,a_n\right)[a_1,a_2,\ldots,a_n] = a_1a_2\ldots a_n$. | {
"domain": "mathoverflow.net",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9532750427013548,
"lm_q1q2_score": 0.8265235558618426,
"lm_q2_score": 0.8670357649558006,
"openwebmath_perplexity": 347.372224911955,
"openwebmath_score": 0.8915233016014099,
"tags": null,
"url": "http://mathoverflow.net/questions/23478/examples-of-common-false-beliefs-in-mathematics/40778"
} |
• About the $c$, it's to eliminate the constants, see the problem Arkamis referred and the answer of Kaz, which has a related idea. The point is to make the integral so small it would be alike a derivative, only as a different expression. (BTW, the second $c\to x$ limit was not suppose to be there, I pasted it twice) – JMCF125 Nov 27 '13 at 21:55 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9489172601537141,
"lm_q1q2_score": 0.8531918022010425,
"lm_q2_score": 0.8991213860551286,
"openwebmath_perplexity": 414.6755314518558,
"openwebmath_score": 0.9108422994613647,
"tags": null,
"url": "https://math.stackexchange.com/questions/577597/does-lh%C3%B4pitals-work-the-other-way"
} |
c, strings, io
void test4(const char *s) {
FILE *stream = fopen("tmp.bin", "wb");
size_t len = strlen(s);
fwrite(s, 1, len, stream);
fclose(stream);
for (size_t i = 0; i < len; i++) {
printf(isprint((unsigned char)s[i]) ? "%c" : "<%d>", s[i]);
}
puts("");
stream = fopen("tmp.bin", "r");
char buf[4];
sample(buf, sizeof buf, stream);
fclose(stream);
fflush(stdout);
}
int main(void) {
test4("12\nAB\n");
test4("123\nABC\n");
test4("1234\nABCD\n");
test4("");
test4("1");
test4("12");
test4("123");
test4("1234");
return 0;
}
Output
12<10>AB<10>
Size:3 string:"12"
Size:3 string:"AB"
End of file
123<10>ABC<10>
Size:4 string:"123"
Size:4 string:"ABC"
End of file
1234<10>ABCD<10>
Line too long: begins with <123>
End of file
1
Size:2 string:"1"
End of file
12
Size:3 string:"12"
End of file
123
Size:4 string:"123"
End of file | {
"domain": "codereview.stackexchange",
"id": 29586,
"lm_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, io",
"url": null
} |
spectroscopy, spectra
Title: Why is He I 6678.151 line used for investigating variations in Be stars? Why is He I 6678.151 line used for investigating variations in Be stars? I mean, for instance, asymmetry and radial velocity. Many thanks Neutral Hydrogen exhibits a Balmer series which is a transition of the electron from a higher energy level down to the n=2 energy level. The n=3 to n=2 transition, otherwise known as Ba-α has a wavelength of 6562.79 Angstroms. Neutral Helium (a.k.a He I) can exhibit emissions similar to the Hydrogen Balmer series. And in fact, the He I 6678.151 Angstrom emission line is closest in energy to the H I Ba-α emission line, making it a good proxy for the H I Ba-α line. | {
"domain": "astronomy.stackexchange",
"id": 5563,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "spectroscopy, spectra",
"url": null
} |
SUFFICIENT. HOPE IT HELPS _________________ When you want to succeed as bad as you want to breathe ...then you will be successfull.... GIVE VALUE TO OFFICIAL QUESTIONS... GMAT RCs VOCABULARY LIST: http://gmatclub.com/forum/vocabulary-list-for-gmat-reading-comprehension-155228.html learn AWA writing techniques while watching video : http://www.gmatprepnow.com/module/gmat-analytical-writing-assessment : http://www.youtube.com/watch?v=APt9ITygGss Originally posted by blueseas on 11 Jul 2013, 08:48. Last edited by blueseas on 11 Jul 2013, 08:58, edited 1 time in total. Math Expert Joined: 02 Sep 2009 Posts: 46280 Re: If a car traveled from Townsend to Smallville at an average [#permalink] ### Show Tags 11 Jul 2013, 08:55 3 1 If a car travelled from Townsend to Smallville at an average speed of 40 mph and then returned to Townsend along the same route later that evening, what was the average speed for the entire trip? (1) The trip from Townsend to Smallville took 50% longer than the trip | {
"domain": "gmatclub.com",
"id": null,
"lm_label": "1. Yes\n2. Yes\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 1,
"lm_q1q2_score": 0.8104789155369047,
"lm_q2_score": 0.8104789155369047,
"openwebmath_perplexity": 7161.611365800858,
"openwebmath_score": 0.675899088382721,
"tags": null,
"url": "https://gmatclub.com/forum/if-a-car-traveled-from-townsend-to-smallville-at-an-average-122843.html"
} |
java
String[] sourceNameParts = bean.source().getName().split("/");
String sourceName = sourceNameParts[sourceNameParts.length-1];
String[] entryNameParts = bean.entry().getName().split("/");
String entryName = entryNameParts[entryNameParts.length-1];
entryNameParts[entryNameParts.length-1] = sourceName + entryName;
String newEntryName = Arrays.asList(entryNameParts).stream().collect(Collectors.joining("/")); | {
"domain": "codereview.stackexchange",
"id": 14894,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java",
"url": null
} |
javascript, game-of-life
neighbors += isAliveOrBorn(cells[x + 1][y - 1]);
}
if(y % 4 == 0 || y % 4 == 2 || y % 4 == 3){
neighbors += isAliveOrBorn(cells[x + 1][y + 1]);
}
} | {
"domain": "codereview.stackexchange",
"id": 4553,
"lm_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, game-of-life",
"url": null
} |
complexity-theory, knowledge-representation
Title: Why is the certificate version of NP so ubiquitous? I've noticed that the certificate/verification version of the definition of the class NP is much more popular online than the Turing machine version. In particular, the Wikipedia page has the certificate version stating
NP is the set of decision problems for which the problem instances, where the answer is "yes", have proofs verifiable in polynomial time by a deterministic Turing machine. | {
"domain": "cs.stackexchange",
"id": 20026,
"lm_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, knowledge-representation",
"url": null
} |
projectile, rocket-science, space-travel, nasa
The hammer may be vibe, shock, hot/cold, and vacuum tested. In the space simulator (see JPL's--a nation historic monument), the sun's heat load is simulated.
Similar hammers are vibe, shock, hear/cold, tested to failure to compute the margin.
If you have 1000 hammers, a huge batch is used and they are "burned in"--se Weibull Distribution and Failure analysis---failures are most likely early or late, so the minimum is calculated to be during the mission.
The hammer also goes under EMC and EMI compatibility testing.
Also: you don't fly Apple's newest hammer--you get one that is 10 years old because it has been space qualified (class S).
Did I mention radiation hardness requirements, and SEU sensitivity?
Above all that are planetary protection requirements.
Regarding radiation forces and what not, they are included, but over 40 years can go south. See "Pioneer Anomaly". | {
"domain": "physics.stackexchange",
"id": 100015,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "projectile, rocket-science, space-travel, nasa",
"url": null
} |
cosmology, acceleration, space-expansion, universe
Title: Universe expansion acceleration [I've read, among others, other questions on this, don't believe this is a duplicate]
I (think I) understand the evidence that distant galaxies are moving away from us faster than closer galaxies. What I don't understand is why this even calls for an explanation..
Take a naive picture, where the big bang was an explosion of matter within space. Matter began spreading with some distribution of velocities, in all directions. Now we observe the universe billions of years later - it seems only natural that the galaxies who traveled the furthest during this time are exactly those with largest initial velocities.
Isn't the same true if we consider the big bang to be a dilation of space itself? The parts of space that 'are dilating' the most (not only them, but the entire portion of space between them and us), must be those that accumulated the most distance from us in the time since the bang. | {
"domain": "physics.stackexchange",
"id": 64762,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "cosmology, acceleration, space-expansion, universe",
"url": null
} |
# Largest Triangle with Vertices in the Unit Cube
How would one find a triangle, with vertices in or on the unit cube, such that the length of the smallest side is maximized? And what is that length?
A lower bound for the length is $\sqrt{2}$, by looking at an equilateral triangle, and an upper bound is $\sqrt{3}$, since that's the diameter of the unit cube. | {
"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.807746812203652,
"lm_q2_score": 0.8289388083214156,
"openwebmath_perplexity": 180.7833560109982,
"openwebmath_score": 0.9015769362449646,
"tags": null,
"url": "http://math.stackexchange.com/questions/44396/largest-triangle-with-vertices-in-the-unit-cube"
} |
programming, qiskit, ibm-q-experience
~\anaconda3\lib\sitepackages\qiskit\providers
\providers\provider.py in get_backend(self, name,
**kwargs)
53 raise
QiskitBackendNotFoundError("More than one backend
matches the criteria")
54 if not backends:
---> 55 raise
QiskitBackendNotFoundError("No backend matches the
criteria")
56
57 return backends[0]
QiskitBackendNotFoundError: 'No backend matches the
criteria'
I have already made an account at IBM, and have already seen the post (Trying to get a provider from IBMQ but get 'No provider matches the criteria.'), but the problem still exists. The backend that you choose ( 'ibmq_16_melbourne' ) was retired recently. With a different backend, it should work. You can find available IBM Quantum systems here.
https://quantum-computing.ibm.com/services?services=systems | {
"domain": "quantumcomputing.stackexchange",
"id": 3038,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "programming, qiskit, ibm-q-experience",
"url": null
} |
formal-languages, regular-languages, turing-machines, automata
Title: Can a Turing Machine decide only non-regular languages? I have an assignment where i need to create a Turing machine that decides an infinite language $L\subset \{0,1\}^*$ for which all $L'\subseteq L$, if $|L'|=\infty$, then $L'$ is not a regular language.
I think this is not possible due to Rice's Theorem. It's not possible to tell for a Turing Machine if a language is regular or not.
Moreover, on any given input, the machine can loop so it cannot decide an infinite language $L$.
Is this the right answer? It seems too easy to be the answer... Any input would be appreciable. Thanks in advance. @Karolis Juodele already gave the answer, and your answer is also correct.
Another thing to keep in mind is although infinite languages can be undecidable, some of them are regular.. ex. $\{0\}^* \subset \{0,1\}^*$ is an infinite language but is regular (you can construct a FSM, with a single state, that accepts it). | {
"domain": "cs.stackexchange",
"id": 1964,
"lm_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, regular-languages, turing-machines, automata",
"url": null
} |
thermodynamics, water, surface-tension
Title: Dependency of $\mathrm{H_2O}$ surface tension on vapour pressure How is does the surface tension between:
liquid water, and
humid air
depend on
$\mathrm{H_2O}$ partial pressure in the air, and
temperature? | {
"domain": "physics.stackexchange",
"id": 46685,
"lm_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, water, surface-tension",
"url": null
} |
So we have for each $p$, $n$ $$\frac{4n + 3}{4n+4} \cdot \nu_p(b) \le \nu_p(a) \le \frac{4n+2}{4n+1}\nu_p(b)$$ letting $n\to \infty$ yields $\nu_p(a) = \nu_p(b)$ for each $p$, so $a = b$.
AB,
-
If $a > b$ then $\frac{a}{b}>1$ and hence there is an $n$ such that $\left(\frac{a}{b}\right)^n > b$, thus $a^n > b^{n+1}$. This contradicts $a^{4k+1} | b^{4k+2}$. The case $a<b$ works in just the same way.
-
I like that this solution makes it clear that divisibility is a red herring---the problem would work just as well with the much weaker hypothesis that $a \leq b^2$, $b^3 \leq a^4$, etc., for real values of $a$ and $b$. – Dan Petersen Mar 23 '12 at 15:08
@Dan Divisibility isn't necessarily a red herring, since the proof I gave employs divisibility, and it works in rings where the (archimedean) order-based proofs do not apply, e.g. the Gaussian integers $\mathbb Z[i]$ or the ring of integers of any (complex) algebraic number field. – Bill Dubuque Mar 24 '12 at 21:50 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9783846719643228,
"lm_q1q2_score": 0.8315987773113672,
"lm_q2_score": 0.8499711832583696,
"openwebmath_perplexity": 161.73729848862453,
"openwebmath_score": 0.9866083860397339,
"tags": null,
"url": "http://math.stackexchange.com/questions/123584/let-a-b-in-mathbbz-such-that-ab2-b3a4-a5b6-b7a8-cdots/123591"
} |
geometry, satellites, gps
Title: Is it possible for 4 satellites cannot render a position fix on Earth? I recently learnt about how GPS works and how it uses the intersection of spheres to locate a person which got me thinking whether 4 spheres can always guarantee a position fix. My understanding is that greater than 3 spheres can always give 2 points of intersection provided all the centres of the spheres are in the same plane. I imagine that it rarely occurs that all the satellites are coplanar but also I imagine its possible that we can interpret which of the two intersections give a position on Earth rather than in space. Still I am curious to know whether I'm correct in thinking that no number of satellites can guarantee in every case a singular intersection since it is possible that the find themselves all to be coplanar. | {
"domain": "physics.stackexchange",
"id": 97597,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "geometry, satellites, gps",
"url": null
} |
dna, biotechnology, plasmids, recombination
Title: Restriction enzyme digestion A circular plasmid of 10,000 base pairs (bp) is digested with two restriction enzymes, A and B. This produces a 3000 bp and a 2000 bp bands when visualized on an agarose gel. When digested with one enzyme at a time, only one band is visible at 5000 bp.
If the first site for enzyme A (A1) is present at the 100th base, the order in which the remaining sites (A2, B1 and B2) are present is -
(A) 3100, 5100, 8100
(B) 8100, 3100, 5100
(C) 5100, 3100, 8100
(D) 8100, 5100,. 3100
NOTE: This is a Kishore Vaigyanik Protsahan Yojana 2014 exam (stream SX) Question. I really couldn't understand the diagram shown in the solution, and my teachers were of no help either. The diagram in the solution is: Examine the effects of Enzyme A on its own.
Enzyme A performs two cuts that result in 2 fragments that are 5000bp long.
We know that the first cut is made at the 100th bp. Therefore the second cut is made at the 5100th bp (A2). | {
"domain": "biology.stackexchange",
"id": 6073,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "dna, biotechnology, plasmids, recombination",
"url": null
} |
e. We would then assign weights to vertices, not edges. Python – Get the shortest path in a weighted graph – Dijkstra Posted on July 22, 2015 by Vitosh Posted in VBA \ Excel Today, I will take a look at a problem, similar to the one here. FindShortestPath[g, s, All] generates a ShortestPathFunction[] that can be applied repeatedly to different t. [email protected] ple, Figure 1a illustrates a graph G, and Figure 1e shows an aug-mented graph G∗ constructed from G. According to [11], [12], [13], since 1959 Dijkstra's algorithm has been recognized as the best algorithm and used as method to find the shortest path. nodes in a given directed graph is a very common problem. You are also given a positive integer k. A subgraph is a subset of a graph’s edges (with associated vertices) that form a graph. ” Dijkstra’s algorithm is an iterative algorithm that provides us with the shortest path from one particular starting node to all other nodes in the graph. The shortest path function can also be | {
"domain": "chicweek.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.987758723627135,
"lm_q1q2_score": 0.8528226068102591,
"lm_q2_score": 0.8633916222765627,
"openwebmath_perplexity": 383.31142122654893,
"openwebmath_score": 0.5556688904762268,
"tags": null,
"url": "http://isxy.chicweek.it/number-of-shortest-paths-in-a-weighted-graph.html"
} |
recurrence-relation, master-theorem
Title: How to deal with $n\sqrt n$ in master theorem? In classifying the following formula's asymptotic complexity using master theorem, I have $a = 8$, $b = 4$, and $d = ?$
$T(n) = 8T(n/4) + n\sqrt n$
How do I handle $n\sqrt n$ in this case to get $d$ ? You have to remember that $\sqrt[x]{y} = y^{\frac{1}{x}}$.
Then the rest should follow easily.
Don't look at the following unless you're genuinely stuck.
$n\sqrt{n} = n^{1}\cdot n^{\frac{1}{2}} = n ^{\frac{3}{2}}$, hence $d = \frac{3}{2}$. We also have $a = 8$ and $b = 4$, so $\log_{b}(a) = \log_{4}(8) = \frac{3}{2}$. Hence we have the second case of the Master Theorem where $f(n) \in \Theta(n^{d}\log^{0}n) = \Theta(n^{d})$ with $d = \log_{b}(a)$. Therefore $T(n) \in \Theta(n^{d}\log n) = \Theta(n^{\frac{3}{2}}\log n)$. | {
"domain": "cs.stackexchange",
"id": 5208,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "recurrence-relation, master-theorem",
"url": null
} |
ros-melodic
Original comments
Comment by shreshtha on 2023-01-27:
Thank you for your response billy,actually I had to install python3 for another program that I was working and I think I messed up somewhere by installing it, are there any fixes available, shall I completely remove python3 from my system?
Comment by brean on 2023-01-27:
I am wondering how you managed to do this? I think you sourced a python3 environment into your python2 environment, so check your .bashrc-file as well as your path. If you just run "python -v" it should show you the python version that you use as default, that should be python2.
Both python versions should be fine next to each other if you installed python from your package manager (like apt).
But to help you uninstalling python3 might be the right fix you need, you probably also need to reinstall some python2 packages (at least the ones you installed after your python3 installation).
Comment by shreshtha on 2023-01-27: | {
"domain": "robotics.stackexchange",
"id": 38244,
"lm_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-melodic",
"url": null
} |
Given 68 cubes, the table top is $$68-4h$$ where $$h$$ is the height of the legs.
Under the table we have $$(h)(68-4h)=68h-4h^2$$ and the total volume (sans legs) is $$top+under-legs=(68-4h)+(68h-4h^2)-(4h)=68+60h-4h^2$$.
For a continuous function, the max volume can be found by where the increasing/decreasing slope of the given function is zero.
The first derivative $$\frac{d}{dh}(68+60h-4h^2)=-8h+60\implies 60-8h=0\implies 8h=60$$
This tells us that the max leg height is $$\frac{60}{8}=7.5$$ If fractional heights were allowed the max volume would be $$68+60h-4h^2=68+(60\times7.5)-(4\times7.5^2)=68+450-225=293$$ but we are are restricted to the nearest integers. Soooo
$$68+60h-4h^2=68+(60\times7)-(4\times49)=68+420-196=292$$ and $$68+60h-4h^2=68+(60\times8)-(4\times64)=68+480-256=292$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9719924785827003,
"lm_q1q2_score": 0.8318808794254213,
"lm_q2_score": 0.8558511488056151,
"openwebmath_perplexity": 361.8134575810288,
"openwebmath_score": 0.8923583626747131,
"tags": null,
"url": "https://math.stackexchange.com/questions/3314323/determine-the-maximum-possible-volume-excluding-the-volume-of-the-legs"
} |
ros, opencv3
^
In file included from /usr/local/include/opencv2/core/core.hpp:48:0,
from /home/tomas/ws/src/ecto_opencv/cells/cv_bp/opencv/cv_mat.cpp:10:
/usr/local/include/opencv2/core.hpp:2874:27: error: initializing argument 1 of ‘static cv::Ptr<cv::Formatter> cv::Formatter::get(int)’ [-fpermissive]
static Ptr<Formatter> get(int fmt = FMT_DEFAULT);
^
/home/tomas/ws/src/ecto_opencv/cells/cv_bp/opencv/cv_mat.cpp:311:35: error: ‘class cv::Formatter’ has no member named ‘write’
cv::Formatter::get("python")->write(ss,m);
^
make[2]: *** [ecto_opencv/cells/cv_bp/opencv/CMakeFiles/opencv_boost_python.dir/highgui_defines.cpp.o] Error 1
make[2]: *** [ecto_opencv/cells/cv_bp/opencv/CMakeFiles/opencv_boost_python.dir/cv_highgui.cpp.o] Error 1
make[2]: *** [ecto_opencv/cells/cv_bp/opencv/CMakeFiles/opencv_boost_python.dir/cv_mat.cpp.o] Error 1 | {
"domain": "robotics.stackexchange",
"id": 23179,
"lm_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, opencv3",
"url": null
} |
3 y square + 5 Y que incident novel substrate 10 23 get into 1 minus y is equals to this will be 131 - 25 square minus 3 Y is this will be + 2 y square 7 y cube minus 5 y cube + 2 y cube and so on now this will be a sin to 1 minus y is equals to oneplus now these terms are in GP these terms are in GP with first term and the common ratio is sum to infinity infinite sum to infinity and CP is given by a upon 1 minus 10 it will be as to why should to Y upon 1 minus y
is we get S into 1 minus y is equals to 1 + 1 upon 1 minus one aur from this as will be equal to 1 + 5 upon 1 minus y to the whole square with is given in statement to that sum of the series is equal to 1 + 1 upon 1 minus b whole square so the statement one is to from this we can say that statement to is true in the first statement we have given the series this series of this series can be obtained by putting Y is equals to 1 1 minus one upon X in this series so if Y is equals to | {
"domain": "doubtnut.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9850429142850274,
"lm_q1q2_score": 0.816540299512885,
"lm_q2_score": 0.8289388083214156,
"openwebmath_perplexity": 748.8376338087407,
"openwebmath_score": 0.47461047768592834,
"tags": null,
"url": "https://www.doubtnut.com/question-answer/statement-1-if-xgt1-the-sum-to-infinite-series-1-31-1-x-51-1-x2-71-1-x3-is-2x2-x-statement-2-if-0lty-644742140"
} |
machine-learning, classification, python
Training, validation and testing phases are represented by the following code snippet:
batch size = 20
epoch = 10
t_accuracy_gain = []
accuracy_gain = []
for epoch in range(epochs):
# Training
training_loss = 0
total, total_t = 0, 0
for train_input, train_labels in trainloader:
# set optimizer to zero grad to remove previous epoch gradients
optimizer.zero_grad()
y_pred = clf(train_input)
loss = criterion_weighted(y_pred, train_labels)
loss.backward()
# optimize
optimizer.step()
training_loss += loss.item()
y_pred = torch.nn.functional.softmax(y_pred, dim=1)
for i, p in enumerate(y_pred):
if train_labels[i] == torch.max(p.data, 0)[1]:
total_t = total_t+1
accuracy_t = total_t/train_size
t_accuracy_gain.append(accuracy_t) | {
"domain": "ai.stackexchange",
"id": 3615,
"lm_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, classification, python",
"url": null
} |
ros, urdf, robot-model, solidworks, stl
Now I am able to load PR2 models but not the one of my robot. The original model was build in solidworks and maybe this is the problem. I will try to port it from Catia and I will say if it works.
Originally posted by jsogorb on ROS Answers with karma: 77 on 2011-03-31
Post score: 3 | {
"domain": "robotics.stackexchange",
"id": 5251,
"lm_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, urdf, robot-model, solidworks, stl",
"url": null
} |
defined by parametric equations = (𝑡), = (𝑡) o Area of a surface of revolution By rotating about the -axis:. Area of a Surface of Revolution The polar coordinate versions of the formulas for the area of a surface of revolution can be obtained from the parametric versions, using the equations x = r cos θ and y = r sin θ. 3 The Christoffel Symbols for a Surface of Revolution 45. One-to-one and Inverse Functions. Volume - Spreadsheet - Equation - Expression (mathematics) - Theorem - Science - Commensurability (philosophy of science) - English plurals - Contemporary Latin - Latin influence in English - Mathematics - Formal language - Sphere - Integral - Geometry - Method of exhaustion - Parameter - Radius - Algebraic expression - Closed-form expression - Chemistry - Atom - Chemical compound - Number - Water. A surface of revolution is a surface generated by rotating a two-dimensional curve about an axis. Equating x, y , respectively z from equations (2) and (4) one gets u cos v = f ( t ) | {
"domain": "workingmotors.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9886682484719524,
"lm_q1q2_score": 0.8322862842636088,
"lm_q2_score": 0.8418256432832333,
"openwebmath_perplexity": 430.68825000610263,
"openwebmath_score": 0.8794888257980347,
"tags": null,
"url": "http://workingmotors.it/qeas/surface-of-revolution-parametric-equations.html"
} |
homework-and-exercises, special-relativity
Once I found the velocity from the above, I will use it to calculate the time-dilated lifetime of the muon. Then, I will divide the circumference of the circle by the velocity. Then, I will divide the muon lifetime by this time to find out how many times the muon can travel the circle before it decays. Is this all, or am I missing some relativistic effect? (I.e. Does traveling in a circle complicate this problem anymore than if the muon was traveling in a straight line?) As you say, the muon's mass is 106 MeV. Suppose that you're not certain whether an energy of $\rm 2\,TeV = 2\,000\,000\,MeV$ is the total energy $\gamma mc^2$ or the kinetic energy $(\gamma-1)mc^2$. Either way you have $\gamma \approx 2\times10^4$, you're solidly in the ultrarelativistic regime, and the speed is experimentally indistinguishable from $c$. | {
"domain": "physics.stackexchange",
"id": 60821,
"lm_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, special-relativity",
"url": null
} |
Since $1729 = 12^3 + 1$, it is divisible by $12 + 1 = 13$.
April 20th, 2018, 05:45 AM #20
Newbie
Joined: Mar 2018
From: United States
Posts: 28
Thanks: 2
Quote:
Originally Posted by penrose Every Mersenne number has an associated Fermat-type number. 2^n - 1 and 2^n + 1 Is the following true? A Fermat-type number 2^n+1, n odd, is always divisible by 3.
Quote:
Originally Posted by cjem Yes. Note that $4 \equiv 1 \pmod 3$, so all powers of $4$ are also $1 \pmod 3$. So $2^{2k+1} + 1= 2 \times 4^k + 1\equiv 2 \times 1 + 1 \equiv 0 \pmod 3$. i.e. $3$ divides $2^{2k+1} + 1$.
Now I want to revisit this proof using induction.
Consider the assertion that $2^n + 1 = 3S_n$ for odd n. This is certainly true for n = 1. If true for a given odd n, then
$............................................. 2^{n + 2} + 1 = 2^2*2^n + 1$
$................................................. ..... = 2^2*(3S_n - 1) + 1$
$................................................. ..... = 3(2^2S_n - 1)$ | {
"domain": "mymathforum.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9664104924150546,
"lm_q1q2_score": 0.8115277152577264,
"lm_q2_score": 0.8397339656668286,
"openwebmath_perplexity": 1244.5287289731061,
"openwebmath_score": 0.7834072113037109,
"tags": null,
"url": "http://mymathforum.com/number-theory/343794-primes-factoring-2.html"
} |
proof-techniques, formal-methods, software-verification
But formal methods don't scale well. It is very unlikely that they would scale -in the next 20 or 30 years- (for present-day programming languages and code) to software as big as the Qt toolkit or the Linux kernel (because formally specifying the intended behavior of Qt or of Linux kernel is practically impossible). For example, C heap allocation is easy to code (that is, a lot of C code uses malloc & free), but difficult to formalize and prove (because current shape analysis techniques don't scale well to large programs). That internal complexity and difficult of formal methods hinders its uses in real-world programs (whose size is growing a lot: a source code editor today is much more complex and bigger than what vi was in the 1980s). | {
"domain": "cs.stackexchange",
"id": 11628,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "proof-techniques, formal-methods, software-verification",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.