text stringlengths 1 1.11k | source dict |
|---|---|
newtonian-mechanics, friction, free-body-diagram
Title: A curious thought about inclined planes So imagine you have a block on an inclined plane. The angle of inclination is such that the block doesn't move - it is at rest. There's friction and normal force too but the key point is that the block is not moving. Would the angle of inclination (theta max) be larger if the system was on the moon instead of the earth?
or put generally - does the angle of inclination depend on the gravity?
Would the angle of inclination (theta max) be larger if the system was
on the moon instead of the earth? | {
"domain": "physics.stackexchange",
"id": 91717,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "newtonian-mechanics, friction, free-body-diagram",
"url": null
} |
entanglement, foundations, quantum-metrology
\max \text{Var}(X) = \left(\frac{N(\lambda_M - \lambda_m)}{2}\right)^2
$$
which also gives $\text{Var}(E) = (\Delta h)^2$ since variance is not affected by the constant shift of $N\lambda_m$.
Note that you can apply this same technique to each $H_i$ individually to recover the maximum variance for the case of a separable state; the factor of $N^2$ disappears compared to the above derivation and only a factor of $N$ is reintroduced by summing up the variances of the separate systems. | {
"domain": "quantumcomputing.stackexchange",
"id": 2755,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "entanglement, foundations, quantum-metrology",
"url": null
} |
How to calculate odds in finance
I'm studying both Financial Math and Statistics, and it came to my mind how could one interrelate them.
So I thought in an example and started to scribble:
Given two business operation, the first one with 80% of sucess and 5% interest rate per month; the second one with 95% of sucess and 1,5% interest rate per month. Considering that if the operation fails, no money is lost, which one is more likely profitable at medium term (10 months)?
The first one:
$$M = x\cdot(1+0,05)^{10}$$ $$M = 1,63x$$
$$Odds = (\frac{80}{100})^{10} = 10,47\%$$
The second one: | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9759464527024444,
"lm_q1q2_score": 0.8153871943273903,
"lm_q2_score": 0.8354835371034368,
"openwebmath_perplexity": 449.9876605661977,
"openwebmath_score": 0.7892648577690125,
"tags": null,
"url": "https://math.stackexchange.com/questions/4317277/how-to-calculate-odds-in-finance"
} |
Timing[Max[Map[collatzLength, Range[1, 1000000]]]]
returns 15.070896 sec / 524 on my 2011 macbook pro.
Note that directly evaluating collatzLength[3^300] // Timing requires increasing the recursion limit whereas mapping to a large range does not, this again due to memoization.
• It seems slightly faster, and in my opinion more readable, to catch the n=1 case with a separate pattern rather than testing for n==1, f[1] = 1; f[n_] := f[n] = 1 + f[If[EvenQ[n], n/2, 3 n + 1]] – Simon Woods Mar 14 '15 at 23:04
• Thanks @Simon, I added you suggestion. The code is more readable and the timing marginally improved (18 down to 15 sec). – A.G. Mar 14 '15 at 23:12 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9511422186079557,
"lm_q1q2_score": 0.8121924685720741,
"lm_q2_score": 0.8539127510928476,
"openwebmath_perplexity": 1097.0681523825638,
"openwebmath_score": 0.2987041473388672,
"tags": null,
"url": "https://mathematica.stackexchange.com/questions/77279/finding-large-collatz-sequences-trying-to-improve-speed"
} |
javascript, jquery, form
/* EXTRME VALUES */
if(edition === "extreme") {
var cost = extremeCost[0];
var savings = extremeSavings[0];
}
if(value > 4 && edition === "extreme") {
var cost = extremeCost[1];
var savings = extremeSavings[1];
}
if(value > 9 && edition === "extreme") {
var cost = extremeCost[2];
var savings = extremeSavings[2];
}
if(value > 24 && edition === "extreme") {
var cost = extremeCost[3];
var savings = extremeSavings[3];
}
if(value > 49 && edition === "extreme") {
var cost = extremeCost[4];
var savings = extremeSavings[4];
}
if(value > 99 && edition === "extreme") {
var cost = extremeCost[5];
var savings = extremeSavings[5];
}
if(value > 199 && edition === "extreme") {
var cost = extremeCost[6];
var savings = extremeSavings[6];
} | {
"domain": "codereview.stackexchange",
"id": 4513,
"lm_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, form",
"url": null
} |
of a (... Than 100 edges, combine the prefixes as follows is founded on the ordering of the bars of a distribution... Are simple algorithms to calculate median, range from a grouped frequency table the.. Usage of this command is the point in the table contains the frequency or of... By Aristophanes, found at Caere and now in the following figure 29. The pre-test examination ordering of the orientation of the marks obtained by 50 students in a visual scene in Capitoline. And the most efficient of all upper horizontal sides of all n-gons with given side lengths, the signed of... Considering the enclosed point set frequency polygon wikipedia any number of times a score occurs … (! Their own names ; for example, the one with the bounding polygonal chains of simple polygons and self-intersecting! To make a frequency distribution emphasizing the overall pattern in the table a question! Point sets, we can find the area of the top center scores of the bars of a histogram particular! And | {
"domain": "desertdingo.com",
"id": null,
"lm_label": "1. Yes\n2. Yes",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.960361158630024,
"lm_q1q2_score": 0.827387826184822,
"lm_q2_score": 0.86153820232079,
"openwebmath_perplexity": 1024.6579595903306,
"openwebmath_score": 0.5896909832954407,
"tags": null,
"url": "http://desertdingo.com/l7ocfce/viewtopic.php?1b9ddc=frequency-polygon-wikipedia"
} |
c#, concurrency, async-await
foreach (var j in availableJobs)
{
var myJob = new ScheduledJob
{
CancellationTokenSource = new CancellationTokenSource(),
Key = j
};
// Main is really a simulation for a System.Threading.Timer callback method, so I want fire and forget by *not* awaiting Task.Factory.StartNew
Task.Factory.StartNew(
async jobState =>
{
var scheduledJob = jobState as ScheduledJob; | {
"domain": "codereview.stackexchange",
"id": 22746,
"lm_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#, concurrency, async-await",
"url": null
} |
First, let us assume that $a, b > 0$ without loss of generality. Then in this regime, $f(x) = (a^2 \cos^2 x + b^2 \sin^2 x)^{-1}$ is clearly a well-defined function everywhere, and is periodic with period $\pi$. However, the antiderivative is not unique, and the particular choice of antiderivative $$F(x) = \frac{1}{ab} \tan^{-1} \left( \frac{b}{a} \tan x \right)$$ may not be continuous over a given interval. For example, if we choose the branch of $\tan^{-1}$ that restricts the range to lie in $(-\pi/2, \pi/2)$, then you get this picture for $a = 2$, $b = 0.5$:
As you can see, there is a jump discontinuity in the antiderivative at $x = \pi/2$ that could be rectified by choosing a different branch of the inverse tangent; e.g., we could choose $\tan^{-1}$ to have the range $[0,\pi)$. This fixes the discontinuity at $\pi/2$ so that a definite integral containing this point will not result in an incorrect evaluation. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9755769049752756,
"lm_q1q2_score": 0.8252819066712291,
"lm_q2_score": 0.8459424392504911,
"openwebmath_perplexity": 334.46079770014063,
"openwebmath_score": 0.9600778222084045,
"tags": null,
"url": "https://math.stackexchange.com/questions/1697352/fundamental-theorem-of-calculus-confusion-regarding-atan"
} |
c, file
Title: Read file into char* Because I use the task so often, I wrote a C header for reading a file. I never formally learned C, so I'd really appreciate a code review on the code.
As a matter of personal taste, I do not put a space between the final parenthesis and an opening brace (){).
readfile.h
#ifndef _READ_FILE_INCL
#define _READ_FILE_INCL
#include <stdio.h> /* for FILE, fopen, getc, fclose, EOF */
#include <stdlib.h> /* for malloc, realloc */
// the amount of bytes the file is initially guessed to be
#ifndef _READFILE_GUESS
#define _READFILE_GUESS 256
#endif
/*
* function `read_file`
* arguments: a file name (char*)
* returns: the contents of the file (char*) or NULL if:
* 1. the file does not exist
* 2. memory allocation failed
* return value must be freed
*/
char* read_file(char* name){
FILE* file;
file = fopen(name, "r");
// 1. the file does not exist: return null
if(!file)
return NULL; | {
"domain": "codereview.stackexchange",
"id": 25671,
"lm_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, file",
"url": null
} |
python, performance, algorithm, python-3.x
Title: Solving Pentomino puzzles by using Knuth's Algorithm X I wrote a program which solves Pentomino puzzles by using Knuth's Algorithm X. My priorities were: readability, straightforwardness and brevity of the solution, so I didn't try to squeeze as much performance as possible by eliminating function calls in some places or similar tricks.
I am interested in:
The code review. How this code can be better?
Performance improvement. Do you see a way to increase performance? May be numpy can help here? At this moment the fastest version takes 1 hour 57 minutes on Intel i5-2500 to find all solutions of 5 x 12 board. The second version is slower by three times, but it is having less of code duplicity, so it is more beautiful in my opinion - what do you think?
Reducing a code duplicity of the faster version but without of large performance drop, as I have in my second version. | {
"domain": "codereview.stackexchange",
"id": 37699,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, performance, algorithm, python-3.x",
"url": null
} |
python, object-oriented, community-challenge
I think it would be better to define explicit lower and upper boundaries, and check that I don't try to exceed those. The number of floors above and below the ground floor aren't usually symmetric.
The open() and close() methods on Elevator don't keep track of whether the doors are already open. This can lead to the confusing case where the doors can be opened twice:
>>> es.call_elevator(1, -1)
Elevator 2 moving
On floor 1...
Doors opening on elevator 2.
<Elevator object 2 currently on floor 1>
>>> es.call_elevator(1, -1)
Doors opening on elevator 2.
<Elevator object 2 currently on floor 1> | {
"domain": "codereview.stackexchange",
"id": 15620,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, object-oriented, community-challenge",
"url": null
} |
general-relativity, special-relativity, metric-tensor, tensor-calculus, linear-algebra
how should we do it?
The numbers $x^\mu$ which appear in the partial derivatives are not vectors (or the components of vectors) at all, they are the coordinates in the two coordinate charts.
(3) is simply the chain rule from elementary calculus.
If your coordinate transformation is a simple Lorentz transformation on Minkowski space, then $x'^\mu = \Lambda^\mu_{\ \ \sigma} x^\sigma$, so the derivative is trivial. | {
"domain": "physics.stackexchange",
"id": 68967,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "general-relativity, special-relativity, metric-tensor, tensor-calculus, linear-algebra",
"url": null
} |
optics, photons, angular-momentum, singularities
So basically, light has energy, which is really the same thing as mass according to Einstein's E=mc^2, and it is this that you use to calculate momentum.
There is a fuller explanation at https://van.physics.illinois.edu/qa/listing.php?id=1424 (where I got the quote).
Good question, and I hope this explanation helps! | {
"domain": "physics.stackexchange",
"id": 31648,
"lm_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, photons, angular-momentum, singularities",
"url": null
} |
javascript, beginner, angular.js, asynchronous, firebase
}, function(err) {
if (typeof err !== "string") {
err = "Error";
}
reject(err);
});
}, function(err) {
if (typeof err !== "string") {
err = "Error";
}
reject(err);
});
}, function(err) {
if (typeof err !== "string") {
err = "Error";
}
reject(err);
});
} else {
reject("Error");
}
}, function(err){
reject("Invalid Registration Code");
});
});
}
}; | {
"domain": "codereview.stackexchange",
"id": 18738,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, beginner, angular.js, asynchronous, firebase",
"url": null
} |
powershell, installer
$msg = ("{0} failed with code {1}:{2}" -f $operation, $retVal, $desc)
if (!$continueOnError) { Write-Error $msg } else { Write-Warning $msg }
}
function Install-Service(
[string]$serviceName = $(throw "serviceName is required"),
[string]$targetServer = $(throw "targetServer is required"),
[string]$displayName = $(throw "displayName is required"),
[string]$physicalPath = $(throw "physicalPath is required"),
[string]$userName = $(throw "userName is required"),
[string]$password = $pass,
[string]$startMode = "Automatic",
[string]$description = "",
[bool]$interactWithDesktop = $false
)
{
# can't use installutil; only for installing services locally
#[wmiclass]"Win32_Service" | Get-Member -memberType Method | format-list -property:*
#[wmiclass]"Win32_Service"::Create( ... ) | {
"domain": "codereview.stackexchange",
"id": 17907,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "powershell, installer",
"url": null
} |
parsing, validation, kotlin
import ch.poole.openinghoursparser.*
import de.westnordost.streetcomplete.quests.opening_hours.adapter.OpeningMonthsRow
import de.westnordost.streetcomplete.quests.opening_hours.adapter.OpeningWeekdaysRow
import de.westnordost.streetcomplete.quests.opening_hours.model.CircularSection
import de.westnordost.streetcomplete.quests.opening_hours.model.TimeRange
import de.westnordost.streetcomplete.quests.opening_hours.model.Weekdays
import java.io.ByteArrayInputStream | {
"domain": "codereview.stackexchange",
"id": 36701,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "parsing, validation, kotlin",
"url": null
} |
c
if (c == EOF)
break;
word_count = 0;
word_size = 1;
word = malloc(word_size);
}
free(word);
assert(!ferror(file));
return list;
} This code is very readable. Nice work! I think it could be simplified a bit.
I'll add that I agree completely with what @erichamion has suggested.
Minimize What Can Go Wrong
The function does a lot of allocations. Anytime you allocate memory, it can fail, and you need to deal with that. It's better to not have to allocate memory in the first place. You can remove one allocation by having the caller pass in a reference to a List:
int build_list(List* list, char* fileName)
{
FILE* file = fopen(fileName, "r");
if (file == NULL)
{
return ERR_NO_SUCH_FILE; // this is something defined by your code
}
list->head = NULL;
list->tail = NULL;
//... etc. | {
"domain": "codereview.stackexchange",
"id": 15218,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c",
"url": null
} |
ros, transforms, tf-tutorial, tf2
float teta=atan2(transform1.getOrigin().y()-transform2.getOrigin().y(), transform1.getOrigin().x()-transform2.getOrigin().x()) -tf::getYaw(transform2.getRotation());
//to keep teta between -180 and 180
while (teta<-3.14159)
{teta+=2*3.14159;}
while (teta>3.14159)
{teta-=2*3.14159;}
vel_msg.angular.z = 4.0 * (teta);
vel_msg.linear.x = 0.5 * sqrt(pow(transform1.getOrigin().x()-transform2.getOrigin().x(), 2) +
pow(transform1.getOrigin().y()-transform2.getOrigin().y(), 2));
turtle_vel.publish(vel_msg);
IMPORTANT THINGS I need to be careful with when working in ground frame:
atan (y1-y2/ x1-x2) only gives alfa. The angular velocity should be proportional to alfa-beta, not just alfa.
That's why I need to reduce with beta: tf::getYaw(transform2.getRotation())
I need to make sure that the teta is between -180 degree to 180 degree! Here's why:
Consider a case: | {
"domain": "robotics.stackexchange",
"id": 25612,
"lm_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, transforms, tf-tutorial, tf2",
"url": null
} |
python, beginner, pygame, adventure-game
elif x==1 and y==2:
sound.load("/home/leo/Documents/Python/Sounds/walking.mp3")
sound.play()
time.sleep(2)
sound.stop()
print(r2)
sound.load("/home/leo/Documents/Python/Sounds/ambient.mp3")
sound.play()
stutter(room2)
if intestines == False:
stutter("""\nIt's strange, rope-like intestines lay on another table
bordering the room.""")
take_intestines = input("\nTake the intestines?(y or n):\n")
if take_intestines == "y" or take_intestines == "Y":
if gloves == True:
stutter("Using the gloves, you pick up the intestines.\n")
stutter("Intestines equipped.")
sound.load("/home/leo/Documents/Python/Sounds/ding.mp3")
sound.play()
time.sleep(2)
intestines = True
sound.load("/home/leo/Documents/Python/Sounds/ambient.mp3") | {
"domain": "codereview.stackexchange",
"id": 32927,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, beginner, pygame, adventure-game",
"url": null
} |
deep-learning, time-series, lstm, forecasting, arima
Title: Why so discrepancy between ARIMA and LSTM in time series forecasting? I have this time series below, that I divided into train, val and test:
Basically, I trained an ARIMA and an LSTM on those data, and results are completely different, in terms of prediction:
ARIMA:
LSTM:
Now, maybe I am passing, in some way, the test set to LSTM in order to perform better? Or LSTM is simply (lot) better than ARIMA?
Below there is some code. Note that in order to do prediction in future days, I am adding the new and last predicted value to my series, before training and predicting:
ARIMA code:
# Create list of x train valuess
history = [x for x in x_train]
# establish list for predictions
model_predictions = []
# Count number of test data points
N_test_observations = len(x_test) | {
"domain": "datascience.stackexchange",
"id": 11226,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "deep-learning, time-series, lstm, forecasting, arima",
"url": null
} |
water, molecules
The "fifth water" thing is curious because it is common belief that waters arrange themselves in a tetrahedral arrangement. This is known to be true for ice, but is in question for liquid water. For instance, this article about the liquid water hydrogen-bonding network indicates that water, as it is heated, begins participating in only two hydrogen bonds rather than four.
Now, to answer the question of what makes liquid water be liquid water (when it is indeed liquid water). I think from the outset, it should be clear that this is a very difficult question to answer and any answer will likely be debated. I say that because you must define how many molecules it takes to make a liquid which is a very difficult thing to do. | {
"domain": "chemistry.stackexchange",
"id": 4072,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "water, molecules",
"url": null
} |
heat-transfer
Title: Mounting heat source onto heat pipes I want to mount a heat source onto several heat pipes. The heat will be forwarded to coolers (four heat pipes, 200 mm) which are able to distribute up to 120 W without increasing the temperature of the device which should be cooled. The device itself will generate up to 100 W heat. Now I was wondering what would happen to the mounting point: Will the mounting point resp. the clamp used for fixing the heat source on the heat pipes also heat up? If yes, how much? Well, how much the clamp heats up is determined by a great number of factors, chiefly (off the top of my head):
The properties of the pipe (material properties: density, material
type, size of contact area etc)
How the clamp interfaces with the pipe (e.g. metal on metal, thermal
interface material between clamp and pipe, an insulator between clamp
and pipe).
The properties of the clamp (material properties, initial temperature etc) | {
"domain": "engineering.stackexchange",
"id": 414,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "heat-transfer",
"url": null
} |
algorithms, random-number-generator
If you really want a truly random number sequence, the input would have to be truly random (variation in the path of Brownian motion, weather patterns, radioactive decay, etc).
You can start by looking at how a Linear congruential generator works. It's pretty easy to notice why numbers would repeat after a point. | {
"domain": "cs.stackexchange",
"id": 19427,
"lm_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, random-number-generator",
"url": null
} |
Consider the set $$E_{\Delta} = E_1 \triangle E_2$$
Let $$e = (u, v)$$ be the edge in $$E_{\Delta}$$ having the least cost (or weight)
Note that since all costs are unique, and $$E_{\Delta}$$ is non-empty, $$e$$ must be unique.
Without loss of generality, assume $$e \in E_1$$
Now, there must be a path $$P$$, with $$e \notin P$$, in $$T_2$$ connecting $$u$$ and $$v$$, since trees are by definition, connected.
Note that at least one edge (say $$e'$$) that occurs in $$P$$ must not be in $$E_1$$, thus, $$e' \in E_{\Delta}$$
This is because, if $$P \subset E_1$$, $$T_1$$ will contain a cycle formed by the path $$P$$ and the edge $$e$$, this leads to a contradiction, since trees by definition are acyclic.
Note that by definition of $$e$$ and the fact that all costs are distinct, $$\text{cost}(e) < \text{cost}(e')$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9759464485047916,
"lm_q1q2_score": 0.8563703434437397,
"lm_q2_score": 0.8774767762675405,
"openwebmath_perplexity": 125.79959717816376,
"openwebmath_score": 0.8433116674423218,
"tags": null,
"url": "https://math.stackexchange.com/questions/352163/show-that-theres-a-unique-minimum-spanning-tree-if-all-edges-have-different-cos/352212"
} |
beginner, php5, mysqli
Having global variables $theQuestions and $theAnswers defined via inclusion of someFunctionsAndStuff.php is surprising. Instead, the included file should define a function that returns those data. | {
"domain": "codereview.stackexchange",
"id": 6390,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "beginner, php5, mysqli",
"url": null
} |
java, game, ai, libgdx
protected boolean hasAffordableSpells(Collection<SpellType> availableSpells) {
return availableSpells.stream().anyMatch( s -> hasEnergyForSpell(s) );
}
The final part can be simplified as well:
public void tryToCastOffensiveSpell() {
List<SpellType> affordableSpells = aggresiveSpells.stream()
.filter( s -> hasEnergyForSpell(s) )
.collect( Collectors.toList() );
if (!affordableSpells.isEmpty()) { tryToCastSpell(affordableSpells); }
}
Good luck with casting spells :) | {
"domain": "codereview.stackexchange",
"id": 24446,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, game, ai, libgdx",
"url": null
} |
electromagnetism, electric-circuits, electrical-resistance, inductance
Any help is greatly appreciated. When dealing with inductors Sears & Zemansky state that "we need to develop a general principle analogous to Kirchhoff's loop rule".
With an inductor present in the circuit they state that there is a non-conservative electric field within the coils $\vec E_n$ as well a conservative electric field $\vec E_c$.
Assuming that the inductor has negligible resistance they then state that the net electric field within the inductor is zero ie $\vec E_c + \vec E_n =0$.
If the end of the inductor are labelled $a$ and $b$ they then state that instead of writing $\oint \vec E_n \cdot d \vec l = - L \frac {dI}{dt} $ for the complete circuit they can just consider that path within the coil as that is where the magnetic flux is changing which then gives $\int_b^a \vec E_n \cdot d \vec l = - L \frac {dI}{dt} $.
So $\int_b^a \vec E_c \cdot d \vec l = + L \frac {dI}{dt} = V_{ab}$ which is the potential of point $a$ relative to point $b$. | {
"domain": "physics.stackexchange",
"id": 31877,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electromagnetism, electric-circuits, electrical-resistance, inductance",
"url": null
} |
c++, statistics, machine-learning
// constructor for start training new model
simple_linear_regression::simple_linear_regression(std::vector<double> X, std::vector<double> y, bool verbose)
{
this->X = X;
this->y = y;
this->verbose = verbose;
}
// method to train our model, where all methods merges.
void simple_linear_regression::train()
{
print("Training");
this->calculate_N();
this->x_square();
this->x_cross_y();
this->calculate_sigma();
this->calculate_slope();
this->calculate_bias();
print("Model has been trained :)");
}
// Method used for predicting future values
double simple_linear_regression::predict(double _X)
{
return (this->m * _X) + this->b;
} | {
"domain": "codereview.stackexchange",
"id": 35721,
"lm_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++, statistics, machine-learning",
"url": null
} |
thermodynamics, radiation, thermal-radiation
$$E= \epsilon \sigma T^4$$
Which means that if you can measure the radiated power $E$, the temperature is
$$T=\sqrt[4]{\frac{E}{\epsilon \sigma}}$$
If the emissivity is lower than you think, it follows that you see less emission that you would expect for a given temperature and you would underestimate the temperature. | {
"domain": "physics.stackexchange",
"id": 21484,
"lm_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, radiation, thermal-radiation",
"url": null
} |
beginner, file, go, logging
For every message you read from the channel, you're currently comparing the file name to a on-the-spot generated name. Wouldn't it be so much easier to move the occasional checking of the file to a routine instead? Just have it generate a new name every Nms, compare and if needed, acquire a lock on the os.File pointer, rotate the log file, and release? Whilst doing that, you'd only need to lock and release the a mutex every time you actually write a message to the log, instead of comparing file names. This has the added benefit that, owing to using a mutex, resolves to a large extent the concurrency problems mentioned earlier. | {
"domain": "codereview.stackexchange",
"id": 25127,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "beginner, file, go, logging",
"url": null
} |
solutions, electrons, metal, optical-properties, solvated-electrons
This gives a great picture of what a solvated electron could look like. The point is that it can look like a lot of things. If you wish, you can think of these isosurfaces as being an "orbital" that the excess electron is free to move around in. The difference is that we draw orbitals as 90% probability densities, only these are drawn at a constant volume, and hence don't all contain the same "percentage of the electron". In fact many of these surfaces contain less than 50% of the charge density, which demonstrates these electrons are very diffuse! | {
"domain": "chemistry.stackexchange",
"id": 8602,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "solutions, electrons, metal, optical-properties, solvated-electrons",
"url": null
} |
thermodynamics, black-holes, entropy, information
AB: I really enjoyed reading your comment and thank you for sharing your ideas. However, I believe the most relevant physics to the question is the one which concerns astrophysical black holes in classical general relativity. Why not quantum? It has not been established yet. Why astrophysical? Because the are the only type of black hole which are known to form in the universe under known physics. I will go through a couple of points where I cannot agree with you in the comments that follow.
... 1) Astrophysical black holes are formed by a gravitational collapse. They don't contain any wormholes and their formation doesn't change the topology of space-time. If an unlucky observer happens to find himself inside the event horizon of such a black hole, he cannot escape it in any way other then just by crossing backwards the horizon, which is impossible for stationary black holes. | {
"domain": "physics.stackexchange",
"id": 2665,
"lm_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, black-holes, entropy, information",
"url": null
} |
python, python-3.x, algorithm, computational-geometry
horizontal_segment_index = horizontal_segments[horizontal_counter][1]
(start, end) = find_segments_in_range(vertical_segments,\
horizontal_segment.get_non_constant_start_coordinate(),\
horizontal_segment.get_non_constant_end_coordinate())
for vertical_counter in range(start, end + 1):
vertical_segment = vertical_segments[vertical_counter][0]
vertical_segment_index = vertical_segments[vertical_counter][1]
# Avoid adjacent segments. They will always have one endpoint in common
if abs(horizontal_segment_index - vertical_segment_index) <= 1:
continue
if horizontal_segment.does_intersect(vertical_segment):
return True
return False | {
"domain": "codereview.stackexchange",
"id": 42017,
"lm_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, algorithm, computational-geometry",
"url": null
} |
organic-chemistry, experimental-chemistry, purification
Title: Water vapor permeation to the reaction flask I am conducting a synthesis involving Buchwald-Hartwig coupling. The scale is $\approx10^{-4}$ mols of reagents. After running the reaction at 80 ℃ during 24 hours I found that sealing between the 3-neck reaction flask and the reflux condensor became loose, and the reaction flask is somewhat filled up relatively to the start of the reaction (5 mL toluene as solvent) although I did not add additional solvent during the reaction. As I add some toluene, the layer separation was observed and the toluene layer went to the upper layer. Initially I thought that this might be tert-butanol because it is the by-product of the reaction cycle. But I initially added only 0.0426 g of NaOtBu, so formed tBuOH would be very small amounts. In light of the fact that the sealing became loose, is there possibility that water vapor in the air went through the flask and condensed by the reflux condensor, and dropped to the flask? Is there any method to | {
"domain": "chemistry.stackexchange",
"id": 16440,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "organic-chemistry, experimental-chemistry, purification",
"url": null
} |
python, game, python-2.x, hangman
def play(word):
word = word.lower()
guessed = set()
unguessed = {l for l in word.upper() if l.isalpha()}
guesses_left = GUESSES
if DEBUG:
print "[DEBUG] word is", repr(word)
while True:
alert_turn(word, guesses_left, guessed, unguessed)
guess = get_guess(guessed)
guessed.add(guess)
if guess in unguessed:
alert_correct()
unguessed.remove(guess)
if not unguessed:
alert_won(word, guesses_left)
return True
else:
alert_incorrect()
guesses_left -= 1
if not guesses_left:
alert_lost(word)
return False
if __name__ == "__main__":
words = loadWords()
random.shuffle(words)
while True:
# Remove a random word so it's not chosen again
play(words.pop())
if not prompt("Would you like to play again?"):
break | {
"domain": "codereview.stackexchange",
"id": 11320,
"lm_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, game, python-2.x, hangman",
"url": null
} |
homework-and-exercises, rotational-dynamics, rotation, inertia, moment-of-inertia
Experimental setup
In your experimental a string is on one end connected to the hanging mass, lead over the pulley and then wounded around a drum (the other end is also connected to the drum). This drum is of the object from which you would like to determine its moment of inertia and it is assumed that it can rotate freely (without slip) around its axis.
According to your documentation you measure how far the pulley has rotated, I will call this angle $\theta$, and its first and second time derivative $\omega=\dot{\theta}$ and $\alpha=\ddot{\theta}$.
The displacement of the hanging mass is related to the angular displacement of the pulley and its radius, $r_p$, assuming that the string does not slip, so
$$
s=r_p\theta
$$
where $s$ is the vertical downward displacement of the hanging mass. | {
"domain": "physics.stackexchange",
"id": 11183,
"lm_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, rotational-dynamics, rotation, inertia, moment-of-inertia",
"url": null
} |
c#, strings, html, escaping
// get the full html length
int length = html.Length;
// set a limit on the tag string to compare to reduce the
// string size (i.e. the longest tags are <center> and <strong>)
int tagLength = 6;
// gather all the included html tags to check
string s = "div|span|p|br|ol|ul|li|center|font|strong|em|sub|sup";
string[] tags = s.Split( '|' ).ToArray( );
// find all the indices of the less than entity or tag
var indices = AllIndexesOf( html, "<" );
// initiate a list of indices to be replaced
var replaceable = new List<int>( ); | {
"domain": "codereview.stackexchange",
"id": 40930,
"lm_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, html, escaping",
"url": null
} |
an angle 2π, the point represented by polar coordinates (r, θ) is also represented by (r, θ+ 2nπ) and (-r, θ+ (2n + 1)π) where n is any integer. For any point P consider the two distances:. 3 WS Polar Coordinates (Answers). The area of a region in polar coordinates defined by the equation $$r=f(θ)$$ with $$α≤θ≤β$$ is given by the integral $$A=\dfrac{1}{2}\int ^β_α[f(θ)]^2dθ$$. Polar coordinates use a distance and an angle to locate a point. You can see this by just drawing unit vectors at each point on, say, a circle: (draw). 2 : Apr 12, 2018, 11:37 AM. Polar coordinates describe the distance from P to to a special point O, called the pole or origin and the angle that the line segment PO makes with a special ray called the polar axis. Sign up to join this community. When you drag the red point, you change the polar coordinates $(r,\theta)$, and the blue point moves to the corresponding position $(x,y)$ in Cartesian coordinates. 1 Exponential Equations Blank. In case n = 3, the polar | {
"domain": "gesuitialquirinale.it",
"id": null,
"lm_label": "1. Yes\n2. Yes",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9843363485313248,
"lm_q1q2_score": 0.8807737999101936,
"lm_q2_score": 0.8947894703109853,
"openwebmath_perplexity": 584.2148996203689,
"openwebmath_score": 0.9085190296173096,
"tags": null,
"url": "http://gesuitialquirinale.it/rdil/polar-coordinates-pdf.html"
} |
quantum-chemistry, software
I've never done TDDFT in GAMESS because I use other programs, but given a link to the docs, it's easy enough to enable more drop-down menus.
That said, you can interactively edit the text in the Avogadro input for any quantum program (not just GAMESS). | {
"domain": "chemistry.stackexchange",
"id": 2168,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-chemistry, software",
"url": null
} |
biodiversity, landscape-ecology
# Calculate sum of the area
# calculate distinct number of species, vary if the distinct area calculates by sum or by total??
d %>%
mutate(species_n = n_distinct(species)) %>% # !! should 'mutate' by placed before the grouping variable or after?
mutate(species_sum = sum(area)) %>%
group_by(site) %>%
#mutate(species_n = n_distinct(species)) %>%
#mutate(species_sum = sum(area)) %>%
mutate(spec_pi = area/species_sum) %>%
mutate(pi_ln = abs(log(spec_pi))) %>%
mutate(sp_shannon = spec_pi*pi_ln ) %>%
mutate(shannon_comun = sum(sp_shannon))
I am trying to dig into Shannon's species diversity index to compare the species diversity between different sites
Shannon's diversity index is a measure of alpha diversity, or diversity within a community. If you are considering each site a different community (which is sounds like you are), then you would calculate Shannon diversity for each site separately, without consideration of the other sites. | {
"domain": "biology.stackexchange",
"id": 10935,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "biodiversity, landscape-ecology",
"url": null
} |
# Why isn't the equal sign part of the set theory language?
Many books define the language of set theory only based on $$\in$$. What about the binary relation '$$=$$'? Why is it not mentioned as a symbol of the language? Yes, it is part of first-order logic, but to me its meaning seems to depend on the interpretation which in turn depends on axioms (like extensionality) that must be satisfied. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9585377249197138,
"lm_q1q2_score": 0.827593432908374,
"lm_q2_score": 0.8633916134888613,
"openwebmath_perplexity": 277.50088278332606,
"openwebmath_score": 0.9025186896324158,
"tags": null,
"url": "https://math.stackexchange.com/questions/4223017/why-isnt-the-equal-sign-part-of-the-set-theory-language"
} |
python, python-3.x, time-limit-exceeded, numpy, simulation
to this
mew_complement = 1 - mew
# ... lot of code here
def update_probablities(self):
for i in range(9):
self.propensities[i] *= mew_complement
pensity_sum = sum(self.propensities)
for i in range(9):
self.probabilites[i] = self.propensities[i] / pensity_sum
As you can see, I aggressively removed function calls to improve the performance even further. IMHO the code is still quite readable though. Since I was at it, I also decided to give create_random_propensities and initialize a makeover:
def create_random_propensities(self):
pre_propensities = [random.uniform(0, 1) for i in range(9)]
pensity_sum = sum(pre_propensities) / 10
return [pre / pensity_sum for pre in pre_propensities]
def initialize(self):
init_sum = sum(self.propensities)
self.probabilites = [prop / init_sum for prop in self.propensities]
self.update_strategy() | {
"domain": "codereview.stackexchange",
"id": 35045,
"lm_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, time-limit-exceeded, numpy, simulation",
"url": null
} |
The question actually has little to do with probability theory, the observation holds for any square matrix regardless of it's origin.
It's easy to prove by considering the eigenvalues of the matrix. If and only if all of them are non-zero is the matrix invertible. It follows from the characteristic equation $\det (A-\lambda I)=0$, if $\lambda = 0$ is a solution then and only then $\det(A-0I) = \det(A) = 0$.
Positive definite means that all eigenvalues are positive, but positive semi-definite means only that they are non-negative.
This are some thoughts. Let $x$ be a random vector whose entries are i.i.d. Let $A$ be any square matrix which is not full rank. Then the covariance matrix of the random vector $y=Ax$ is not invertible. To see this, note that $E[Axx^TA]=AE[xx^T]A^T$. Thus, regardless of the rank of $E[xx^T]$, covariance matrix of $y$ will not be invertible. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9850429169195593,
"lm_q1q2_score": 0.8814060305549565,
"lm_q2_score": 0.8947894710123925,
"openwebmath_perplexity": 99.61419093271385,
"openwebmath_score": 0.9590762257575989,
"tags": null,
"url": "https://math.stackexchange.com/questions/1479483/when-does-the-inverse-of-a-covariance-matrix-exist"
} |
Semendyayev 1977, p. Trapezium rule. Find more Mathematics widgets in Wolfram|Alpha. - James Waldby - jwpat7 Apr 23 '12 at 5:26. 2 The trapezoidal rule The trapezoidal rule, in its most basic form, connects the endpoints (0; f(0)) and (p; f(p)) by a straight line and approximates the area by the area of a trapezoid: I ˇp f(0)+ f(p) 2; as shown in figure. Trapezoidal Rule of Integration. Numerical Integration Using Trapezoidal Method Pseudocode. The integral is. Consider the area of the following trapezium. 's technical difficulties ♦ May 16 '12 at 15:53. 6--Trapezoidal Rule 3) Use the trapezoidal Rule to estimate the area of this logo: 0 2 13 15 16 17 12 9 14 11 7 3 cm apart (All measurements are in centimeters. The Trapezoid Rule: For the function in the above figure with three trapezoids, here’s the math: Even though the formal definition of the definite integral is based on the sum of an infinite number of rectangles, you might want to think of integration as the limit of the | {
"domain": "danieledivittorio.it",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9828232914907945,
"lm_q1q2_score": 0.8035312333629373,
"lm_q2_score": 0.817574471748733,
"openwebmath_perplexity": 660.4936385685219,
"openwebmath_score": 0.8180414438247681,
"tags": null,
"url": "http://danieledivittorio.it/jobz/trapezium-rule.html"
} |
particle-physics, symmetry, standard-model, group-theory, representation-theory
\begin{equation}
\Lambda _{ QCD} \approx 200 \mbox{MeV}
\end{equation}
while the charm mass is $ \approx 1000 \mbox{MeV} $ and the strange mass is $ 100 \mbox{MeV} $. Thus hadrons masses can be approximately described the massless Lagrangian above. Since the Lagrangian has an additional symmetry, the particles must form multiplets of the symmetry. While we can't calculate their masses directly, they should approximately exhibit such a symmetry in their masses. This is why we expect the hadron masses to be arranged into flavor multiplets. | {
"domain": "physics.stackexchange",
"id": 14899,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "particle-physics, symmetry, standard-model, group-theory, representation-theory",
"url": null
} |
ros, navigation, turtlebot, ros-hydro, move-base
Originally posted by sterlingm with karma: 380 on 2018-05-17
This answer was ACCEPTED on the original site
Post score: 1
Original comments
Comment by archit0994 on 2019-05-05:
Hey, I am facing similar issue. The robot_base_frame in both local_costmap_params.yaml and global_costmap_params.yaml is set to /base of the robot. I still face the issue( the robot is always at the initial position (0.0 , 0.0). I do not have the odometry so I set global_frame to /map. Can you tell me what am I doing wrong? Also is it possible for you to share your param files? Thank you. | {
"domain": "robotics.stackexchange",
"id": 30848,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, navigation, turtlebot, ros-hydro, move-base",
"url": null
} |
\begin{proof} {\bf (Alternate Proof of Theorem SSLD)} We want to prove that any set of $t+1$ or more vectors from $V$ is linearly dependent. So we will begin with a totally arbitrary set of vectors from $V$, $R=\setparts{\vect{u}_j}{1\leq j\leq m}$, where $m>t$. We will now construct a nontrivial relation of linear dependence on $R$.
Each vector $\vect{u_j}$, $1\leq j\leq m$ can be written as a linear combination of $\vect{v}_i$, $1\leq i\leq t$ since $S$ is a spanning set of $V$. This means there are scalars $a_{ij}$, $1\leq i\leq t$, $1\leq j\leq m$, so that
\begin{align*} \vect{u}_j&=\sum_{i=1}^{t}a_{ij}\vect{v_i}&&1\leq j\leq m \end{align*}
Now we form, unmotivated, the homogeneous system of $t$ equations in the $m$ variables, $x_j$, $1\leq j\leq m$, where the coefficients are the just-discovered scalars $a_{ij}$,
\begin{align*} \sum_{j=1}^{m}a_{ij}x_j=0&&1\leq i\leq t \end{align*} | {
"domain": "aimath.org",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9879462197739625,
"lm_q1q2_score": 0.8565847046997394,
"lm_q2_score": 0.867035763237924,
"openwebmath_perplexity": 325.4569079225906,
"openwebmath_score": 0.9146049618721008,
"tags": null,
"url": "http://www.aimath.org/textbooks/beezer/Dsection.html"
} |
quantum-mechanics, energy, energy-conservation, quantum-interpretations
(Local) Conservation of Energy in Quantum Mechanics
Does conservation of energy hold in quantum mechanics?
Energy conservation and quantum measurement First point: the authors tend to take a very "stringent" view of "worlds" in the many worlds interpretation. I take issue with this. I think "many worlds" is a misnomer. Better names for the Everettian interpretation would be "strict unitary evolution", "universal wavefunction" or, my favorite, "church of the large Hilbert space". For the "many worlds" are "soft" boundaries rather than "hard" boundaries. This is especially because a "splitting" of worlds can always, in principle be undone by the reverse of the unitary that split them. | {
"domain": "physics.stackexchange",
"id": 80548,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, energy, energy-conservation, quantum-interpretations",
"url": null
} |
javascript
Title: Changing a menu tab's color on click I've got a tab menu and functions that change the tab's color on click, giving the clicked tab a different color from the others. The thing is, when I click one, I give it another background-color easily but I'm also setting all the other tabs background-color.
In my largest menu there are 6 tabs:
document.getElementById('tab1').onclick = changeColor1;
document.getElementById('tab2').onclick = changeColor2;
document.getElementById('tab3').onclick = changeColor3;
document.getElementById('tab4').onclick = changeColor4;
document.getElementById('tab5').onclick = changeColor5;
document.getElementById('tab6').onclick = changeColor6; | {
"domain": "codereview.stackexchange",
"id": 8176,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript",
"url": null
} |
# Find the solutions to $z^3 = 2 + 11i$.
Find the solutions to $z^3 = 2 + 11i$.
I wrote $z = x + iy$ to get $(x + iy)^3 = 2+ 11i$.
Expanding and equating the real and Imaginary parts I got,
$$x^3 - 3xy^2 = 2$$ $$y^3 - 3x^2y = 11$$
Let $tx = y$, Substituting this I got,
$$x^3 - 3t^2x^3 = 2$$ $$x^3(3t-t^3) = 11$$
Susbtituting for $x^3$ from first equation into second eaution I got,
$$2t^3 + -6t - 33t^2 + 11 = 0$$
I don't know how to solve this cubic, I tried finding roots by putting different numbers but I can't find any of them.
What are some other ways of solving without running into a cubic and how can I solve this cubic ?
your number has norm 125. The answer has norm 5. If they intended integers, that means either $\pm1 \pm 2 i$ or $\pm 2 \pm i.$ Try them.
As 11 is odd, we need $y = \pm 1,$ so $\pm 2 \pm i.$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9683812290812827,
"lm_q1q2_score": 0.8111354476330447,
"lm_q2_score": 0.837619961306541,
"openwebmath_perplexity": 762.697902939529,
"openwebmath_score": 0.7828471064567566,
"tags": null,
"url": "https://math.stackexchange.com/questions/2144897/find-the-solutions-to-z3-2-11i"
} |
general-relativity, spacetime, time, metric-tensor, distance
But observers should also be able to measure length, right?
Well, surely it should be possible to attribute arc length also to curves which are (throughout) space-like. At least formally, that's straightforward, too (using the same sign convention as above):
$$L[~\gamma~] := \int_0^1~dt~\sqrt{-g[~\dot\gamma, \dot\gamma~]},$$
where here the curve $\gamma$ is understood and required to be space-like;
and, as above, the magnitudes of applicable tangent vectors are given only through a corresponding definitive equation shown below.
the first equations is the one defining [...]
The two equations shown above certainly don't provide self-standing definitions since they depend on suitable assignments for the magnitudes of tangent vectors; perhaps related to a particular ("good", "affine", "locally orthonormal") assignments of coordinates.
Definitive are rather expressions of arc lengths (of space-like curves or of time-like curves, respectively) in terms of given | {
"domain": "physics.stackexchange",
"id": 29752,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "general-relativity, spacetime, time, metric-tensor, distance",
"url": null
} |
c++, object-oriented, design-patterns
If it has private members, it should be a class
The Quiz struct really deserves to be a class, I think. Otherwise we could alter questions and answers and options at will, which seems a bit suspect to me. Also, see C.8
Rethink your class structure | {
"domain": "codereview.stackexchange",
"id": 39903,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, object-oriented, design-patterns",
"url": null
} |
genetics, medicine
Variations on this have happened to reduce or eliminate pathogens (such as polio and smallpox because of the vaccine) and their effect on mankind, but those have little to do with selection for human traits that would cause genetic shift. | {
"domain": "biology.stackexchange",
"id": 2232,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "genetics, medicine",
"url": null
} |
data-cleaning
I don't understand when making predictions means. does it mean when I do forward prop i should reverse the log transform? or does it mean when making predictions on dev and test set?
And, should i also apply log transform to dev and test set?
Also, if i were to deploy this model, does it mean that I always need to log transform features that i apply log transform while training? You don’t have to back-transform your features. Just apply the transformations to your features and make your predictions. For instance, if you $\log$ your features during training, so the same in production.
Back-transforming your predictions means that, if you predict the expected value of the $\log$, you need to wrestle with your model to tease out the expected value. However, this only applies when you transform $y$, which you do not. | {
"domain": "datascience.stackexchange",
"id": 11302,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "data-cleaning",
"url": null
} |
java, object-oriented, unit-testing, ascii-art
}
output testcase
┌──────────┬─────┬──────┬──────────────┐
│first name│ x │ y │ family │
├──────────┼─────┼──────┼──────────────┤
│ │ 1.0 │ 2.0 │ │
├──────────┼─────┼──────┼──────────────┤
│ │ 1.2 │ 2.3 │ │
├──────────┼─────┼──────┼──────────────┤
│ peter │ │ │ parker │
├──────────┼─────┼──────┼──────────────┤
│ bruce │ │ │waytoolongname│
├──────────┼─────┼──────┼──────────────┤
│ alfred │-2.44│3.1415│ │
└──────────┴─────┴──────┴──────────────┙
my challenges so far: | {
"domain": "codereview.stackexchange",
"id": 45534,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "java, object-oriented, unit-testing, ascii-art",
"url": null
} |
game, objective-c, ai
Having BOOL returns where the logic works out like this is quite common. You use it more than once. I've ended up with structures like this myself before as well.
However, I find a different pattern to be slightly more pleasing.
BOOL needMoreDwarves = (youngEnoughDwarves.count < kMinimumDwarves);
BOOL canBirthMoreDwarves = ([self floorsWithRunningRoomUpgradesOfType:RoomTypeBirther].count > 0);
return needMoreDwarves && canBirthMoreDwarves;
-(BOOL) needMoreFood:(int)currentFood;
-(BOOL) needMoreCommonResources:(int)commonResources;
These two methods are curious. They're not exposed publicly, so they're only used privately. The only argument they seem to take is a property of this class... a variable the method can already know about without it being passed. Why are we passing a variable? Just make the methods take no arguments and access the appropriate variable within the method. | {
"domain": "codereview.stackexchange",
"id": 8801,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "game, objective-c, ai",
"url": null
} |
graphs
Update | {
"domain": "cs.stackexchange",
"id": 11177,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "graphs",
"url": null
} |
We row reduce the above matrix
$\begin{bmatrix} 1 & 0 & -1 & 1 & -1 & | & 0\\ 0 & 1 & -1 & \dfrac{3}{2} & -\dfrac{5}{2} & | & 0 \\ 0 & 0 & 0 & 0 & 0 & | & 0 \end{bmatrix}$
Solve the system corresponding to the augmented matrix
The free variables are: $x_3, \;x_4, \;x_5$, hence
The second row gives: $x_2 = x_3 - \dfrac{3}{2} x_4 + \dfrac{5}{2} x_5$
The first row gives: $x_1 = x_3 - x_4 + x_5$
The solution vector $\mathbf x$ is given by
$\mathbf x = \begin{bmatrix} x_3 - x_4 + x_5 \\ x_3 - \dfrac{3}{2} x_4 + \dfrac{5}{2} x_5 \\ x_3 \\ x_4 \\ x_5 \end{bmatrix}$
which may be written as
$\mathbf x = x_3 \begin{bmatrix} 1\\ 1\\ 1\\ 0 \\ 0 \end{bmatrix} + x_4 \begin{bmatrix} - 1\\ - \dfrac{3}{2}\\ 0 \\ 1\\ 0 \end{bmatrix} + x_5 \begin{bmatrix} 1\\ \dfrac{5}{2} \\ 0 \\ 0 \\ 1 \end{bmatrix}$ | {
"domain": "analyzemath.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9956005857929761,
"lm_q1q2_score": 0.8116459484256464,
"lm_q2_score": 0.8152324938410784,
"openwebmath_perplexity": 240.6717309014054,
"openwebmath_score": 0.8552239537239075,
"tags": null,
"url": "https://www.analyzemath.com/linear-algebra/matrices/null-space.html"
} |
# Difference between revisions of "2001 AMC 8 Problems/Problem 23"
## Problem
Points $R$, $S$ and $T$ are vertices of an equilateral triangle, and points $X$, $Y$ and $Z$ are midpoints of its sides. How many noncongruent triangles can be drawn using any three of these six points as vertices?
$[asy] pair SS,R,T,X,Y,Z; SS = (2,2*sqrt(3)); R = (0,0); T = (4,0); X = (2,0); Y = (1,sqrt(3)); Z = (3,sqrt(3)); dot(SS); dot(R); dot(T); dot(X); dot(Y); dot(Z); label("S",SS,N); label("R",R,SW); label("T",T,SE); label("X",X,S); label("Y",Y,NW); label("Z",Z,NE); [/asy]$
$\text{(A)}\ 1 \qquad \text{(B)}\ 2 \qquad \text{(C)}\ 3 \qquad \text{(D)}\ 4 \qquad \text{(E)}\ 20$
## Solution #1
There are $6$ points in the figure, and $3$ of them are needed to form a triangle, so there are ${6\choose{3}} =20$ possible triples of $3$ of the $6$ points. However, some of these created congruent triangles, and some don't even make triangles at all. | {
"domain": "artofproblemsolving.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9869795102691454,
"lm_q1q2_score": 0.8159476079664084,
"lm_q2_score": 0.8267118004748677,
"openwebmath_perplexity": 205.56986898396153,
"openwebmath_score": 0.5922476649284363,
"tags": null,
"url": "https://artofproblemsolving.com/wiki/index.php?title=2001_AMC_8_Problems/Problem_23&diff=prev&oldid=122040"
} |
dna, molecular-genetics
Figure 3 | {
"domain": "biology.stackexchange",
"id": 9740,
"lm_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, molecular-genetics",
"url": null
} |
sound, analog-to-digital, fundamental-frequency
So to begin with, if my understanding above is incorrect or misled, please begin by correcting me! Assuming my understanding is more or less correct however...
In this video of a digital oscilloscope in use you can see (around 0:40 seconds in) that when the author speaks, only a single wave is produced. Whereas, given my understanding of "sound" as being the timbre, I expected to see multiple waves displayed on the screen (one for the fundamental and any others for the respective harmonic waves).
My question: is this oscilloscope displaying the author's "timbre" wave (some type of aggregating or composition of his voice's fundamental plus any accompanying harmonic waves)? Or is it somehow filtering out the harmonics and only showing his fundamental wave? Or is my understanding of sound waves inherently flawed? Sorry, your understanding is mostly wrong. | {
"domain": "dsp.stackexchange",
"id": 9662,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "sound, analog-to-digital, fundamental-frequency",
"url": null
} |
python, python-3.x, heap
leafData = currentNode.data
lst = []
lst.append(self.head)
while lst:
currentNode = lst.pop(0)
if currentNode.left is not None:
if currentNode.left.data == leafData:
currentNode.left = None
break
else:
lst.append(currentNode.left)
if currentNode.right is not None:
if currentNode.right.data == leafData:
currentNode.right = None
break
else:
lst.append(currentNode.right)
self.head.data = leafData
self.heapifyTopDown(self.head)
return data
def peek(self):
if self.head is None:
return 'self.head is None'
return self.head.data
avl = HeapBT() | {
"domain": "codereview.stackexchange",
"id": 36286,
"lm_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, heap",
"url": null
} |
python, performance, number-guessing-game
@staticmethod
def check_groups(groups, group_mask, maxels, mysol):
for idx, group in enumerate(groups):
if group_mask[idx]==1:
continue
count=sum(1 for q in group if mysol[q]==CELL_OCCUPIED)
unkn=sum(1 for q in group if mysol[q]==CELL_UNKNOWN)
if (count+unkn)<maxels:
return False
if (count==maxels) and (unkn==0):
group_mask[idx]=1
return True
@staticmethod
def check_surround_and_cover_cells(surrounding, solu):
for q in surrounding:
if solu[q]==CELL_OCCUPIED:
return False
if solu[q]==CELL_UNKNOWN:
solu[q]=CELL_EMPTY
return True | {
"domain": "codereview.stackexchange",
"id": 16411,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python, performance, number-guessing-game",
"url": null
} |
python
},
{
"start_date": "Jun-05",
"end_date": "Sep-07",
"company": "Official Company Name",
"job_title": "Job title",
"responsibilities": [
"Make sure your work experience comes to life, consider what someone reading your CV would be most interested in",
"Avoid any negativity or shortcomings on your CV that may raise the wrong questions",
"Try to avoid having your CV read like a job description"
],
"location": "City, Country",
"confidence": 0.8
},
{
"start_date": "Mar-04",
"end_date": "Jun-05",
"company": "Official Company Name",
"job_title": "Job title",
"responsibilities": [
"Try to ensure your CV is easy to scan, start bullet points with relevant action verbs",
"You can also include significant relevant voluntary experience in your work experience if it is applicable", | {
"domain": "codereview.stackexchange",
"id": 45306,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python",
"url": null
} |
python, python-3.x
could be written as
if value in self.value_map[option].keys():
return self.value_map[option][value]
if not num:
raise InvalidValueError
try:
float_val = float(value)
_check_range(float_val, self.numericals[option][0], self.numericals[option][1])
return float_val
except ValueError:
raise InvalidValueError
Why does _get_config_value check for an option in every section and return the first one? That seems to make sections pointless, because they don't matter. | {
"domain": "codereview.stackexchange",
"id": 35217,
"lm_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
} |
gazebo-1.8, sdformat
process[atlas_robot_state_publisher-9]: started with pid [20942]
Exception AttributeError: AttributeError("'_DummyThread' object has no attribute '_Thread__block'",) in <module 'threading' from '/usr/lib/python2.7/threading.pyc'> ignored
process[multisense_sl_robot_state_publisher-10]: started with pid [20971]
Exception AttributeError: AttributeError("'_DummyThread' object has no attribute '_Thread__block'",) in <module 'threading' from '/usr/lib/python2.7/threading.pyc'> ignored
process[tf2_buffer_server-11]: started with pid [21014]
Exception AttributeError: AttributeError("'_DummyThread' object has no attribute '_Thread__block'",) in <module 'threading' from '/usr/lib/python2.7/threading.pyc'> ignored
process[multisense_sl/camera/stereo_proc-12]: started with pid [21039]
Error [ModelDatabase.cc:404] Unable to download model[model://drc_vehicle]
Error [ModelDatabase.cc:404] Unable to download model[model://drc_vehicle]
Error [parser.cc:544] Unable to find uri[model://drc_vehicle] | {
"domain": "robotics.stackexchange",
"id": 3355,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gazebo-1.8, sdformat",
"url": null
} |
ros, kinect, ros-hydro, camera-pose-calibration, openni-launch
Now I'm truly confused as to whether it is recognizing it or not.
Originally posted by Athoesen on ROS Answers with karma: 429 on 2014-01-07
Post score: 0
Nevermind. It appears I missed a memo about the new 1473 models having no serial number whereas my 3rd Kinect was (a surprise to me) a 1414 model.
Issues between the two models discussed here: http://answers.ros.org/question/61542/kinect-xbox360-new-model-1473-has-problems-example-serial-number-soundcard/
Originally posted by Athoesen with karma: 429 on 2014-01-08
This answer was ACCEPTED on the original site
Post score: 0 | {
"domain": "robotics.stackexchange",
"id": 16602,
"lm_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, kinect, ros-hydro, camera-pose-calibration, openni-launch",
"url": null
} |
2) It's always a good idea to be able to use the limit definition of a derivative (left and right hand limits as you said) but of course in practice you have quicker ways of calculating derivatives, as you know. You can probably tell from the problem if the goal is to quickly calculate the derivative and use that as part of a greater problem, or if the differentiability itself is the main focus of the problem. Anyway, this step is ok.
3) If the limit doesn't exist, it doesn't automatically follow that the function is not continuous at that point. $f(x)=|x|$ is a great example of this. It is continuous at $x=0$ but not differentiable. | {
"domain": "mathhelpboards.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9465966732132748,
"lm_q1q2_score": 0.8613149540995223,
"lm_q2_score": 0.9099070158103778,
"openwebmath_perplexity": 249.94956744422095,
"openwebmath_score": 0.9249218106269836,
"tags": null,
"url": "https://mathhelpboards.com/threads/understanding-limits.6134/"
} |
# Tensors
In this section, we are going to understand:
• what is tensor?
• how to create tensor?
• what operations are supported for a tensor?
import brainpy.math as bm
## What is tensor?
A tensor is a homogeneous multidimensional array. It is a table of elements (usually numbers), all of the same type, indexed by a tuple of non-negative integers. The dimensions of an array are called axes.
In the following picture, the 1D array ([7, 2, 9, 10]) only has one axis. That axis has 4 elements in it, so we say it has a shape of (4,).
While, the 2D array
[[5.2, 3.0, 4.5],
[9.1, 0.1, 0.3]]
has 2 axes. The first axis has a length of 2, the second axis has a length of 3. So, we say it has a shape of (2, 3).
Similarly, the 3D array has 3 axes, with dimensions in each axis is (4, 3, 2).
Each tensor has several important attributes:
• .ndim: the number of axes (dimensions) of the tensor. | {
"domain": "readthedocs.io",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9787126463438263,
"lm_q1q2_score": 0.802439982972366,
"lm_q2_score": 0.8198933425148214,
"openwebmath_perplexity": 5042.462246689959,
"openwebmath_score": 0.3701919913291931,
"tags": null,
"url": "https://brainpy.readthedocs.io/en/brainpy-1.x/tutorial_math/tensors.html"
} |
array, vb.net, extension-methods
Module Module1
#Region "Extension Methods"
<Extension()>
Public Function IsAllocated(ByVal inArray As System.Array) As Boolean
Dim FlagEx As Boolean = True
Try
If inArray Is Nothing Then
FlagEx = False
ElseIf inArray.Length <= 0 Then
FlagEx = False
ElseIf inArray(0) Is Nothing Then
FlagEx = False
End If
Catch ex As Exception
FlagEx = False
End Try
Return FlagEx
End Function
#End Region
End Module
Option Strict
First thing first: Enable Option Strict please read : whats-an-option-strict-and-explicit
This will make your code less error prone. If you have enabled Option Strict you will see a warning on the line ElseIf inArray(0) Is Nothing Then that late binding is not allowed if using Option Strict On.
Regions
Please read are-regions-an-antipattern-or-code-smell | {
"domain": "codereview.stackexchange",
"id": 14399,
"lm_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, vb.net, extension-methods",
"url": null
} |
ruby, community-challenge
def to_s
blank? ? "·" : ship.to_s # note: using unicode character
end
end
How it works: When placing a ship, the code first finds contiguous spans/runs of "free" squares using Array#chunk, i.e. arrays of squares that are unoccupied, and whose neighbors are also unoccupied. It does so for the regular grid (an array of rows), and the transposed grid (an array of columns) to get both horizontal and vertical spans. It then discards spans that are too short for the ship, and picks a random span from the remaining ones - or raises an exception if none remain. Lastly, it places the ship somewhere within the chosen span.
You can use it like so:
# create a standard 10x10 grid
grid = Grid.new
# place some ships of varying sizes (probably best to go from largest
# to smallest)
ships = [5, 4, 3, 2, 1]
ships.each { |size| grid.place_ship(size) }
# pretty-print the grid
puts grid
The above will output: | {
"domain": "codereview.stackexchange",
"id": 13712,
"lm_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, community-challenge",
"url": null
} |
classical-mechanics, forces
Title: Why do we exclude the $(i,i)$ case when summing over internal forces? In the majority of the literature and lectures I see when a system of particles is involved, I usually see the following expression (or similar) for the total force on particle $i$:
$$\vec{F}_i = \vec{F}_{i_{ext}} + \sum_{i\neq j}\vec{F}_{ji}$$
Why is it necessary to include the condition $i\neq j$ in the internal force terms? We know that $\vec{F}_{ii} = 0$, and hence removing the constraint and summing over general $i,j$ surely won't change the total. If $F_{ii}=0$ then you are right that the $i\neq j$ constraint is unnecessary although it does make the physical interpretation clearer: all atoms (other than $i$) act on $i$.
However, in practice, the force is usually given as a function of separation, $F(r)$. And so when you evaluate $F_{ii}$, you effectively evaluate $F(0)$. The problem is that $F(0)$ is almost never zero. | {
"domain": "physics.stackexchange",
"id": 16203,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "classical-mechanics, forces",
"url": null
} |
thermodynamics, statistical-mechanics
Title: How does energy distribute through a lattice? The text that I am reading (Concepts in Thermal Physics by Blundell) gives an example of a simulation in which energy distributes throughout a lattice. The lattice contains 400 atoms and the initial configuration assigns 1 quantum of energy to each atom. Then it chooses one atom at random, removes a quantum of energy from that atom and place it on a second, randomly chosen atom. Here is a diagram from the text: | {
"domain": "physics.stackexchange",
"id": 81729,
"lm_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, statistical-mechanics",
"url": null
} |
quantum-mechanics, homework-and-exercises, angular-momentum, operators
Which does not seem to be correct. Could anyone please show me where I might be going wrong.
My guess would be that my spectral decomposition of the operators is incorrect but I'm not sure. Your $S_z$ is the same as $S_z$ which is wrong. So the commutator will be wrongfully zero. The correct form is
$$S_x=\frac{\hbar}{2}\bigg(|\uparrow\rangle\langle\downarrow|+|\downarrow\rangle\langle\uparrow|\bigg)$$ | {
"domain": "physics.stackexchange",
"id": 64945,
"lm_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, homework-and-exercises, angular-momentum, operators",
"url": null
} |
c#, object-oriented, snake-game
} | {
"domain": "codereview.stackexchange",
"id": 41088,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, object-oriented, snake-game",
"url": null
} |
performance, algorithm, c, strings
void strreplace(char **str, const char *old, const char *new_)
{
size_t i, count_old = 0, len_o = strlen(old), len_n = strlen(new_);
const char *temp = (const char *)(*str);
for (i = 0; temp[i] != '\0'; ++i)
{
if (strstr((const char *)&temp[i], old) == &temp[i])
{
count_old++;
i += len_o - 1;
}
}
char *buff = calloc((i + count_old * (len_n - len_o) + 1), sizeof(char));
if (!buff)
{
perror("bad allocation\n");
exit(EXIT_FAILURE);
}
i = 0;
while (*temp)
{
if (strstr(temp, old) == temp)
{
size_t x = 0;
fast_strncat(&buff[i], new_, &x);
i += len_n;
temp += len_o;
}
else
buff[i++] = *temp++;
}
free(*str);
*str = calloc(i + 1, sizeof(char));
if (!(*str))
{
perror("bad allocation\n");
exit(EXIT_FAILURE);
}
i = 0; | {
"domain": "codereview.stackexchange",
"id": 43014,
"lm_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, algorithm, c, strings",
"url": null
} |
formal-languages, context-free, closure-properties
Here is a simple example. Consider an automaton for $x^n y^n$ that pushes $A$ for each $x$, and pops $A$ for each $y$. The new automaton accepts words of two forms: $y^k x^n y^{n-k}$ and $x^k y^n x^{n-k}$. For words of the first form, stage 1 consists of pushing $k$ times $A'$, stage 2 consists of popping $k$ times $A'$, pushing $n-k$ times $A$, and popping $n-k$ times $A$. For words of the second form, we first push $k$ times $A$, then pop $k$ times $A$, push $n-k$ times $A'$, transition to stage 2, and pop $n-k$ times $A'$. | {
"domain": "cs.stackexchange",
"id": 927,
"lm_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, context-free, closure-properties",
"url": null
} |
prolog, lattices
Title: In the declarative semantics of definite programs, $T_P \downarrow \omega$ is not equal to the greatest fixpoint of $T_P$ I am studying theoretical computer science using the book "Foundations of Logic Programming" by J. W. Loyd. I am in the part about declarative semantics of definite programs.
In the book, if $P$ is a definite program, we denote by $B_P$ the Herbrand base of $P$ and we define $T_P$ as:
Definition. Let $P$ be a definite program. The mapping $T_P: 2^{B_P} \rightarrow 2^{B_P}$ is defined as follows. Let $I$ be a Herbrand interpretation. Then
$$T_P(I) = \{A \in B_P \ | \ A \leftarrow A_1, \ldots, A_n \text{ is a ground instance of a clause in } P \text{ and } \{A_1, \ldots, A_n \} \subseteq I \} $$
We denote by $gfp(T_P)$ the greatest fixpoint of $T_P$. I am currently trying to understand an example that shows that $T_P \downarrow \omega \neq gfp(T_P)$. The example is below: | {
"domain": "cs.stackexchange",
"id": 20712,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "prolog, lattices",
"url": null
} |
So may be the answer is $\{e_1,e_2,\ldots,e_n,ie_1,\ldots,ie_n\}$. How to justify the result if its true?
• Yes, your answer is correct. As usual t's enough to show that (1) the basis is linearly independent (over $\Bbb R$), and (2) that any element of $\Bbb C^n$ can be written as an ($\Bbb R$-)linear combination of basis elements. – Travis Aug 3 '15 at 18:12
• What about taking Re$e_k$, Im$e_k$? – A.Γ. Aug 3 '15 at 18:14
• @A.G. That doesn't work. Consider the standard basis. Half of your basis elements are $0$. – user24142 Aug 3 '15 at 18:31
• @user24142 That's right, I see now, thanks! – A.Γ. Aug 3 '15 at 18:41
• And what does "$\operatorname{Re} e_k$" means when $e_k$ is a vector in a complex vector space? – Najib Idrissi Aug 3 '15 at 18:51
In the case of $\mathbb{C}$ over $\mathbb{C}$, the basis would be $\{1\}$ because every element of $\mathbb{C}$ can be written as a $\mathbb{C}$-multiple of $1$.
$$\mathbb{C}=\{z\times 1 : z \in \mathbb{C}\}$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9759464520028357,
"lm_q1q2_score": 0.8333731270056236,
"lm_q2_score": 0.8539127585282744,
"openwebmath_perplexity": 274.65235707544724,
"openwebmath_score": 0.9963643550872803,
"tags": null,
"url": "https://math.stackexchange.com/questions/1383295/finding-a-basis-of-a-complex-vector-space-over-bbb-r-given-a-basis-over-bbb"
} |
energy, statistical-mechanics
$$
has not the same validity as the general probability of finding the system in a state of energy $E$ in a canonical ensemble, which can be obtained from your formula for $n_i$ dividing by $N$.
However, once one has justified the use of the partition function for a set of non-interacting one-dimensional harmonic oscillators$^*$, formula ($1$) is the correct energy distribution for the $1D$ harmonic oscillator, the energy density of states is a constant (it does not depend on $E$).
Therefore, if $g_i=constant$, the probability is proportional to $e^{-\frac{E}{kT}}$, and the normalization factor of the density distribution in energy is $\frac{1}{kT}$. If we evaluate the partition function of a classical harmonic oscillator in $1D$, we find
$$
Z=\frac{kT}{\hbar \omega}, \tag{2}
$$ | {
"domain": "physics.stackexchange",
"id": 94555,
"lm_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, statistical-mechanics",
"url": null
} |
gazebo, simulation, simulator-gazebo
Currently the /gazebo/link_states topic does not publish the root scope (e.g. Robot_Name:: ) but this has been patched and the scope will be published along with the name in "Electric Turtle".
A patch for gazeboros in diamondback is available here.
Originally posted by Asomerville with karma: 2743 on 2011-05-26
This answer was ACCEPTED on the original site
Post score: 1
Original comments
Comment by Asomerville on 2011-06-02:
Next admin that sees this: Could you please mark this as the answer? | {
"domain": "robotics.stackexchange",
"id": 5673,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gazebo, simulation, simulator-gazebo",
"url": null
} |
c#, wpf, xaml
Here's the control template XAML of the TabItem (the relevant part):
<ControlTemplate TargetType="{x:Type local:CustomTabItem}">
<Grid Height="26" Background="{TemplateBinding Background}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ContentPresenter Margin="5,0" HorizontalAlignment="Left" VerticalAlignment="Center" ContentSource="Header">
</ContentPresenter>
<StackPanel Grid.Column="1" Height="16" Margin="0,0,1,0" HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Horizontal">
<ToggleButton x:Name="Edit" Width="16" Content="" Style="{StaticResource CustomizedMetroTabItemToggleButton}" ToolTip="Edit" /> | {
"domain": "codereview.stackexchange",
"id": 6645,
"lm_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#, wpf, xaml",
"url": null
} |
machine-learning, neural-network, data-mining
update half a year later
With more nodes per layer, I have successfully trained a neural network. The topology is set to $\lbrace 3, 64, 64, 64 \rbrace$. And the most important trick is, sorting the generated triplet $\lbrace x_0, x_1, x_2 \rbrace$, ensuring $x_0 <= x_1 <= x_2$ always holds. You're trying to fit a very complicated function. There is no reason to expect that neural networks will be very good at this. Neural networks aren't magic pixie dust. They can do some things well, but don't expect a silver bullet. | {
"domain": "datascience.stackexchange",
"id": 1453,
"lm_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, neural-network, data-mining",
"url": null
} |
newtonian-mechanics, newtonian-gravity, rotational-dynamics, projectile, coriolis-effect
Title: If a bullet is fired vertically upwards, when it comes back does it fall to the same spot? What I'm basically asking is that if a body is projected with sufficiently high velocity so that it doesn't escape from the earth's gravitational field but reaches an appreciable height with respect to the radius of the earth, then when it comes back will it land on the same spot from which it was fired? You can neglect drag force and winds but do consider the rotation of the earth.
Basically what has to be considered is that the net force acts towards the centre of the earth and so I tried conserving angular momentum. That shows that the angular velocity of the object will decrease with increasing height above the earth. So basically the object moves with smaller angular velocity for some time in it's path. | {
"domain": "physics.stackexchange",
"id": 19955,
"lm_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, rotational-dynamics, projectile, coriolis-effect",
"url": null
} |
data-structures, space-complexity, sets
This doesn't include the space to store the sets in the keys, as those presumably already exist. If you want to include that space as well in your estimate of the space complexity, then we need at most $\Theta(m)$ space for the map, plus $\Theta(mk)$ space to hold the sets (assuming each set contains $k$ elements), for a total of $\Theta(mk)$ space. I am assuming that each element of $S$ can be stored in a single word ($\Theta(1)$ space), e.g., that $n \le 2^{64}$. If $n$ is huge, so that an element of $S$ cannot be stored in a single word, a better estimate of the total space usage is $\Theta(mk \lg n)$, since it takes $\Theta(\lg n)$ bits to store a single element of $S$, each subset of $k$ elements takes $\Theta(k \lg n)$ bits, and there are $m$ entries in the map, each of which requires $\Theta(k \lg n)$ bits to store it. | {
"domain": "cs.stackexchange",
"id": 1734,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "data-structures, space-complexity, sets",
"url": null
} |
orbital-motion, celestial-mechanics, stability, exoplanets, binary-stars
References:
[1] "Migration of planets in circumbinary discs," https://arxiv.org/abs/1806.00314
[2] "Tidal decay of circumbinary planetary systems," https://arxiv.org/abs/1808.02090
[3] "SPOTS: The Search for Planets Orbiting Two Stars. III. Complete Sample and Statistical Analysis," https://arxiv.org/abs/1807.08687
[4] "Recent Kepler Results On Circumbinary Planets," https://arxiv.org/abs/1308.6328
[5] "Stability of exomoons around the Kepler transiting circumbinary planets," https://arxiv.org/abs/1806.06075 | {
"domain": "physics.stackexchange",
"id": 59586,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "orbital-motion, celestial-mechanics, stability, exoplanets, binary-stars",
"url": null
} |
c++, sqlite, wrapper
size_t num_commands = sizeof(sql) / sizeof(char*);
for (size_t i = 0; i < num_commands; ++i) {
rc = sqlite3_exec(db, sql[i], 0, 0, &err_msg);
if (rc != SQLITE_OK) {
fprintf(stderr, "SQL error: %s\n", err_msg);
sqlite3_free(err_msg);
sqlite3_close(db);
}
}
sqlite3_close(db);
}
const std::string filename("contacts.db");
std::vector<std::string> tables{ "contacts", "calls" };
}
class sqlite_cpp_tester : public ::testing::Test {
public:
void SetUp() {
db_initial_setup();
}
};
TEST_F(sqlite_cpp_tester, given_a_valid_db_file_open_close_return_success) {
sql::sqlite db;
EXPECT_EQ(db.open("contacts.db"), SQLITE_OK);
EXPECT_EQ(db.close(), SQLITE_OK);
}
TEST_F(sqlite_cpp_tester, given_a_valid_insert_select_returns_same_as_inserted) {
sql::sqlite db;
EXPECT_EQ(db.open("contacts.db"), SQLITE_OK); | {
"domain": "codereview.stackexchange",
"id": 41239,
"lm_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++, sqlite, wrapper",
"url": null
} |
Why can matrix exponentiation be done by squaring?
Matrix multiplication is not communative:
A*B != B*A
Then why can matrix exponentiation be done by squaring?
I have tried searching for special cases where this rule did not apply, but from what I've understood, none of it seemed to apply specifically to powers of two equal matrices.
For example a matrix M is raised to a 12, then which of the following is true?
M4 * M8 = M12 OR M8 * M4 = M12 ?
Do we need to follow a particular order while calculating matrix exponentiation by squaring ? If yes then how is the order determined and why does it lead to the correct exponentiation. If not then why doesn't the fact that matrix multiplication is not communative does not affect it?
Can this be explained this to me in plain english? Thanks in advance. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.971563964485063,
"lm_q1q2_score": 0.8117256935903493,
"lm_q2_score": 0.8354835330070838,
"openwebmath_perplexity": 206.55803429219532,
"openwebmath_score": 0.8954838514328003,
"tags": null,
"url": "https://math.stackexchange.com/questions/646296/why-can-matrix-exponentiation-be-done-by-squaring"
} |
# Uniform continuity of continuous periodic function
Defn: Let $f$ be a function from $\mathbb{R}$ into a set $X$. We say that $f$ is periodic if there exists $p>0$ such that for all $x\in \mathbb{R}$, we have $f(x+p)=f(x)$.
Prove: If $f$ is a continuous periodic function from $\mathbb{R}$ into a metric space $M$, then $f$ is uniformly continuous on $\mathbb{R}$.
Attempt: I think I can use the fact that for all $x \in \mathbb{R}$, $[x,x+p]$ is a closed and bounded interval. Then $f$ is compact and hence uniformly continuous on the interval.
I also tried considering $[0,p]$. In that case, $x = np+\alpha$ and $y = mp + \beta$ for some $m,p \in \mathbb{Z}$ and $\alpha,\beta \in \mathbb{R}$. If $n<0$, then we can choose $\alpha \in \mathbb{R^\mathbf{-}}$, so that $f(np+\alpha)=f(|\alpha|)$ and not $f(1-\alpha)$. Hope that makes sense. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9814534392852384,
"lm_q1q2_score": 0.8199881969869336,
"lm_q2_score": 0.8354835432479661,
"openwebmath_perplexity": 103.6994658053068,
"openwebmath_score": 0.9649980068206787,
"tags": null,
"url": "https://math.stackexchange.com/questions/2418440/uniform-continuity-of-continuous-periodic-function"
} |
qiskit, quantum-operation, noise, computational-models
epsilon = 0.1
z_rot = qiskit.circuit.library.U1Gate(epsilon)
z_rot_dg = qiskit.circuit.library.U1Gate(-epsilon)
noise_model = NoiseModel()
noise_model.add_all_qubit_quantum_error(coherent_unitary_error(z_rot), 'u2')
noise_model.add_all_qubit_quantum_error(coherent_unitary_error(z_rot), 'u3')
print(noise_model)
noise_sim = AerSimulator(noise_model=noise_model)
circ = QuantumCircuit(1, 1)
circ.h(0)
circ.h(0)
circ.measure(0, 0) | {
"domain": "quantumcomputing.stackexchange",
"id": 3017,
"lm_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, quantum-operation, noise, computational-models",
"url": null
} |
particle-physics, standard-model, feynman-diagrams, scattering-cross-section, electroweak
We can effectively ignore the electromagnetic process around this energy, and so each process should have it's own Breit-Wigner peak centred on the mass energy of the $Z^0$. The ratio of these is just a constant.
Thinking in terms of Feynman rules and again ignoring the electromagnetic process around this region, each process has the same propagator and vertex factors (roughly - ignore quark mixing) and there are some extra factors due to different quarks being possible and colour degeneracy, but still the ratio should be a constant (one possible issue here is interference between Feynman diagrams which I have neglected?).
So my question is why does the peak exist in the data?
[The figure shown in the OP question above ...] is experimental data for the ratio $R = $ [...] as a function of the centre of mass energy $\sqrt{s}$ | {
"domain": "physics.stackexchange",
"id": 29913,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "particle-physics, standard-model, feynman-diagrams, scattering-cross-section, electroweak",
"url": null
} |
Q-Q plot, or quantile-quantile plot, is a graphical tool to help us assess if a set of data plausibly came from some theoretical distribution such as a Normal or exponential. The plot also contours values of Cook’s distance, which reflects how much the fitted values would change if a point was deleted. If the distribution of x is normal, then the data plot appears linear. Different figures will be drawn in the top left for other types of model (Section 5). Figure 3: The left plot displays a traditional normal Q-Q plot for data simulated from a lognormal distribution. Left: qq-plot with exponential reference distribution. Combining Plots. In the past, when working with R base graphics, I used the layout() function to achive this [1]. If R=10, the threshold should be 29. For example, the whole plot area would be c(0, 1, 0, 1) with (x1, y1) = (0, 0) being the lower-left corner and (x2, y2) = (1, 1) being the upper-right corner. I am trying to create a Q-Q plot to test if my data can be | {
"domain": "clubita.it",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9621075711974103,
"lm_q1q2_score": 0.8099268345758419,
"lm_q2_score": 0.8418256532040708,
"openwebmath_perplexity": 1397.0072810229867,
"openwebmath_score": 0.538626492023468,
"tags": null,
"url": "http://clubita.it/yzob/qq-plot-pdf.html"
} |
machine-learning, nlp, text-mining, algorithms
ngram + word boundaries
To do a proper analysis you should probably create tags to indicate n-grams at the start and end of a word, (dog -> {^d, do, og, g^}) - this would allow you to capture phonological/orthographic constraints that might otherwise be missed (e.g., the sequence ng can never occur at the beginning of a native English word, thus the sequence ^ng is not permissible - one of the reasons why Vietnamese names like Nguyễn are hard to pronounce for English speakers).
Call this collection of grams the word_set. If you reverse sort by frequency, your most frequent grams will be at the top of the list -- these will reflect the most common sequences across English words. Below I show some (ugly) code using package {ngram} to extract the letter ngrams from words then compute the gram frequencies:
#' Return orthographic n-grams for word
#' @param w character vector of length 1
#' @param n integer type of n-gram
#' @return character vector
#'
getGrams <- function(w, n = 2) { | {
"domain": "datascience.stackexchange",
"id": 805,
"lm_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, nlp, text-mining, algorithms",
"url": null
} |
ros, opencv, ros-melodic, opencv3
Compile OpenCV
Install OpenCV
Originally posted by sapient84 with karma: 51 on 2019-01-28
This answer was ACCEPTED on the original site
Post score: 2
Original comments
Comment by sam_123 on 2019-02-07:
Yeah, I build now our own OpenCV Contrib debian packages. No idea why they didn't include all the contrib features into the "official" debian packages.
Comment by Elektron97 on 2021-07-13:
How I can add this module in build configuration? | {
"domain": "robotics.stackexchange",
"id": 32268,
"lm_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, opencv, ros-melodic, opencv3",
"url": null
} |
photosynthesis
$B)$ receiving electrons from the thylakoid membrane electron transport chain
$C)$ generation of molecular oxygen
$D)$ extraction of hydrogen electrons from the splitting of water
$E)$ passing electrons to the thylakoid membrane electron transport chain It appears the author of the question is trying to use "thylakoid electron transport chain" in an overly specific way. The chain from which PS I receives electrons has far more components and is different from the shorter chain to which PS I passes its electrons. But according to my copy of Biology, Campbell & Reece 7th edition, both are called "electron transport chains" and both reside in, or on, the thylakoid membrane. Perhaps the "directly" in the question refers to the fact that PS I's electron is first captured by a "primary receptor" before being passed to ferredixon, the first member of the chain to which PS I passes electrons. But, again according to Campbell, this primary acceptor is considered part of the photosystem. | {
"domain": "biology.stackexchange",
"id": 6527,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "photosynthesis",
"url": null
} |
biochemistry, physiology
Title: What exothermic reaction distinguishes warm blooded animals? I would appreciate an answer specifically in the form of an exothermic chemical reaction. Namely, the one primarily responsible for generating heat in warm blooded animals that does not take place in cold blooded animals. Brown adipose tissue or brown fat is one of the primary ways of generating body heat, and it is only found in warm-blooded animals. It is brown due to the high numbers of mitochondria, and heat is generated by uncoupling the electron transport chain from ATP synthesis by oxidative phosphorylation. | {
"domain": "biology.stackexchange",
"id": 881,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "biochemistry, physiology",
"url": null
} |
python
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.76 Safari/537.36'}
url="https://fineli.fi/fineli/en/elintarvikkeet/resultset.csv"
s=requests.get(url, headers= headers).text
c=pd.read_csv(StringIO(s), sep=";")
c | {
"domain": "datascience.stackexchange",
"id": 5061,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "python",
"url": null
} |
image-processing
Let us now interpret this result. This is the ratio of the power of signal to the power of noise. Power is in some sense the squared norm of your signal. It shows how much squared deviation you have from zero on average.
You should also note that we can extend this notion to images by simply summing twice of rows and columns of your image vector, or simply stretching your entire image into a single vector of pixels and apply the one-dimensional definition. You can see that no spacial information is encoded into the definition of power.
Now let's look at peak signal to noise ratio. This definition is
$$P_{PSNR}=\frac{\text{max}(s^2[n])}{\text{MSE}}.$$ | {
"domain": "dsp.stackexchange",
"id": 7620,
"lm_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",
"url": null
} |
quantum-mechanics, optics
a space-time point to be proportional to the square probability amplitude. That is, measurements will be noisy when you do them away from the beam core since you get few photons, but averaged together you get a probability density that looks just like a normal illustration of a classical beam. If you measure different segments of the beam you will get Poisson-distributed numbers of photons, but since the photon rate is huge this will average together into pretty tightly a peaked normal distribution. There could be uncertainty about phase and even mode of the beam making a mixture that blurs things a bit. | {
"domain": "physics.stackexchange",
"id": 58192,
"lm_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, optics",
"url": null
} |
organic-chemistry, concentration, temperature
That's why usually a low temperature and a slow brewing are recommended. | {
"domain": "chemistry.stackexchange",
"id": 6176,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "organic-chemistry, concentration, temperature",
"url": null
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.