text stringlengths 1 1.11k | source dict |
|---|---|
newtonian-mechanics, forces, friction, free-body-diagram
Title: How does friction accelerate a car after rest? If a car moves using the friction force from the rotation of the wheels, shouldn't a car be unable to accelerate immediately after the car is at motion, since there will be a friction force of equal magnitude which opposes the movement of the car. I've been trying to think about how cars move for a while now (from a purely mathematical perspective), however I haven't been able to find any rotational velocity dependant equations for friction. The only idea that I have, which doesn't make that much sense is that the rotational friction is proportional to the centripetal force, however it doesn't seem to make that much sense... | {
"domain": "physics.stackexchange",
"id": 80960,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "newtonian-mechanics, forces, friction, free-body-diagram",
"url": null
} |
Theorem 9.16.
If $$A$$ is a countably infinite set and $$B$$ is a finite set, then $$A \cup B$$ is a countably infinite set.
Proof
Exercise (5) on page 474.
Theorem 9.16 says that if we add a finite number of elements to a countably infinite set, the resulting set is still countably infinite. In other words, the cardinality of the new set is the same as the cardinality of the original set. Finite sets behave very differently in the sense that if we add elements to a finite set, we will change the cardinality. What may even be more surprising is the result in Theorem 9.17 that states that the union of two countably infinite (disjoint) sets is countably infinite. The proof of this result is similar to the proof that the integers are countably infinite (Theorem 9.13). In fact, if $$A = \{a_1, a_2, a_3, ...\}$$ and $$B = \{b_1, b_2, b_3, ...\}$$, then we can use the following diagram to help define a bijection from $$\mathbb{N}$$ to $$A \cup B$$.
Theorem 9.17 | {
"domain": "libretexts.org",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9820137884587393,
"lm_q1q2_score": 0.8307271319582111,
"lm_q2_score": 0.8459424314825853,
"openwebmath_perplexity": 82.19969367751484,
"openwebmath_score": 0.970478355884552,
"tags": null,
"url": "https://math.libretexts.org/Bookshelves/Mathematical_Logic_and_Proof/Book%3A_Mathematical_Reasoning__Writing_and_Proof_(Sundstrom)/9%3A_Finite_and_Infinite_Sets/9.2%3A_Countable_Sets"
} |
java, matrix
Bigger suggestion
In this case I would consider a significantly different data structure.... :
Create a Tile Object for each Tile.
The GameState instance will then just become a loose collection of Tiles.
Keep the tile location embedded in the Tile instance.
Treat the empty space as a tile, and the 'rule' is that the Empty tile is the only tile that can swap positions with it's neighbour.
You can embed the logic in to methods on the Tile to identify the tile position and directions.
Doing the above can reverse a lot of your game logic, but the benefit will be that you move the logic out of the main methods in to the object orientation.... | {
"domain": "codereview.stackexchange",
"id": 6656,
"lm_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, matrix",
"url": null
} |
c#, object-oriented, .net, captcha
if (extraClasses != null)
{
result = result.Replace("%EXTRACLASSES%", string.Join(" ", extraClasses));
}
return result;
}
}
public class ReCaptchaResponse
{
private bool _success = false;
private ReCaptchaErrors _errors = ReCaptchaErrors.None;
public bool Success => _success;
public ReCaptchaErrors Errors => _errors;
public bool ParseJson(string jsonResponse)
{
JavaScriptSerializer jss = new JavaScriptSerializer();
dynamic deserializedJson = jss.DeserializeObject(jsonResponse);
if (deserializedJson.ContainsKey("success"))
{
_success = deserializedJson["success"];
_errors = ReCaptchaErrors.None; | {
"domain": "codereview.stackexchange",
"id": 15902,
"lm_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, .net, captcha",
"url": null
} |
forces, energy, coulombs-law, interactions
Title: Interaction Energy vs Force I'm having a hard time determining the relationship/differences between interaction energy and forces. Say we have a system of two charged particles. Each particle will exert a force on each other (from Coulomb's Law), but also defined is an interaction energy between the two particles given by Coulomb's Law multiplied by the distance between them (reducing the $r^2$ term in Coulomb's Law to just $r$).
How are these concepts related? What is the correct way to interpret the interaction energy? The force is just the gradient of the potential energy. So it's not true that the energy is just force multiplied by $r$. It is the integral of the force w.r.t. $r$, which gives you the $1/r$ dependence.
Edit: here "potential energy" and "interaction energy" are used interchangeably. | {
"domain": "physics.stackexchange",
"id": 22955,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "forces, energy, coulombs-law, interactions",
"url": null
} |
You know that the eigenvector associated with the $0$ eigenvalue is in the kernel of $B$.
And you know that the eigenvectors are independent. The space spanded by the set of eigenvectors associated with the non-zero eigenvalues has dimension equal to the number of non-zero eigenvalues.
• Yes I understand that but what does eigen space of non-zero eigevnalues have anything to do with kernel of B(I CLEARLY understand the 0 part). – Hello Dec 13 '16 at 19:52
• They are not in the kernel! Only vectors parallel to that 0 eigenvector are in the kernel. – Doug M Dec 13 '16 at 19:54
• Most of people who answered are saying two distinct nonzero eigenvalues imply dimension of two. How do you make this leap? – Hello Dec 13 '16 at 20:00
• 2 non-zero eigenvalues indicates 2 independent vectors that are not in the kernel. – Doug M Dec 13 '16 at 20:05
Suppose that a matrix has rank $1$. This means there is a vector $w$ such that $f(u)$ is a multiple of $w$ for all $u\in U$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9838471661250913,
"lm_q1q2_score": 0.8155490891427624,
"lm_q2_score": 0.8289387998695209,
"openwebmath_perplexity": 140.96743120701245,
"openwebmath_score": 0.9358901381492615,
"tags": null,
"url": "https://math.stackexchange.com/questions/2057503/what-is-the-relationship-between-the-rank-and-the-number-of-eigenvalues"
} |
turtlebot, ros-kinetic
However:
$ dpkg -l | grep turtlebot
ii ros-kinetic-turtlebot 2.4.2-0xenial-20181203-135343-0800 amd64 The turtlebot meta package provides all the basic drivers for running and using a TurtleBot.
ii ros-kinetic-turtlebot-bringup 2.4.2-0xenial-20181203-130710-0800 amd64 turtlebot_bringup provides roslaunch scripts for starting the TurtleBot base functionality.
ii ros-kinetic-turtlebot-capabilities 2.4.2-0xenial-20181107-032940-0800 amd64 Capabilities for the TurtleBot
ii ros-kinetic-turtlebot-description 2.4.2-0xenial-20180825-011706-0800 amd64 turtlebot_description provides a complete 3D model of the TurtleBot for simulation and visualization.
ii ros-kinetic-turtlebot-navigation 2.3.7-0xenial-20181203-134700-0800 amd64 turtlebot_navigation | {
"domain": "robotics.stackexchange",
"id": 32201,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "turtlebot, ros-kinetic",
"url": null
} |
containing $0$ and closed under successor, which was not the whole of $\mathbb{N}^\ast$, which would contradict the fact that $\mathbb{N}^\ast$ satisfies induction in the nonstandard realm. http://mathoverflow.net/questions/132860/how-many-possible-ways-are-there-to-win-in-quoridor/132890#132890 Comment by Joel David Hamkins Joel David Hamkins 2013-06-14T03:02:51Z 2013-06-14T03:02:51Z Waldemar, I guess your estimates assume that we do no pruning at all, but of course, we can substantially prune the game tree, while remaining certain of our analysis, and this might considerably cut down on the complexity. (Also, could you explain the $10^123$ estimate?) http://mathoverflow.net/questions/132687/is-there-any-superstable-configuration-in-the-game-of-life/133308#133308 Comment by Joel David Hamkins Joel David Hamkins 2013-06-14T02:57:44Z 2013-06-14T02:57:44Z My understanding of the noisy rules is that, with small probability, a cell can turn on or off regardless of its surroundings. So any | {
"domain": "mathoverflow.net",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9621075739136381,
"lm_q1q2_score": 0.8324386563542616,
"lm_q2_score": 0.8652240964782011,
"openwebmath_perplexity": 380.9785412055225,
"openwebmath_score": 0.8968687653541565,
"tags": null,
"url": "http://mathoverflow.net/feeds/user/1946"
} |
python, beginner, python-2.x, console
if __name__ == "__main__":
inputVerification() You should really take a look at argparse: the argparse module makes it easy to write user-friendly command-line interfaces. It will even take care of writing the help for you.
Even if you will apply very little of the following (since you should really use the argparse module), I'll give you some advice anyway.
str.lower()
This:
if hashmethod == "MD5":
hashCalculator(filename, "md5")
elif hashmethod == "SHA1":
hashCalculator(filename, "sha1")
elif hashmethod == "SHA224":
hashCalculator(filename, "sha224")
elif hashmethod == "SHA256":
hashCalculator(filename, "sha256")
elif hashmethod == "SHA384":
hashCalculator(filename, "sha384")
elif hashmethod == "SHA512":
hashCalculator(filename, "sha512")
could just be:
hashCalculator(filename, hashmethod.lower()) | {
"domain": "codereview.stackexchange",
"id": 1544,
"lm_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, python-2.x, console",
"url": null
} |
geometry
Source: https://www.instructables.com/id/20-Geodesic-Dome-Greenhouse/
Question:
What method of wrapping a geodesic dome would result in the least amount of overlapping and loose areas? Minimising overlap and loose areas at the same time will be very difficult. It may be possible to source a material that you can ‘shrink wrap’ on, eg using heat, but I don’t have specific pointers there.
Regarding laying a flat sheet, your key aim here should be to have regular overlaps. See tutorials on wrapping circular objects https://youtu.be/dH_gpSfaA6E or industrially wrapped spheres such as old golf balls, or Chocolate Oranges (if you’re from the UK!) | {
"domain": "engineering.stackexchange",
"id": 5430,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "geometry",
"url": null
} |
raspberry-pi, precise-positioning
A camera and known-location fiducials like ARTags is another option. Accuracy depends on the number and size of fiducials, and how much effort you put into to calibrating your camera and locations of landmarks.
UWB radios which can measure the time of flight between endpoints is another option. There are two main players here: https://www.decawave.com/ and http://bespoon.com/. Accuracy will depend on number and placement of beacons. | {
"domain": "robotics.stackexchange",
"id": 1664,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "raspberry-pi, precise-positioning",
"url": null
} |
This is a good question. You can prove the binomial theorem (where the choose functions are interpreted as elements of the "copy" of $\mathbb{Z}$ in the ring by exactly the map you described) in any commutative ring. Induct on $n$, the case of $n = 1$ being clear. $$(x+y)^n = (x+y)(x+y)^{n-1} = (x+y)\sum_{k=0}^{n-1}\binom{n-1}{k} x^ky^{n-1-k}$$ Expanding, the coefficient of $x^jy^{n-j}$ is $$\binom{n-1}{j-1} + \binom{n-1}{j}$$ and we win since we are reduced to the usual statement in the integers that $$\binom{n}{j} = \binom{n-1}{j-1} + \binom{n-1}{j}$$ (which you can prove bijectively, but which you should already accept since you're willing to accept the binomial theorem over $\mathbb{Z}$.) | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9706877700966099,
"lm_q1q2_score": 0.8380836783115939,
"lm_q2_score": 0.863391611731321,
"openwebmath_perplexity": 307.5447909367371,
"openwebmath_score": 0.8270158767700195,
"tags": null,
"url": "https://math.stackexchange.com/questions/1254138/in-which-algebraic-setting-can-i-state-and-prove-the-binomial-theorem"
} |
python, python-3.x, playing-cards
cscore = sum(chand)
score = sum(hand)
if cscore > 21:
cbust = "y"
if score > 21:
bust = "y"
else:
bust = "n"
else:
cbust = "n"
if score > 21:
bust = "y"
else:
bust = "n"
print(c.cl + "The computer's hand was" + str(chand))
print("Your hand was" + str(hand)) | {
"domain": "codereview.stackexchange",
"id": 17968,
"lm_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, playing-cards",
"url": null
} |
performance, c, recursion, functional-programming, interpreter
Uniformity of reference
struct Value top(const Stack stack)
should be
struct Value top(const Stack *stack)
since your other functions (correctly) accept pointers. Also, have a read through this:
https://stackoverflow.com/questions/44157072/const-in-c-function-declaration-and-implementation
Your declaration and definition should agree on the const-ness of the argument.
Makefile variables
This:
OBJS = Combinator.o Function.o Interpret.o RawCode.o Stack.o Show.o
shouldn't include .o in its members. For more flexibility, to get this list just use extension substitution, a la
https://stackoverflow.com/questions/12069457/how-to-change-the-extension-of-each-file-in-a-list-with-multiple-extensions-in-g#12071918
Use auto-variables
in this:
main : ${OBJS} main.o
@echo Linking...
${CC} ${CCFLAGS} ${OBJS} main.o -o main
you can instead do
main: main.o ${OBJS}
@echo Linking...
${CC} ${CCFLAGS} $^ -o $@ | {
"domain": "codereview.stackexchange",
"id": 36505,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "performance, c, recursion, functional-programming, interpreter",
"url": null
} |
java, http, networking, url, concurrency
private void get_http_response(String url) throws IOException {
URL u = new URL(url);
URLConnection conn = u.openConnection();
contlen = conn.getContentLengthLong();
inp = conn.getInputStream();
}
public void run() {
try {
IOUtils.copy(inp, cos);
cos.flush();
} catch (IOException e) {
copied = -1;
try {
pth.join();
} catch (InterruptedException e1) {
e1.printStackTrace();
}
}
}
}
class DownloadWatch implements Runnable {
Thread pth;
HashMap<String, Downloader> ths;
ArrayList<String> urls;
DownloadWatch(HashMap<String, Downloader> dmap) {
ths = dmap;
urls = new ArrayList<String>(dmap.keySet());
pth = new Thread(this, String.format("downloadWatch_%s", dmap.toString()));
pth.start();
} | {
"domain": "codereview.stackexchange",
"id": 9571,
"lm_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, http, networking, url, concurrency",
"url": null
} |
quantum-mechanics, mathematical-physics, hilbert-space
It is possible to extend a bit the latter when dealing with distributions in ${\cal S}'(\mathbb R)$ with compact support, like $\delta(x-x_0)$, since they work on the whole space of smooth functions $C^\infty(\mathbb R)\supset {\cal S}(\mathbb R)$, which includes the exponentials $e^{ikx}$ in particular.
There is a continuous embedding (see below) of the space of kets into the space of bras ${\cal S}(\mathbb R) \subset {\cal S}'(\mathbb R)$, but it is false that a bra vector is also a ket vector. Thus there is no full version of Riesz' lemma.
Your uniqueness issue is easy. If $u_1,u_2 \in {\cal S}'(\mathbb R)$ are such that $\langle u_1|v\rangle = \langle u_2|v\rangle $ for every $v \in {\cal S}(\mathbb R)$, then $u_1=u_2$. This fact is trivially definitory because distributions are (continuous) linear functionals on ${\cal S}(\mathbb R)$ and two function(al)s coincide if and only if they coincide when applied to every element of their domain. | {
"domain": "physics.stackexchange",
"id": 27573,
"lm_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, mathematical-physics, hilbert-space",
"url": null
} |
synthesis, solid-state-chemistry, optical-properties
As you can see, none of the alternatives fully satisfies the entire set of properties that make a diamond. Moissanite may be slightly better, but it's also more expensive. And remember - one of the most appealing things about diamonds is their rarity and natural occurrence. No synthetic simulant can replace that. | {
"domain": "chemistry.stackexchange",
"id": 2484,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "synthesis, solid-state-chemistry, optical-properties",
"url": null
} |
c++, c++14
std::string firstName;
std::string surName;
int balance;
bool open;
int accountNo;
public:
Account();
Account(std::string const& firstName, std::string const& surName, int balance);
Account(Account const&) = default;
Account(Account&&) = default;
Account& operator=(Account const&) = default;
Account& operator=(Account&&) = default;
void swap(Account& other) noexcept;
friend void swap(Account& lhs, Account& rhs) {lhs.swap(rhs);}
friend std::ostream& operator<<(std::ostream& str, Account const& acc);
friend std::istream& operator>>(std::istream& str, Account& acc);
};
struct AccountPrettyPrint
{
Account const& acc;
AccountPrettyPrint(Account const& acc): acc(acc) {} | {
"domain": "codereview.stackexchange",
"id": 36624,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, c++14",
"url": null
} |
matlab, fourier-transform
Is this correct or have I have misinterpreted how fft works? I'm really not certain about when we have are dealing with frequency $f$ and when we are dealing with angular frequency $f$? There are two things to clarify here before the answer becomes self-evident.
The trigonometric functions $\cos, \sin, \dots$
The relationship between phase $\phi$ and frequency $f$. | {
"domain": "dsp.stackexchange",
"id": 5633,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "matlab, fourier-transform",
"url": null
} |
python, regex
Picking 0x00010d35, 0x04b60ff6 & 0x84900c5 is the task. Rest of the line is supposed to be ignored
Some entries are multi-line with trailing backslash.
Each file is in megabytes. Total files in both folders - 80
1) Please suggest optimization in the below code, because pattern check is done twice.
if bool(re.search(r'^0[xX][0-9a-fA-F]+', line)):
# Take the hexcode
obj = re.search(r'^0[xX][0-9a-fA-F]+', line)
event_code_set.add(obj.string[obj.start():obj.end()])
2) Please suggest coding style optimizations for tree walk, cache and command line arguments. Possible bugs | {
"domain": "codereview.stackexchange",
"id": 31306,
"lm_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, regex",
"url": null
} |
The graph of $$\overline r (n)$$ has a strong log resemblance.
• Thanks for your answer. The asymptotic formula looks more complicated than I would have expected, but I am sure more accurate than what I had in mind. – Vincent Granville Aug 11 at 17:50
• @VincentGranville as you know, asymptotic expressions can be somewhat simplified depending on the degree of accuracy required. I intend to proceed and dig a bit more on that: will let you know. – G Cab Aug 11 at 23:29
• @VincentGranville: Up to now, I just could find another expression for $C(n,r)$ which I added to my answer. I am looking for a better asymptotics. – G Cab Aug 20 at 18:42
• Looking forward to it! Thanks G Cab. – Vincent Granville Aug 20 at 19:06
• @VincentGranville: taken a further step, but the asymptotics remains elusive.. – G Cab Aug 22 at 12:54
Let's analyze a simpler case first, $$f_n(k)$$: the number of binary strings of length $$k$$ that do not contain $$1^n$$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9811668690081642,
"lm_q1q2_score": 0.8111422267495003,
"lm_q2_score": 0.8267117983401363,
"openwebmath_perplexity": 1428.7463989783982,
"openwebmath_score": 0.9980400204658508,
"tags": null,
"url": "https://math.stackexchange.com/questions/3319265/maximum-run-in-binary-digit-expansions"
} |
15. May 7, 2013
### Saitama
I reached that answer. xin(15) is equivalent to Rsin(30) and xcos(15) is equivalent R(1+cos(30)). This was obvious from the diagram. I should have done that before.
Thanks you.
Okay, so the direction of friction on the cylinder from the ground is in the right direction ($f_1$) and from the dog, its tangential in the direction opposite to the motion of dog ($f_2$).
This will give me 2 equations:
$$f_1=4ma$$
$$f_1R-f_2R=I\alpha$$
Am I doing this right? :)
Last edited: May 7, 2013
16. May 7, 2013
### TSny
If you're going to treat the cylinder alone, then there will be horizontal components of the normal and friction forces from the the dog that will need to be included in ƩFx = (4m)a | {
"domain": "physicsforums.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9683812318188366,
"lm_q1q2_score": 0.8152081514978713,
"lm_q2_score": 0.8418256412990657,
"openwebmath_perplexity": 476.6847984408491,
"openwebmath_score": 0.6835413575172424,
"tags": null,
"url": "https://www.physicsforums.com/threads/finding-acceleration-of-cylinder.690281/"
} |
With `syms`, you can create multiple variables in one command. Create the variables `a`, `b`, and `c`.
`syms a b c`
#### Create Array of Symbolic Variables
If you want to create a MATLAB array of numbered symbolic variables, the `sym` syntax is more convenient than the `syms` syntax. Therefore, use `sym` to create an array of many numbered symbolic variables.
Clear the workspace. Create a row vector containing the symbolic variables ${\mathit{a}}_{1},\dots ,{\mathit{a}}_{20}$ and assign it to the MATLAB variable `A`. Display the variable in the MATLAB workspace.
```clear A = sym('a',[1 20])```
`A = $\left(\begin{array}{cccccccccccccccccccc}{a}_{1}& {a}_{2}& {a}_{3}& {a}_{4}& {a}_{5}& {a}_{6}& {a}_{7}& {a}_{8}& {a}_{9}& {a}_{10}& {a}_{11}& {a}_{12}& {a}_{13}& {a}_{14}& {a}_{15}& {a}_{16}& {a}_{17}& {a}_{18}& {a}_{19}& {a}_{20}\end{array}\right)$`
`whos`
``` Name Size Bytes Class Attributes A 1x20 8 sym ```
`A` is a `1`-by-`20` array of 20 symbolic variables. | {
"domain": "mathworks.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9833429638959674,
"lm_q1q2_score": 0.8107288258199536,
"lm_q2_score": 0.8244619177503206,
"openwebmath_perplexity": 1352.8184529520788,
"openwebmath_score": 0.5192731618881226,
"tags": null,
"url": "https://fr.mathworks.com/help/symbolic/create-symbolic-numbers-variables-and-expressions.html"
} |
Using well-known trigonometry identities, the above reduces to:
$1 = 1 + (x_2)^2 \left(\dfrac{1}{\sin^2(t)} \right) - 2x_2 \left( \dfrac{1}{\sin(t)} \right)$
$0 = (x_2)^2 \left( \dfrac{1}{\sin^2(t)} \right) - 2x_2 \left( \dfrac{1}{\sin(t)} \right)$
$0 = x_2 \left( \dfrac{x_2}{\sin^2(t)} - 2\dfrac{1}{\sin(t)} \right)$
Ignoring the trivial solution, we find that x2 is equal to:
$x_2 = 2\sin(t)$
And solving for y2 yields:
$y_2 = \dfrac{\cos(t)}{-\sin(t)}2\sin(t) + \cos(t) = -\cos(t)$
Hence, the point in parametric form is:
$(2\sin(t), - \cos(t))$
We would like to identify what curve these parametric equations will trace. This is equivalent to solving the follow 2 equations in terms of x and y only:
$x = 2\sin(t)$
$y = -\cos(t)$
By squaring both sides of both equations, we get the following:
$x^2 + 4y^2 = 4\sin^2(t) + 4\cos^2(t) = 4$
$x^2 + 4y^2 = 4$
$\dfrac{x^2}{4} + \dfrac{y^2}{1} = 1$ | {
"domain": "wordpress.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9850429147241161,
"lm_q1q2_score": 0.8292343833947299,
"lm_q2_score": 0.8418256412990657,
"openwebmath_perplexity": 342.26479036699277,
"openwebmath_score": 0.6682217121124268,
"tags": null,
"url": "http://themathbehindthemagic.wordpress.com/"
} |
02 Mar 2016, 03:32
1
KUDOS
Expert's post
Nez wrote:
GMAT_700 wrote: | {
"domain": "gmatclub.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9407897525789548,
"lm_q1q2_score": 0.8105263205602512,
"lm_q2_score": 0.861538211208597,
"openwebmath_perplexity": 2864.7312206498873,
"openwebmath_score": 0.6457872986793518,
"tags": null,
"url": "https://gmatclub.com/forum/the-price-of-lunch-for-15-people-was-207-including-a-68537-20.html?sort_by_oldest=true"
} |
ros, pcl, tutorial, camera, ros-fuerte
Originally posted by Loufis with karma: 28 on 2013-08-06
This answer was ACCEPTED on the original site
Post score: 1
Original comments
Comment by Loufis on 2013-08-06:
For future problems, a very helpful way of debugging in ros is using rqt_graph, it helps you understand what exactly is happening in the background (is the program subscribed correctly to all the inputs? does it publish everything correctly? if using a series of nodes, where do they stop working? etc...) | {
"domain": "robotics.stackexchange",
"id": 15184,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, pcl, tutorial, camera, ros-fuerte",
"url": null
} |
javascript, performance, beginner, game, canvas
Title: 2D Gravity Simulator-like game This project is pretty much like a 2D gravity simulator. You click and it creates a circle that attracts other circles. The result of a collision is a bigger circle that is a sum of the masses. If you don't know what I'm talking about, here's a gif: | {
"domain": "codereview.stackexchange",
"id": 15652,
"lm_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, performance, beginner, game, canvas",
"url": null
} |
energy-conservation, hydrogen, energy-storage
Title: Benefit of Hydrogen Electrolysis I was considering building a simple solar hydrogen generator for fun and it led me to the question
Does the hydrogen produced have more potential energy than the electricity used to get it?
Obvious answer here is no. Supported by this article I found that says it has about 80% the energy
Which then brought me to the natural next question.... Why?
Why extract hydrogen energy through electrolysis if we already have the electricity and we can store it in a battery?
So that's my question now.
What is the benefit of using hydrogen instead of electricity specifically for energy storage and usage? Hydrogen has a much higher energy storage density than Li ion batteries being both lighter and occupying a smaller volume. This is the motivating factor behind hydrogen energy storage and usage. | {
"domain": "physics.stackexchange",
"id": 88226,
"lm_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-conservation, hydrogen, energy-storage",
"url": null
} |
nextflow
tag { sample }
debug true
input:
tuple val(sample), path(reads)
path fasta
path gtf
script:
def (r1, r2) = reads
"""
ls -g "${r1}"
ls -g "${r2}"
ls -g "${fasta}"
ls -g "${gtf}"
"""
}
And the updated workflow:
workflow {
read_pairs_ch = Channel.fromFilePairs( params.reads, checkIfExists:true )
transcriptome = file( params.transcriptome_file )
gtf = file( params.gtf_file )
TRIM( read_pairs_ch )
ALIGN( TRIM.out.trimmed_fastqs, transcriptome, gtf )
} | {
"domain": "bioinformatics.stackexchange",
"id": 2332,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "nextflow",
"url": null
} |
algorithms, formal-languages, automata, finite-automata
The second algorithm seems to me to be a much better candidate as it uses only $2n$ states and thus a much simpler transition function is needed, but yet again I've hit the brick wall which is describing this algorithm formally and showing the equality between the language of the new $B$ automaton and $A$'s language.
How can I show this equality? and how should I describe the algorithm so it will be formally acceptable? Your second construction seems to work well.
This can be formalized by starting with the formal definion of an automaton and specifying the components of the new one.
So for $\mathcal A=(Q,\Sigma,\delta,q_{in},F)$ construct a new automaton $\mathcal A'=(Q',\Sigma,\delta',q'_{in},F')$. | {
"domain": "cs.stackexchange",
"id": 19738,
"lm_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, formal-languages, automata, finite-automata",
"url": null
} |
go, math-expression-eval
stack.go
package stack
type Stack struct {
i int
// fixed size
data [100]int
}
func (s *Stack) Push(i int) {
if(s.i + 1 >= len(s.data)){
panic("Out of memory!")
}
s.data[s.i] = i
s.i++
}
func (s *Stack) Pop() int {
if(s.i - 1 < 0){
panic("Can't pop when there is no data!")
}
s.i--
return s.data[s.i]
}
func (s *Stack) Size() int {
return s.i
}
stack_test.go
Not very proud of this. Is there any way I can reduce the duplicated code? Are there any built in assert methods?
package stack
import (
"testing"
)
func TestStack(t *testing.T) {
s := new(Stack)
if(s.Size() != 0) {
t.Fail()
}
s.Push(1)
if(s.Size() != 1) {
t.Fail()
}
s.Push(2)
if(s.Size() != 2) {
t.Fail()
}
s.Push(3)
if(s.Size() != 3) {
t.Fail()
}
if(s.Pop() != 3) {
t.Log("Didn't pop in order!")
t.Fail()
} | {
"domain": "codereview.stackexchange",
"id": 12662,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "go, math-expression-eval",
"url": null
} |
c#, beginner, winforms
else if (!diningCheckBox.Checked && fitnessCheckBox.Checked && !excursionsCheckBox.Checked && !airportCheckBox.Checked)
{
titlesListBox.Items.Add("Fitness Trainer");
valueListBox.Items.Add(fitnesstrainer);
}
else if (!diningCheckBox.Checked && !fitnessCheckBox.Checked && excursionsCheckBox.Checked && airportCheckBox.Checked)
{
titlesListBox.Items.Add("Excursions, Airport Transfer");
valueListBox.Items.Add(excursions + airporttransfer);
}
else if (!diningCheckBox.Checked && !fitnessCheckBox.Checked && excursionsCheckBox.Checked && !airportCheckBox.Checked)
{
titlesListBox.Items.Add("Excursions");
valueListBox.Items.Add(excursions);
}
else if (!diningCheckBox.Checked && !fitnessCheckBox.Checked && !excursionsCheckBox.Checked && airportCheckBox.Checked)
{
titlesListBox.Items.Add("Airport Transfer"); | {
"domain": "codereview.stackexchange",
"id": 18243,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, beginner, winforms",
"url": null
} |
neural-networks
Title: How does pre-training help with semantic segmentation with U-net I am working with a u-net, a variation of the more commonly known fully convolutional network for semantic segmentation. For training a u-net, I was given the suggestion that I should use a pre-trained network. But, I'm not quite sure how this makes sense.
My understanding is, in pre-training, we freeze the network up to the final classifying layers from a pre-trained network and then, we initialize random weights for the classifying layers. Then, we take our new dataset and retrain the weights through the whole network. Basically, we don't have random initialized weights for the convolutional blocks. | {
"domain": "cs.stackexchange",
"id": 21127,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "neural-networks",
"url": null
} |
algorithms, formal-languages, turing-machines, enumeration
No duplicate instances are generated. SUBSET-SUM instances can be encoded in base 3. We have codes for $0,1,\#$. Some codings are invalid, but in that case we can just immediately output $\#\#$ (or $\#$, if we have just written $\#$). Every SUBSET-SUM problem has infinitely many encodings, I hope that's not a problem.
If the input has length $\ell$, then (assuming the tape alphabet has at least 4 symbols) we can do the conversion in time $O(\ell^2)$. I don't know whether this is the "best" time complexity achievable.
Edit: Here is a better encoding. We still have only three input codes, $0,1,\#$. The output string always starts with $1$ and ends with $\#\#$. Further, $\#$ is output as $\#1$. Now each output string is generated once, though several output strings could correspond to the same instance.
As an example, your instance is encoded by "00#0#". | {
"domain": "cs.stackexchange",
"id": 523,
"lm_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, formal-languages, turing-machines, enumeration",
"url": null
} |
Tussle Analysis for Information-Centric Networking Architectures. MIT students may choose to take one of three versions of Real. Guti errez September 14, 2009 1. ALL NOTES IN ONE FILE (huge) (1. =⇒ - implies. Evan Chen posted some notes on his website from when he took analysis at Berkeley with Pugh. The book’s material has been extensively classroom tested in the author’s. A purchase analysis will appear showing you in details the major features concerning that area. ~D = h1, 2, 4, 8, 16, 32, 64, 128,i Term in the doubling sequence form the basis for the binary. (b) Does the result in (a) remain true if fn → f pointwise instead of uni-. Download books for free. Supports open access. The book can also serve as a foundation for an in-depth study of real analysis giveninbookssuchas[4,33,34,53. FREE AND BOUND VARIABLES 3 make this explicit in each formula. Here is one where the pdf filenames are cleaner, and all editions are preserved as 1. Real Analysis by Gerald B. Send-to-Kindle or | {
"domain": "icscaponnetto.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9843363485313247,
"lm_q1q2_score": 0.8202716852162337,
"lm_q2_score": 0.8333245911726382,
"openwebmath_perplexity": 1089.603905556381,
"openwebmath_score": 0.4706494212150574,
"tags": null,
"url": "http://rvic.icscaponnetto.it/real-analysis-pdf.html"
} |
newtonian-mechanics, fluid-dynamics, drag, aerodynamics
What is the actual relationship between the radius of a sphere and its drag coefficient? should it be deduced from the drag force equation or from the relationship between Reynolds number and drag coefficient? FIRST EQUATION
You cannot obtain a graph of $C_D$ vs $r$ by holding the drag force constant, because the drag force increases with increasing r.
$C_D$ is generally assumed to be a constant, at least over a certain range of values (hence the name drag coefficient). This shows that over a range where C_D is relatively constant, drag force is proportional to cross-sectional area. That’s how the first equation would normally be used: you find or look-up a reasonable C_D for your situation and plug it into the equation with the other values to estimate the drag force (also called the drag). | {
"domain": "physics.stackexchange",
"id": 90131,
"lm_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, fluid-dynamics, drag, aerodynamics",
"url": null
} |
7. Apr 24, 2016
### haruspex
Agreed.
8. Apr 25, 2016
### Biker
The way I solved it is very similar.
Assume that you place them in one line and you have 3 brackets (To divide it into 4 groups) So you pretty much have 13 places to place the brackets... However, I cant place them at both ends because it has to have 1 for each group. So 13-2 = 11
Now choose 3 places from 11
By
11c3
Last edited: Apr 25, 2016 | {
"domain": "physicsforums.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9830850852465429,
"lm_q1q2_score": 0.8105162231744399,
"lm_q2_score": 0.8244619263765707,
"openwebmath_perplexity": 793.4484100114272,
"openwebmath_score": 0.6147191524505615,
"tags": null,
"url": "https://www.physicsforums.com/threads/how-many-ways-can-12-balls-be-arranged-into-4-different-rows.868490/"
} |
python, performance, algorithm, programming-challenge, graph
while Q: #while Q is not empty
start = Q.pop()#remove a node from Q
L.append(start) #add n to tail of L
logging.debug(f"L: {L}")
for v in graph[start]:#for each node v with a edge e
in_degrees[v] -= 1 #remove edge
if in_degrees[v] == 0:
Q.append(v)
logging.debug(f"indegree: {in_degrees}")
#check there exist a cycle
for i in range(len(in_degrees)): #if graph has edge
if in_degrees[i] > 0:
return []
logging.debug(f"L: {L}")
return L
TestCase:
class MyCase(unittest.TestCase):
def setUp(self):
self.solution1 = Solution()
self.solution2 = Solution2() | {
"domain": "codereview.stackexchange",
"id": 34048,
"lm_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, programming-challenge, graph",
"url": null
} |
optics, diffraction
You do not see the pattern anymore, just see the bright spot with some blur around it. That is my guess for what is happening in your case. | {
"domain": "physics.stackexchange",
"id": 40559,
"lm_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, diffraction",
"url": null
} |
the-moon, planet, comets
"When I ask Senior Astronomers in the U.S. who specialize in Planetary Evolution to review the concept, they personally insult me for even asking rather than employ any scientific theory or scientific methods to evaluate it."
You're insulting them, by asking them to justify why the work they base their livelihood upon isn't a load of rubbish.
You cannot justifiably criticize an accepted scientific theory without coming up with an equally plausible idea (unless you manage to prove that something is wrong). And unless someone does come up with a better idea, the nebular theory will continue to expand and evolve to better match our observations. That is the scientific process. | {
"domain": "astronomy.stackexchange",
"id": 101,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "the-moon, planet, comets",
"url": null
} |
electromagnetism, momentum, potential
Firstly, let's start with (16). On the RHS, the dot product of velocity with $v$ x $B$ is zero, and only the first term remains. To arrive at (18) from (16), I added the time derivative of $q\phi$ on both sides - the LHS is now what is desired, so manipulation on RHS should yield the RHS of (18); and this is where I'm stuck. How should I take it from here? Please help! A detailed explanation would be great. I'm using Griffiths as the text for my E&M course, and I am only familiar with the level of vector calculus used in the book, and that is probably why I'm stuck where I am.
Also, I need help deriving (19) (trust me, I tried). | {
"domain": "physics.stackexchange",
"id": 61402,
"lm_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, momentum, potential",
"url": null
} |
Definition of Infinite set in the Definitions.net dictionary. In this way, we say that infinite sets are either countable or uncountable. We can have infinite sets for example {1, 2, 3, …}, meaning that the set has an infinite number of elements. 2) The set of all whole numbers less than 20. But when Cantor applied the device of the one-to-one correspondence (e.g., {a, b, c} to {1, 2, 3}) to… 1) The set of all positive even numbers. You get a set twice as large. What does Infinite set mean? Teacher Training for Campus.2104 Release. If the set is non-empty, it is called a non-empty finite set. The cardinality of a set is denoted by $|A|$. Uncountable Uncountably Infinite. B = {3, 5, 7, 9, 11} = Set of odd numbers less than 12. A = {x : x is a natural number}; There are infinite natural numbers. – user142019 Dec 31 '11 at 21:22 @WTP Considering he needs that for an Dijkstra's algorithm implementation, I doubt that would be necessary. If true, the infinite scroll will be hidden and scroll | {
"domain": "freshface.net",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9780517456453798,
"lm_q1q2_score": 0.82737548322316,
"lm_q2_score": 0.8459424431344437,
"openwebmath_perplexity": 417.22945825059145,
"openwebmath_score": 0.7496109008789062,
"tags": null,
"url": "http://switcher.freshface.net/qr8m71xm/1788b5-infinite-set-example"
} |
homework-and-exercises, potential, vector-fields
If anyone can provide a resource that goes through a similar problem, that may be all I need to set this problem to rest and come up with my own solution to this problem. Too long for a comment:
$$
\mathbf{F}=\begin{pmatrix}x^2\\3xz^2\\-2xz\end{pmatrix}\,,
\quad \mathbf{A}=\int_0^1t\,\mathbf{F}(t\,\mathbf{x})\,dt\times\mathbf{x}
$$
solves $\mathbf{F}=\nabla\times\mathbf{A}$ (albeit not uniquely) and gives
\begin{align}
\boldsymbol{A}&=\int_0^1\begin{pmatrix}t^3x^2\\3t^4xz^2\\-2t^3xz\end{pmatrix}\,dt\times
\begin{pmatrix}x\\y\\z\end{pmatrix}
=\begin{pmatrix}x^2/4\\3xz^2/5\\-xz/2\end{pmatrix}\times
\begin{pmatrix}x\\y\\z\end{pmatrix}=
\begin{pmatrix}3xz^3/5+xyz/2\\-x^2z/2-x^2z/4\\x^2y/4-3x^2z^2/5\end{pmatrix}\\
&=\frac{x}{20}\begin{pmatrix}12z^3+10yz\\-15xz\\5xy-12xz^2\end{pmatrix}\,.
\end{align} | {
"domain": "physics.stackexchange",
"id": 96054,
"lm_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, potential, vector-fields",
"url": null
} |
python, python-3.x, gui, pyqt
def upload_vid(self):
pass
def upload_folder(self):
"""
Add images of a folder to the right photo list.
Return:
None
"""
file_dialog = QFileDialog()
folder_name = file_dialog.getExistingDirectory()
if folder_name:
for file_name in os.listdir(folder_name):
if not file_name.startswith('.'):
photo_name = file_name.split('/')[-1]
self.add_to_list(photo_name, self.right_widgets['Photo List'])
self.images.append(f'{folder_name}/{file_name}')
self.image_paths[file_name] = folder_name
def switch_editor(self, image_area):
"""
Switch between the display/edit interfaces.
Args:
image_area: RegularImageArea or ImageEditorArea object. | {
"domain": "codereview.stackexchange",
"id": 37586,
"lm_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, gui, pyqt",
"url": null
} |
determinant , inverses, rank, characteristic polynomial , eigenvalues and eigenvectors. Zaboikin, Michail; Freter, Carl. It is similar and simpler than Gauss Elimination Method as we have to perform 2 different process in Gauss Elimination Method i. Spring 2015 Lecture: T/TH 2:40-3:55PM, Hicks 211 Lab: W 1:15PM-4:00PM, Hicks 212. CS Topics covered : Greedy Algorithms. Before any LightPipes commands the LightPipes package must be imported in your Python script. array(A, dtype=np. Gauss Elimination Method Tutorial - Part 1:. and increases rapidly with s; the number of parameters equals 2, 20, and 65, respectively, when s =1,5, and 10. This method for solving a pair of simultaneous linear equations reduces one equation to one that has only a single variable. $\begingroup$ a univariate gaussian, not mixture gaussian $\endgroup$ – user22062 Nov 12 '13 at 5:27 $\begingroup$ multivariate is not the same as mixture. The item can be numbers, strings, dictionaries, another list, and so on. The | {
"domain": "paroleoggi.it",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9626731158685838,
"lm_q1q2_score": 0.8063542219668822,
"lm_q2_score": 0.8376199653600371,
"openwebmath_perplexity": 914.3769312757073,
"openwebmath_score": 0.4277817904949188,
"tags": null,
"url": "http://paroleoggi.it/gaussian-elimination-python-code.html"
} |
In general a circle with center $(h,k)$ and radius $r$ can be expressed as:
$$(x-h)^2+(y-k)^2=r^2$$
In the case of our questions, you have $(h,k)=(-1,4)$ in the above equation. You can then substitute $(-3,2)$ for $(x,y)$ to find $r$.
-
Well you should know (or look up in your textbook) that a circle is described by the equation $(x - x_0)^2 + (y - y_0)^2 = r^2$ where $(x_0, y_0)$ is the center and $r$ is the radius. So you see your circle should be $(x +1)^2 + (y - 4)^2 = r^2$. The only thing missing is $r^2$. But the problem tells you (3, -2) is a point on the circle. So plugging this into your equation, you will find your answer.
-
The equation of a circle with center $(a,b)$ and radius $r$ is $$(x-a)^2 + (y-b)^2 = r^2.$$ | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9805806484125338,
"lm_q1q2_score": 0.8275072030052928,
"lm_q2_score": 0.8438950986284991,
"openwebmath_perplexity": 145.2418516715856,
"openwebmath_score": 0.8785850405693054,
"tags": null,
"url": "http://math.stackexchange.com/questions/95639/finding-an-equation-for-a-circle-given-its-center-and-a-point-through-which-it-p/95647"
} |
quantum-mechanics, homework-and-exercises, clifford-algebra
Title: How to prove $tr\{\sigma_1\sigma_2\sigma_3\}=\pm 2i$ with only using $\{\sigma_i,\sigma_j\}=2\delta_{ij}$ How to prove $tr\{\sigma_1\sigma_2\sigma_3\}=\pm 2i$ with only using $\{\sigma_i,\sigma_j\}=2\delta_{ij}$ and we cannot use the explict representation of Pauli matrices and cannot use $[\sigma_i,\sigma_j]=2i\epsilon_{ijk}\sigma_k$.
There is quantum mechanics homework to ask us prove $tr\{\sigma_i\sigma_j\sigma_k\}=2i \epsilon_{ijk}$ and all things we can only use is only $\{\sigma_i,\sigma_j\}=2\delta_{ij}$. I can prove the indeces $ijk$ is antisymmetric but cannot solve $tr\{\sigma_1\sigma_2\sigma_3\}=2i$ with only $\{\sigma_i,\sigma_j\}=2\delta_{ij}$.
Firstly, thanks to Valter Moretti's answer, this consequece is not correct in general. Because minus pauli matrices still satisfy the anticommutator relation but the trace of three is $-2i$ | {
"domain": "physics.stackexchange",
"id": 36277,
"lm_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, clifford-algebra",
"url": null
} |
catkin-make, catkin, ros-kinetic
When I use 'catkin_make' to build my workspace, everything works as expected and during the build process I see a message that says "Function Called".
However, when I use 'catkin build' to build my workspace, I get the following error message:
So with catkin_make, test_func() is defined (and declared) in the same build context, while with catkin_tools, test_func() only exists within the context in which function_maker is processed.
This leads to test_func() being an unknown symbol in the latter case, hence the error message.
How can I make this work with both build tools? | {
"domain": "robotics.stackexchange",
"id": 32848,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "catkin-make, catkin, ros-kinetic",
"url": null
} |
algorithms, time-complexity, algorithm-analysis, runtime-analysis, search-algorithms
Title: Iterative binary search analysis I'm a little bit confused about the analysis of binary search.
In almost every paper, the writer assumes that the array size $n$ is always $2^k$.
Well I truly understand that the time complexity becomes $\log(n)$ (worst case) under this assumption. But what if $n \neq 2^k$?
For example if $n=24$, then we have
5 iterations for 24
4 i. for 12
3 i. for 6
2 i. for 3
1 i. for 1
So how do we get the result $k=\log n$ in this example (I mean of course every similar example whereby $n\neq2^k$)? $n=2^k$ is a simplifying assumption that ensures binary search "goes through" properly. If the array has a length that is not a power of two, you have to break ties when choosing middle elements, "halves" are not equally large and not all decisions lead to the same number of steps. | {
"domain": "cs.stackexchange",
"id": 628,
"lm_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, time-complexity, algorithm-analysis, runtime-analysis, search-algorithms",
"url": null
} |
star, distances, light, speed
For further reading on other units used to measure far away objects you might be interested in reading this question on the parsec. | {
"domain": "astronomy.stackexchange",
"id": 1680,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "star, distances, light, speed",
"url": null
} |
luminosity, apparent-magnitude, atmospheric-effects, newtonian-telescope, dobsonian-telescope
The Pogson relation is given by:
$$m_1-m_2=-2.5\ log\ \left({\frac{E_1}{E_2}}\right)$$
where $m_1$ and $m_2$ are the magnitudes of star 1 and star 2 (your reference star), and $E_1$ and $E_2$ brightness (that could be in arbitrary units, which is a good news for you).
With a CCD detector the brightness is easy to determine since it's just the flux of a pixel. You don't have to convert it in physical units (as Watt per square meter) since you have a ratio $\left({\frac{E_1}{E_2}}\right)$, so the raw intensity is enough to determine the magnitude.
As for any other measurement with a CCD camera, you have of course to determine the bias, dark and flat-field and to reduce your data before estimating any magnitude. The precision will depend on the number of observations performed and, as always, it is better to perform several short exposure images than a single long exposure one. | {
"domain": "astronomy.stackexchange",
"id": 6550,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "luminosity, apparent-magnitude, atmospheric-effects, newtonian-telescope, dobsonian-telescope",
"url": null
} |
c++, c++11, multithreading, template, queue
std::cout << "TEST Multi-push-overflow: " << (TEST_multi_push_overflow() ? "PASS" : "FAIL") << std::endl << std::endl;
std::cout << "TEST Try-Multi-push: " << (TEST_try_multi_push() ? "PASS" : "FAIL") << std::endl << std::endl;
std::cout << "TEST Try-Multi-push-overflow: " << (TEST_try_multi_push_overflow() ? "PASS" : "FAIL") << std::endl << std::endl;
std::cout << "TEST Try-multi-pop-overflow: " << (TEST_multi_pop() ? "PASS" : "FAIL") << std::endl << std::endl;
std::cout << "TEST Get_from_empty: " << (TEST_Get_From_Empty() ? "PASS" : "FAIL") << std::endl << std::endl;
std::cout << "TEST Peek: " << (TEST_peek() ? "PASS" : "FAIL") << std::endl << std::endl;
std::cout << "TEST Size: " << (TEST_size() ? "PASS" : "FAIL") << std::endl << std::endl;
std::cout << "TEST Capacity: " << (TEST_capacity() ? "PASS" : "FAIL") << std::endl << std::endl;
std::cout << "TEST ST Copy: " << (TEST_st_copy() ? "PASS" : "FAIL") << std::endl << std::endl; | {
"domain": "codereview.stackexchange",
"id": 25526,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, c++11, multithreading, template, queue",
"url": null
} |
electromagnetism, waveguide, normal-modes
Title: Real Electromagnetic Waveguide Modes in loss media Suppose a waveguide with 2 Perfect electric conductor at both boundaries. The waveguide is filled with a lossy media modelled with a conductivity $\sigma$.
Solving for the following Maxwell's equations (TE mode) :
\begin{eqnarray}
\mu \partial_t\tilde H_x &=& - \partial_y\tilde E_z \\
\mu \partial_t\tilde H_y &=& + \partial_x \tilde E_z \\
\epsilon \partial_t\tilde E_z + \sigma \tilde E_z &=& + \partial_x \tilde H_y - \partial_y\tilde H_x
\end{eqnarray}
one can find that a valid solution adopting a complex notation is:
\begin{eqnarray}\label{eq:ShapeComplexSol}
H_x &=& +jE_0\frac{k_y}{\omega\mu} \cos(k_yy) e^{j(\omega t - k_x x)}\\
H_y &=& - E_0\frac{k_x}{\omega\mu} \sin(k_yy) e^{j(\omega t - k_x x)}\\
E_z &=& + E_0 \sin(k_yy) e^{j(\omega t - k_x x)}
\end{eqnarray}
provided the dispersion relation :
\begin{equation}\label{eq:PECdispersion}
k_0^2n^2 = k_x^2 + k_y^2
~~\mbox{with}~~ | {
"domain": "physics.stackexchange",
"id": 35482,
"lm_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, waveguide, normal-modes",
"url": null
} |
ros, compile, ros-kinetic, rospack, cmake
In file included from /opt/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/7.2.1/arm-linux-gnueabihf/bits/os_defines.h:39:0,
from /opt/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/7.2.1/arm-linux-gnueabihf/bits/c++config.h:533,
from /opt/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/7.2.1/cstddef:49,
from /opt/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/include/boost/tr1/detail/config.hpp:9,
from /opt/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/include/boost/tr1/unordered_set.hpp:8,
from /home/user/Desktop/TCG4_ROS/ros_files_comm/src/rospack/include/rospack/rospack.h:108,
from /home/user/Desktop/TCG4_ROS/ros_files_comm/src/rospack/src/rospack.cpp:28: | {
"domain": "robotics.stackexchange",
"id": 32043,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, compile, ros-kinetic, rospack, cmake",
"url": null
} |
quantum-operation, kraus-representation
Title: Can any channel be written as $\Phi(X)=\operatorname{Tr}_{\mathcal Z}[U(X\otimes \sigma)U^\dagger]$ for any state $\sigma$? We know that every CPTP map $\Phi:\mathcal X\to\mathcal Y$ can be represented via an isometry $U:\mathcal X\otimes\mathcal Z\to\mathcal Y\otimes\mathcal Z$, as
$$\Phi(X) = \operatorname{Tr}_{\mathcal Z}[U(X\otimes E_{0,0})U^\dagger],\quad\text{where}\quad E_{a,b}\equiv \lvert a\rangle\!\langle b\rvert.\tag1$$
Showing this is quite easy e.g. from the Kraus representation.
If $A_a:\mathcal X\to\mathcal Y$ are Kraus operators for $\Phi$, then
$$U_{\alpha a,i0} \equiv \langle \alpha,a\rvert U\lvert i,0\rangle = \langle \alpha\rvert A_a\lvert i \rangle \equiv (A_a)_{\alpha,0}.\tag2$$
We can, of course, replace $E_{0,0}$ with any pure state in (1) without affecting the result.
This shows that, given any channel $\Phi$ and any pure state $\lvert\psi\rangle\in\mathcal Z$, we can represent $\Phi$ as in (1) (with $E_{0,0}\to\lvert\psi\rangle$). | {
"domain": "quantumcomputing.stackexchange",
"id": 1760,
"lm_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-operation, kraus-representation",
"url": null
} |
zoology, hybridization, artificial-selection, feline
computer (see here also), not just a set of instructions to build an organism) - think of the significant effects of simply having an extra copy of one chromosome in Down syndrome, or the fact that triploidy or quadruploidy are often tickets to the death of the human embryo (and so having half of your genome from two different animals could lead to an imbalance in the proteins required to develop normally). I'll be addressing mainly the feasibility of obtaining a hybrid at all; of course in order to become widespread a hybrid would need to be fertile (although see the sterile mule) which would require even more genetic similarity, specifically in order that the chromosomes from each parent can interact, they have to be similar enough that the proteins regulating this process will recognize them as homologous, and enable a process like chromosomal crossover to take place during the meiosis occurring in gametogenesis. | {
"domain": "biology.stackexchange",
"id": 6133,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "zoology, hybridization, artificial-selection, feline",
"url": null
} |
energy, schroedinger-equation, heisenberg-uncertainty-principle, hamiltonian, time-evolution
My guess is that this has something to do with the Heisenberg's relationship between energy and time:
$$ΔEΔt≥ℏ2$$
so the relationship seems to be similar to that between position and momentum, and I believe the commutator of position and momentum is iℏ which crops up in the time-independent Schrodinger equation. | {
"domain": "physics.stackexchange",
"id": 16255,
"lm_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, schroedinger-equation, heisenberg-uncertainty-principle, hamiltonian, time-evolution",
"url": null
} |
general-relativity, gravity, metric-tensor, notation, approximations
At first I thought that $\gamma_{\mu\nu}$ is just any other addition to the metric, but as I read along, I found that $\gamma_{\mu\nu}$ is used plenty of times, even while discussing the cosmological problem. Einstein, at one point also says that $\frac{\gamma_{44}}{2}$ can be identified as the gravitational potential. | {
"domain": "physics.stackexchange",
"id": 66674,
"lm_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, gravity, metric-tensor, notation, approximations",
"url": null
} |
javascript, css
body section #wrapper .r-active:before {
content: "";
margin-right: 100px;
position: absolute;
top: 50%;
transform: translateY(-50%);
height: 60%;
width: 100px;
border-top-left-radius: 25% 10%;
border-bottom-left-radius: 25% 10%;
background: radial-gradient(circle at 0% 53%, yellow 34%, #00bcd4 15%, rgba(238, 130, 238, 0) 100%);
filter: blur(10px);
z-index: 1;
mix-blend-mode: overlay;
transistion: 0.3s ease;
}
html section #wrapper .r-active:after,
body section #wrapper .r-active:after {
content: "";
margin-right: 250px;
position: absolute;
top: 50%;
transform: translateY(-50%);
height: 30%;
width: 200px;
border-top-left-radius: 25% 10%;
border-bottom-left-radius: 25% 10%;
background: radial-gradient(circle at 0% 53%, #ff00ef 34%, #005cd4 15%, rgba(238, 130, 238, 0) 100%);
filter: blur(20px);
z-index: 1;
mix-blend-mode: overlay;
transistion: 0.4s ease;
}
html section #wrapper .circle,
body section #wrapper .circle { | {
"domain": "codereview.stackexchange",
"id": 41932,
"lm_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, css",
"url": null
} |
program balls2
implicit none
integer i1,i2,i3,j1,j2,j3,j4
integer total, count
integer draw(12)
total = 0
count = 0
do i1=1,10
do i2=i1+1,11
do i3=i2+1,12
do j1=1,9
if(any(j1==[i1,i2,i3])) cycle
do j2=j1+1,10
if(any(j2==[i1,i2,i3])) cycle
do j3=j2+1,11
if(any(j3==[i1,i2,i3])) cycle
do j4=j3+1,12
if(any(j4==[i1,i2,i3])) cycle
total=total+1
draw = 0
draw([i1,i2,i3]) = 1
draw([j1,j2,j3,j4]) = 4
if(any(draw(1)+draw(2)==[1,4,5])) cycle
if(any(draw(3)+draw(4)==[0,2,8])) cycle
count = count+1
end do
end do
end do
end do
end do
end do
end do
write(*,*) total,count
end program balls2
Output was
27720 5628
Which is the same ratio.
Your probabilities you calculated for singular events are correct.
in general whenever answering a probability question the order needs to be taken into account as it increases the amount of ways to reach each pattern. To consider all possible often you can use: Combination wikipedia page | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.977022625406662,
"lm_q1q2_score": 0.8361859399555999,
"lm_q2_score": 0.8558511524823263,
"openwebmath_perplexity": 687.9557636367336,
"openwebmath_score": 0.8088433742523193,
"tags": null,
"url": "https://math.stackexchange.com/questions/2671839/what-is-the-probability-that-the-first-2-balls-are-the-same-color-while-the-last"
} |
homework-and-exercises, special-relativity, classical-mechanics, reference-frames
How does this differ from the usual length contraction? What is the meaning of the hint given by asking the reader to "observe" not "measure", what is the difference here? The difference between measurement and observation is crucial in relativity.
When we observe the rocket, the finite speed of light affects our observation. In general, light from the head and the tail of the rocket will take a different amount of time to travel to the observer.
When we measure the rocket, we compensate for time delays caused by the finite speed of light. So if we measure two events A & B to be simultaneous we will only observe A & B to be simultaneous if the distances to A & B are identical in our frame. | {
"domain": "physics.stackexchange",
"id": 68140,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homework-and-exercises, special-relativity, classical-mechanics, reference-frames",
"url": null
} |
organic-chemistry
Source: Strategic Applications Of Named Reactions. Wiley.
Looking at the mechanism (below), we first have a rate-determining loss of water via protonation-elimination. This generates the all important cationic intermediate.
The simple answer to your question is that rearrangement occurs faster than epoxidation (which is never observed to any significant extent), this is intuitive if we consider that:
Under the acidic conditions, the alcohol required to form the epoxide is fully protonated, and hence not a very good nucleophile (in agreement with R-OH generally being a poor nucleophile except in basic conditions where we get the anionic alkoxide RO(-)
The migration generates a more stabilised carbocation by the influence of the oxygen LP donating into the carbocation to form the resulting ketone.
Source: Strategic Applications Of Named Reactions. Wiley. | {
"domain": "chemistry.stackexchange",
"id": 4911,
"lm_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",
"url": null
} |
beginner, r, stackexchange
Title: Plot daily time spent on codereview.stackexchange.com This draws an xyplot from csv data obtained from RescueTime API for activity time for "http://codereview.stackexchange.com".
# -------------------------------------------------------
# PLOT TIME SPENT ON CODEREVIEW SE
# USING RESCUE TIME API AND R
# -------------------------------------------------------
# -------------------------------------------------------
# LIBRARIES
if(!require("RCurl")){
install.packages("RCurl")
}
if(!require("lattice")){
install.packages("lattice")
}
require("RCurl")
require("lattice")
# -------------------------------------------------------
print("Initializing...")
# -------------------------------------------------------
# RESCUE TIME API ACCESS
# api key
# get from https://www.rescuetime.com/anapi/manage
api_key <- "..."
# query from date
from_date <- "2014-01-01"
# query to date
to_date <- format(Sys.Date(), "%Y-%m-%d") | {
"domain": "codereview.stackexchange",
"id": 9815,
"lm_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, r, stackexchange",
"url": null
} |
python
# key is four ascii chars long so we will iterate through data 4-char chunk at a time | {
"domain": "codereview.stackexchange",
"id": 15045,
"lm_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
} |
beginner, programming-challenge, haskell, checksum
doubleEveryOther: It's very good to see that you employ both map and zip here, but since you also need to write a manually recursive helper function, doubleAtEvenIndex, the effort seems a bit lost. Here's how I'd do it using explicit recursion only:
doubleEveryOther :: [Integer] -> [Integer]
doubleEveryOther (x:y:xs) = x : y*2 : doubleEveryOther xs
doubleEveryOther xs = xs
With pattern matching you can match arbitrarily deep into a data type, so for lists, you can match lists with at least two elements. The fallback pattern xs matches both lists of one and zero elements.
How might a higher-order solution look like? You're already using zip and map, but rather than zipping the indices [1..] you could also zip the factors [1,2,1,2,...]:
> zip [1,2,3,4,5] [1,2,1,2,1]
[(1,1),(2,2),(3,1),(4,2),(5,1)]
and then map (\(x,y) -> x * y) the result:
> map (\(x,y) -> x * y) (zip [1,2,3,4,5] [1,2,1,2,1])
[(1 * 1),(2 * 2),(3 * 1),(4 * 2),(5 * 1)]
= [1,4,3,8,5] | {
"domain": "codereview.stackexchange",
"id": 42935,
"lm_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, programming-challenge, haskell, checksum",
"url": null
} |
newtonian-gravity, gauss-law
Title: Gauss's law: divergence and mass density I'm watching Leonard Susskind's lectures on relativity (http://www.youtube.com/watch?v=s8UrYIZhm60&feature=youtu.be&t=31m08s), and he just introduced Gauss's law on gravity, that is:
$$\vec\nabla \cdot \vec A = -4\pi G \rho$$
To my understanding, this says that divergence at point $(x,y,z)$ is non-zero only if there is mass at that point, i.e. $\rho(x,y,z) \ne 0$.
However, this seems in conflict with the idea of divergence that I got from the definition. If $\vec A(x,y,z)$ is non-zero, and the vector field around $(x,y,z)$ is not constant, then the sum of the partial derivatives will be non-zero, regardless of whether there is any mass at $(x,y,z)$. | {
"domain": "physics.stackexchange",
"id": 35861,
"lm_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-gravity, gauss-law",
"url": null
} |
relativity, reference-frames, coordinate-systems, degrees-of-freedom
Title: Degrees of freedom in the infinite momentum frame Lenny Susskind explains in this video at about 40min, as an extended object (for example a relativistic string) is boosted to the infinite momentum frame (sometimes called light cone frame), it has no non-relativistic degrees of freedom in the boost direction. Instead, these degrees of freedom are completely determined by the (non-relativistic) motions in the plane perpendicular to the boost direction.
I dont see why this is, so can somebody explain to me how the degrees of freedom are described in this infinite momentum frame? Without seeing the quote/context I can only imagine that it means something like: if you take, say, a cube moving at close to c in the z direction, then (in the frame in which it's moving) its z extent gets Lorentz contracted to virtually zero, so it is effectively now a square in the xy plane and has only the degrees of freedom that a square in the xy plane has. | {
"domain": "physics.stackexchange",
"id": 5791,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "relativity, reference-frames, coordinate-systems, degrees-of-freedom",
"url": null
} |
c++, c++11, variant-type
Title: C++11 Any class This is a polymorphic wrapper capable of holding any type. (It is loosely based on boost::any)
In particular, this is useful when you want to store a heterogeneous collection, such as vector<Any>.
Synopsis
string s = ...;
int i = ...;
Any a1 = s;
Any a2 = i;
int j = a2; // ok j now equals i
string t = a1; // ok t now equals s
int k = a1; // runtime exception bad_cast
vector<Any> v;
v.push_back("foo");
v.push_back(42);
const char* s = v[0];
int l = v[1];
Implementation
#include <type_traits>
#include <utility>
#include <typeinfo>
#include <string>
#include <cassert>
using namespace std;
template<class T>
using StorageType = typename decay<typename remove_reference<T>::type>::type;
struct Any
{
bool is_null() const { return !ptr; }
bool not_null() const { return ptr; }
template<typename U> Any(U&& value)
: ptr(new Derived<StorageType<U>>(forward<U>(value)))
{
} | {
"domain": "codereview.stackexchange",
"id": 13102,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, c++11, variant-type",
"url": null
} |
For the 9th question we have to take 3 cases
1) where only one of each letter is chosen = 6C3 ways = 15 ways
2) Where either 2 E's or 2N's are chosen = 2 * 5C2 = 20 ways
3) Where 2 E's and 2 N's are chosen = 1 way
for the second question I think we should count 1, as there is no reason for not counting it and hence the answer should be p-1 only.
Shoot ... good catch on Q8. I forgot about the 1.
Can you explain why the (x+3)C3 for Q5?
Thanks for the explanations .. they were very helpful.
no i think 1 has to be counted. What is the OA?
Manager
Joined: 08 Oct 2009
Posts: 60
Re: NEW SET of good PS(3) [#permalink]
### Show Tags
21 Oct 2009, 11:26
rohit,
agreed 1 has to be counted. i read the question a second time and it made sense. I shall defer to Bunuel for OA's.
Math Expert
Joined: 02 Sep 2009
Posts: 44412
Re: NEW SET of good PS(3) [#permalink]
### Show Tags
23 Oct 2009, 18:40
Expert's post
1
This post was
BOOKMARKED | {
"domain": "gmatclub.com",
"id": null,
"lm_label": "1. Yes\n2. Yes\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 1,
"lm_q1q2_score": 0.8198933425148213,
"lm_q2_score": 0.8198933425148213,
"openwebmath_perplexity": 1341.3597371252881,
"openwebmath_score": 0.6643107533454895,
"tags": null,
"url": "https://gmatclub.com/forum/new-set-of-good-ps-85440.html"
} |
c#, entity-framework, automapper
using (SqlConnection sqlConnection = new SqlConnection(ConnectionString))
{
sqlConnection.Open();
using (SqlCommand sqlCommand = sqlConnection.CreateCommand())
{
sqlCommand.CommandText = string.Format(FormatString_Query, FormatString_Parameters);
sqlCommand.CommandType = CommandType.Text;
SqlDataAdapter sqlAdapter = new SqlDataAdapter(sqlCommand);
sqlAdapter.Fill(result);
}
}
return result;
}
catch
{
return new DataTable();
}
} | {
"domain": "codereview.stackexchange",
"id": 11642,
"lm_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#, entity-framework, automapper",
"url": null
} |
python, beginner, tic-tac-toe
user_input = input()
user_input = user_input.upper()
#if blank input
if user_input == '':
#exit program
print('Exiting program.')
sys.exit()
#if input is in acceptable input
if(user_input in acceptable_input_array):
valid_input = True
else:
print('Incorrect Input')
return user_input | {
"domain": "codereview.stackexchange",
"id": 42748,
"lm_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, tic-tac-toe",
"url": null
} |
c++, algorithm, programming-challenge, c++14
tracker[j] = tracker[j-1];
--roomcount;
} else if (tracker[j] < tracker[j-1]) {
// set all contiguous areas to the left
for (auto k{j-1}; k; --k) {
if (tracker[k]) {
tracker[k] = tracker[j];
} else {
break;
}
}
--roomcount;
}
}
} else {
// continuation from left?
if (j && tracker[j-1]) {
tracker[j] = tracker[j-1];
} else {
tracker[j] = ++roomcount;
}
}
} else {
tracker[j] = 0;
}
} | {
"domain": "codereview.stackexchange",
"id": 31361,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, algorithm, programming-challenge, c++14",
"url": null
} |
gsGaussRule (index_t numNodes, const unsigned digits=0) Initialize a 1D Gauss quadrature rule with numNodes. Tabulated weights and abscissae with Mathematica source code, high precision (16 and 256 decimal places) Legendre-Gaussian quadrature weights and abscissas, for n=2 through n=64, with Mathematica. Gauss-Legendre quadrature method (we explain and use this method to solve valuation problems in our CFE classes); Gauss-Laguerre quadrature method. Computational Physics Lectures: Numerical integration, from Newton-Cotes quadrature to Gaussian quadrature. Principal method in this module is integrate(). I haven't used. (a)Show that if the interior nodes x 1;:::;n 1 in the quadrature are given by the roots of p0 n (x) where p. MakeGridGLQC: Create a 2D complex map from a set of complex spherical harmonic coefficients sampled on a the Gauss-Legendre quadrature nodes. Stieltjes in 1894, without though making any reference to quadrature. (2014) +A+A Legendre A. Okay I know this has been | {
"domain": "teckspace.de",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.984810947625669,
"lm_q1q2_score": 0.8119391267485825,
"lm_q2_score": 0.8244619220634457,
"openwebmath_perplexity": 878.0046815432065,
"openwebmath_score": 0.7859308123588562,
"tags": null,
"url": "http://ilfq.teckspace.de/gauss-legendre-quadrature-example.html"
} |
roslaunch
Originally posted by barryjobrien on ROS Answers with karma: 21 on 2015-11-13
Post score: 2
Original comments
Comment by emrainey on 2016-03-11:
Great Question. I'm curious to know the answer too! None of the above seem to work as well as I would like.
I did find something that works! You have to configure your node launch XML to indicate that the nodelet which will call exit(x) is required. Then when it detects a failure, it will kill the entire launch file.
<node pkg.... required="true">
...
</node>
then inside nodelet you can call "exit(err);" with some error in err. Well I did the following incase there's some other path:
ros::shutdown();
raise(SIGINT);
raise(SIGABRT);
exit(-1);
I really want it to exit.
Originally posted by emrainey with karma: 26 on 2016-03-11
This answer was ACCEPTED on the original site
Post score: 1 | {
"domain": "robotics.stackexchange",
"id": 22982,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "roslaunch",
"url": null
} |
algorithms
Title: Ball Break Point Problem I came across following question:
There is a building with N floors. We have a balls of same property and have a breaking point of X floor. i.e, If ball dropped from X+1 floor then the ball will break. if ball is dropped from X or less than X then it wont break. Now design an algorithm to find X if N is given.
My Solution:
Drop the ball from N/2 floor. If ball breaks then X < N/2. Else X > N/2. Repeat this process till X is found.
but If X is N/2+1 or N/2-1 the number of steps to find X are high.
Is there a better way to Find X? This is the best way to Find $X$. Your algorithm is basically binary search, which is optimal in terms of comparisons.
Let $T(N)$ be the number of ball-drops required in a building with $N$ floors to find $X$.
\begin{align}
T(1) = & 0 & \text{(no balldrop with one floor)}\\
T(N) = & T(\frac{N}{2}) + 1& \text{(drop ball once, repeat on upper/lower half)} \\
= & T(0) + 1 + \ldots + 1 \in \mathcal{O}(\log n)
\end{align} | {
"domain": "cs.stackexchange",
"id": 2076,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "algorithms",
"url": null
} |
ds.algorithms, approximation-algorithms
Time. The binary search requires $O(\log n)$ iterations, and each iteration (checking bipartiteness) can be done in $O(n^2)$ time, so the algorithm takes $O(n^2\log n)$ time.
Performance guarantee. Clearly the algorithm returns a solution of value $r$. We'll show that the optimal solution has value at least $r/2$.
Let $(C^*, V\setminus C^*)$ be an optimal solution, of value $r^*$. Consider the graph $G_{2r^*}$ as defined in the algorithm above. Within each cluster of the optimal solution, each point is at distance at most $r^*$ from its center, so all pairs of points within the cluster have distance at most $2r^*$. Also, no pairs of points within either cluster are forbidden. It follows that no edge in $G_{2r^*}$ is contained in $C^*$ or in $V\setminus C^*$, so that $(C^*, V\setminus C^*)$ is a bipartition of $G_{2r^*}$. So
$G_{2r^*}$ is bipartite. So, by the choice of $r$, $2r^* \ge r$. That is, $r\le r^*/2$. $~~~\Box$ | {
"domain": "cstheory.stackexchange",
"id": 5356,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ds.algorithms, approximation-algorithms",
"url": null
} |
kinect, openni
context.enableUser(SimpleOpenNI.SKEL_PROFILE_ALL);
background(200,0,0);
stroke(0,0,255);
strokeWeight(3);
smooth();
// create a window the size of the depth information
size(context.depthWidth(), context.depthHeight());
}
void draw()
{
// update the camera
context.update();
// draw depth image
image(context.depthImage(),0,0); | {
"domain": "robotics.stackexchange",
"id": 13802,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "kinect, openni",
"url": null
} |
thermodynamics, classical-mechanics, temperature, ideal-gas, kinetic-theory
EDIT (12/31/2016): The relationship between kinetic energy and temperature for classical systems in thermal equilibrium holds no matter what interaction potential. See, e.g., math.nyu.edu/~cai/Courses/MathPhys/Lecture3.pdf : "For example, the Hamiltonian for interacting gas particles is...where $U(\vec{r_i}−\vec{r_j})$ is the potential energy between any two particles. The equipartition theorem tells us that the average kinetic energy is $\frac{3}{2}k_B T$ for every particle (since there are three translational degrees of freedom for each particle)." See also the derivation there (at the beginning): | {
"domain": "physics.stackexchange",
"id": 36435,
"lm_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, classical-mechanics, temperature, ideal-gas, kinetic-theory",
"url": null
} |
c++, multithreading
Filled bucket with : 29
Filled: 30
----------
Leaked bucket with leakRate
BucketFilledRemain: 10
----------
Leaked bucket with leakRate
BucketFilledRemain: 0 Avoid leading underscores in names
Some uses of underscores are reserved by the standard, I recommend just avoiding all leading underscores in names.
Also, why do only some member variables have a leading underscore? If you are going to use them, be consistent.
Add a newline at the end of each line
When printing, add the newline at the end of each line instead of at the start. This ensures whatever comes next (which might be an error message, or the shell's prompt if your program ends) starts on its own line.
Make use of std::min()
Instead of using a ternary expression, use std::min() if you want to limit some value. For example:
filled = std::min(filled + newDataSize, maxCapacity); | {
"domain": "codereview.stackexchange",
"id": 42762,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, multithreading",
"url": null
} |
II, and Leibniz slowly came to realize this do n't they waste electric?! Explore the Fundamental Theorem of Calculus is one of the derivative of a function with the third fundamental theorem of calculus of the Theorem. Curve y = 1/x, is perhaps the most important Theorem in Calculus if f is integrable on a! Reviews how to find a formula for the procedure much thought a professor should teach on Calculus want a to... A place to put the anti-derivatives Harvard University and is falling down, but the difference between its at. B ], then f is continous on [ a, b ], then is! Called fundamentals put the anti-derivatives gain even more insight into the meaning of the y... Lecture in the fifth week of our course, Analysis of a with... You think that evaluating areas under curves is a tedious process you are to! 500 years, new techniques emerged that provided scientists with the necessary tools to explain many.! They waste electric power realize this x in the fifth week of our course, Analysis | {
"domain": "grecotel.com",
"id": null,
"lm_label": "1. Yes\n2. Yes\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9914225125587971,
"lm_q1q2_score": 0.8982187047063709,
"lm_q2_score": 0.9059898210180105,
"openwebmath_perplexity": 578.4206299133635,
"openwebmath_score": 0.8412231802940369,
"tags": null,
"url": "http://dreams.grecotel.com/v1g8jvh/third-fundamental-theorem-of-calculus-0d5f9d"
} |
haskell, reinventing-the-wheel
The key to avoiding ++, I think, is to force yourself to write x: first, then figure out how to fill in everything surrounding it. The next logical step would be to write
| f x = x:filter' f xs
… and the rest should follow naturally.
Here's what I came up with for partition' (hover for spoiler):
partition' :: (a -> Bool) -> [a] -> ([a], [a])
partition' _ [] = ([], [])
partition' f (x:xs)
| f x = ((x:accepted), rejected)
| otherwise = (accepted, (x:rejected))
where (accepted, rejected) = partition' f xs | {
"domain": "codereview.stackexchange",
"id": 7504,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "haskell, reinventing-the-wheel",
"url": null
} |
angles are right adjacent sides experts can answer your tough homework and study questions of a trapezoid is special... Length of a trapezoid is a rectangle and circles understand a parallelogram equal. And our entire q & a library = 180° ) ABC$ $\triangle ACD\cong \triangle ABC$.... Aware of about the opposite sides of a closed plane figure ( a + D = ). Too with two equal diagonals same number of nonoverlapping _____ units that exactly cover a closed figure... 6.1D states that if a quadrilateral is an isosceles trapezoid, then its opposite sides of quadrilateral! In mind when you prove that opposite sides are equal with the unequal diagonals distance to. The definition of a parallelogram is a _____ is a rectangle, then it 's bisect. ) Simply put, perimeter is the base length of a parallelogram is right then! The perimeter of a trapezoid are two _____ angles are congruent explore these rules governing the sides of a polygon! A + D = B ) sum of the vector cross product of two sides. | {
"domain": "estudinou.com",
"id": null,
"lm_label": "1. Yes\n2. Yes\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9925393556533171,
"lm_q1q2_score": 0.8271074507183028,
"lm_q2_score": 0.8333245891029456,
"openwebmath_perplexity": 680.622843572116,
"openwebmath_score": 0.8541576862335205,
"tags": null,
"url": "https://estudinou.com/if-it-syu/27f764-are-opposite-sides-of-a-parallelogram-congruent"
} |
We can see that as our model gets more complex (more fitted parameters), it increasingly does a better job fitting the data, in the sense that the residuals get smaller as we add more terms to the model. Another way to visualize this is to plot out the R^2 as a function of the degree of the polynomial model in the model: | {
"domain": "bookdown.org",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9780517450056274,
"lm_q1q2_score": 0.8018981122129847,
"lm_q2_score": 0.8198933403143929,
"openwebmath_perplexity": 431.8432274751122,
"openwebmath_score": 0.5763149261474609,
"tags": null,
"url": "https://bookdown.org/btmarti25/FD2E/comparing-models.html"
} |
ros, pcl, sensor-msgs, buiding-errors, build-from-source
<== Failed to process package 'pcl':
KeyboardInterrupt
Command failed, exiting.
So when it gets to the part where it's trying to build the pcl_common.so shared library, it errors out. I'm not sure how to go about fixing this since I'm new to ROS.
Some Observations: | {
"domain": "robotics.stackexchange",
"id": 12464,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, pcl, sensor-msgs, buiding-errors, build-from-source",
"url": null
} |
# What is the geometric interpretation behind the method of exact differential equations?
Given an equation in the form $M(x)dx + N(y)dy = 0$ we test that the partial derivative of $M$ with respect to $y$ is equal to the partial derivative of $N$ with respect to $x$. If they are equal, then the equation is exact. What is the geometric interpretation of this?
Further more to solve the equation we may integrate $M(x) dx$ or $N(y)dy$, whichever we like better, and then add a constant as a function in terms of the constant variable and solve this.
e.g. If $f(x) = 3x^2$ then $F(x) = x^3 + g(y)$.
After we have our integral we set its partial differential with respect to the other variable our other given derivative and solve for $g(y)$. I have done the entire homework assignment correctly, but I have no clue why I am doing these steps. What is the geometric interpretation behind this method, and how does it work?
- | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9848109489630492,
"lm_q1q2_score": 0.8409426303966402,
"lm_q2_score": 0.8539127548105611,
"openwebmath_perplexity": 129.10496533727004,
"openwebmath_score": 0.8729205131530762,
"tags": null,
"url": "http://math.stackexchange.com/questions/17816/what-is-the-geometric-interpretation-behind-the-method-of-exact-differential-equ"
} |
edit: I think one problem might be when all control points are on the same line. Is this actually a counter example? Are there others?
The equation for the cubic Bézier curve is $$F(u) = (1-u)^3 P_0 + 3 (1-u)^2 u P_1 + 3 (1-u)u^2 P_2 + u^3 P_3$$ and therefore $$F(0) = P_0, \quad F(1) = P_3$$ and, by differentiation, $$F'(0) = 3(P_1 - P_0), \quad F'(1) = 3(P_3 - P_2)$$
Therefore all control points are uniquely determined by the function $F$.
But, as you already noted, there can be two different Bézier curves having the same image, e.g. if all control points are on a line. I don't have an answer for the question
When are the control points uniquely determined by the image of a Bézier curve?
• An alternative to the polysemic word "image" is "trajectory" Mar 6 '16 at 16:28 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.974821152447445,
"lm_q1q2_score": 0.8486766390532821,
"lm_q2_score": 0.8705972751232809,
"openwebmath_perplexity": 134.04065573697423,
"openwebmath_score": 0.8833402991294861,
"tags": null,
"url": "https://math.stackexchange.com/questions/1685569/can-different-control-points-lead-to-the-same-b%C3%A9zier-curve"
} |
javascript, html
const makePriorityNode = (priority, items) => `
<h1>${priority}</h1>
<ul>${items.map(e => `<li>${e}</li>`).join("")}</ul>
`;
const appendDataToList = data => {
const container = document.querySelector(".output-list");
container.innerHTML = data.priority_list
.map(e => makePriorityNode(e, data[e]))
.join("")
;
};
fetch("test", {cache: "no-cache"})
.then(response => {
if (!response.ok) {
throw Error(response.status);
}
return response.json();
})
.then(appendDataToList)
.catch(err => console.error(err))
;
<div class="output-list"></div> | {
"domain": "codereview.stackexchange",
"id": 42151,
"lm_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, html",
"url": null
} |
turing-machines
the set of states,
the start state,
the set of halting states (or, where appropriate, the sets of accepting and rejecting states),
the tape alphabet,
the input alphabet,
the transition function.
Some authors also explicitly include the identity of the blank symbol in the description of the machine; others leave it to convention (e.g., stating that the alphabet will always be $c_1, \dots, c_k$ for some $k$, and $c_1$ is the blank symbol). | {
"domain": "cs.stackexchange",
"id": 12416,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "turing-machines",
"url": null
} |
kolmogorov-complexity
computable partial functions $L_{\hspace{.02 in}1}$ from $\{\hspace{-0.02 in}0,\hspace{-0.05 in}1\hspace{-0.03 in}\}^{\hspace{-0.03 in}*}$ to itself, there exists an
integer $c$ and a computable (total) function $\: f : \{\hspace{-0.02 in}0,\hspace{-0.05 in}1\hspace{-0.03 in}\}^{\hspace{-0.03 in}*} \to \{\hspace{-0.02 in}0,\hspace{-0.05 in}1\hspace{-0.03 in}\}^{\hspace{-0.03 in}*} \:$ such that | {
"domain": "cstheory.stackexchange",
"id": 3059,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "kolmogorov-complexity",
"url": null
} |
c#, optimization, asp.net-mvc-4
does the same amount of work as
foreach (x in things)
{
a(x);
b(x);
c(x);
}
In practice there is some small overhead per loop, but this overhead is usually negligible when compared with the actual work done inside the loop. Do a benchmark to see if this overhead matters.
It appears to be more secure.
In your second solution, you directly interpolate arbitary strings into the HTML via AppendFormat.
Unless you have very good input validation, this would allow for spectacular injection attacks.
Better be safe than sorry, and escape everything.
This is much easier if you use the templating engine rather than doing everything yourself – it's too easy to forget something. | {
"domain": "codereview.stackexchange",
"id": 8660,
"lm_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#, optimization, asp.net-mvc-4",
"url": null
} |
# Integrable Odd Function
I am working on the following question:
Let $f$ be an integrable odd function, i.e. $f(-x)=-f(x)$ for all $x\in \mathbb{R}$. Show algebraically that $\int_{-a}^{a}f(x)dx=0$ for all real numbers $a$. Explain this fact geometrically.
I was wondering if I have the right idea with what I have below.
Let $I=\int_{-a}^{a}f(x)dx$.
$$\int_{-a}^{a}f(x)dx=\int_{-a}^{0}f(x)dx+\int_{0}^{a}f(x)dx$$
Let $A_{1}=\int_{-a}^{0}f(x)dx$ and $A_{2}=\int_{0}^{a}f(x)dx$. Then, using the definition of an integral,
$$A_{2}=\lim_{n \to \infty }\sum_{i=1}^{n}f(x_{i})\Delta x=\lim_{n \to \infty }\sum_{i=1}^{n}f(x_{i})\frac{a}{n}=\frac{a}{n}\lim_{n \to \infty }\sum_{i=1}^{n}f(x_{i})$$
Where $\Delta x=\frac{a}{n}$. For the other area, | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9838471689667878,
"lm_q1q2_score": 0.813358066548884,
"lm_q2_score": 0.8267118026095991,
"openwebmath_perplexity": 132.1973410133043,
"openwebmath_score": 0.9863900542259216,
"tags": null,
"url": "http://math.stackexchange.com/questions/100244/integrable-odd-function"
} |
soft-question, mass, definition
In QFT, the correct mass is $p^\mu p_\mu=m^2$, isn't it?
Finally, are there more possible definitions of mass, besides the description in String Theory (maybe in General Relativity, I've read that there are problems defining energy in a localised point, that we can only evaluate the total energy)? Are some definitons more fundamental than the rest?
EDIT: What about this definition I've found in QM $m=\hbar (\frac{d^2E}{dk^2})-1$? The definition $m^2=p^\mu p_\mu$ is generally valid.
By the correspondence principle, the definition of mass in relativity has to reduce to the Newtonian one in the nonrelativistic limit, and the definition of mass in quantum mechanics has to reduce to the Newtonian one in the classical limit. | {
"domain": "physics.stackexchange",
"id": 7780,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "soft-question, mass, definition",
"url": null
} |
quantum-mechanics, homework-and-exercises, harmonic-oscillator, hamiltonian, perturbation-theory
I believe that it can be solved by using the destruction/creation operators,
$$\hat{x}=\sqrt{\frac{\hbar}{2m\omega}}(\hat{a}+\hat{a}^\dagger)$$
$$\hat{p}=\sqrt{\frac{m\omega\hbar}{2}}i(\hat{a}^\dagger-\hat{a})$$
However, as it is rather tedious calculation, I want to use the following method:
I complete the square and factorize by $p^2$
$$\hat{H}=\frac{p^2}{2m}(1+2m\beta)+\frac{m\omega^2}{2}(x^2+\frac{2}{m\omega^2}\alpha x)$$.
$$\hat{H}=\frac{p^2}{2m}(1+2m\beta)+\frac{m\omega^2}{2}(x+\frac{2}{m\omega^2}\alpha)^2-\frac{\alpha^2}{m^2\omega^4}$$.
Now I introduce $\tilde{p}^2=p^2(1+2m\beta)$ and $\tilde{x}=x+\frac{2}{m\omega^2}\alpha$
and the Hamiltonian is thus:
$$H=\frac{\tilde{p}^2}{2m}+\frac{m\omega^2}{2}\tilde{x}^2-\frac{\alpha^2}{m^2\omega^4}$$
Thus, the energy levels would be
$$E_n=\hbar\omega(n+\frac{1}{2})-\frac{\alpha^2}{m^2\omega^4}$$ | {
"domain": "physics.stackexchange",
"id": 59005,
"lm_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, harmonic-oscillator, hamiltonian, perturbation-theory",
"url": null
} |
functional-programming, scala, immutability
I would like to be able to subclass SearchQuery with specific builder methods for different search types. However, qualify (and addParam) have result type of SearchQuery (and not something more specific like RepositorySearchQuery), so I would be unable to chain methods together. Downcasting seems like code smell to me. Is there a better way to accomplish this? Case Classes
Some of the occurrences of case classes are overused. I doubt that RepositoryResult or UserResult could be useful in matchers, because they look like intermediate utility entities providing conversion to target Repository and User instances.
This transformation can be done through a redefinition of apply function of companion objects.
APIResult super-class also introduces a rigid structure and can be transformed into a trait:
trait APIResult { | {
"domain": "codereview.stackexchange",
"id": 24205,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "functional-programming, scala, immutability",
"url": null
} |
homework-and-exercises, computational-physics, oscillators, phase-space, dissipation
So finally we get
\begin{align}
v(X,\bar X)&=\tfrac 1 2 (zX+\bar z\bar X)\\
&=-\frac \alpha 2 (X+\bar X)+\frac {i\omega}2(X-\bar X)\\
&=-\alpha\,\text{Re}X-\omega\,\text{Im}X\\
&=-\frac b{2m}x-\omega\,\text{Im}X
\end{align}
So this is still pretty useless because there is no way to define $X$ in terms of $x$ but I hope this gave you at least some insight on why this fails. | {
"domain": "physics.stackexchange",
"id": 68836,
"lm_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, computational-physics, oscillators, phase-space, dissipation",
"url": null
} |
haskell, recursion, time-limit-exceeded
This code works, for example, with the input
3
9 2
4 5 2 5 4 3 1 3 4
9 4
4 5 2 5 4 3 1 3 4
10 2
5 4 3 2 1 1 2 3 4 5
and gives the desired output of
4 5 3
-1
5 4 3 2 1
However, with larger datasets this code is incredibly slow. I'm guessing it's because the recursion is less than optimal, but I can't really pinpoint what is taking so long. My best guess is that uniq or count is the limiting factor, but I can't figure out how to optimize them. If you write uniq as a right fold, you don't need to pass an accumulator through, and the list comes out in the right order:
uniq :: Eq a => [a] -> [a]
uniq [] = []
uniq (x:xs) = (if x `elem` xs then id else (x:)) $ uniq xs
filt :: Show a => Num a => Read a => Eq a => Integral b => [a] -> b -> [a]
filt k is = uniq [i | i <- is, count i is >= k]
(Edit: Actually that one throws out the first of each two equal elements, not the last. Here`s one without that problem:
uniq :: Eq a => [a] -> [a]
uniq [] = []
uniq (x:xs) = x : uniq (filter (/=x) xs) | {
"domain": "codereview.stackexchange",
"id": 23490,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "haskell, recursion, time-limit-exceeded",
"url": null
} |
c++, game
Now the naming. Most of your identifiers are inappropriate for a real codebase. For example, you have a vector that in a real program would be called something like neighbors or outgoing_passages; you call it brooms.
Some of your identifiers are at least plausibly related by abbreviation to their actual meanings; for example int tar, which from context clearly means something like int target. But you should still write them out! Remember, we write our C++ code for people, not for machines. (Machines are totally happy reading machine code.) So rnd_room should be random_room; rnumber should be room_number (or just room?), tar_rooms should be target_rooms (or path?), and so on.
Consider introducing a type alias
using RoomNumber = int;
so that you don't have to use unexplained int for so many different purposes. | {
"domain": "codereview.stackexchange",
"id": 31409,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c++, game",
"url": null
} |
nomenclature
Title: Priority of Alphabetic order vs Lowest locant I am confused about usage priority of lowest locant and alphabetical order rule(s)
For example :
3-ethyl 4,4 - dimethyl hexane
4-ethyl 3,3- dimethyl hexane
Which is considered correct (or preferred) IUPAC name? Lowest locant has the priority over alphabetical order while numbering. But when writing name, we write according to alphabetical order. So 4-ethyl-3,3-dimethylhexane is the correct answer. One more thing, we don't consider the prefix 'di' on 'dimethyl' while deciding alphabetical order of the name. | {
"domain": "chemistry.stackexchange",
"id": 16732,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "nomenclature",
"url": null
} |
javascript, jquery, html, datetime
In the first click handler you define trg but don't use it.
widget is a far too generic class name, and I don't understand what trg stands for.
The use of HTML elements seems a bit random. Why is the day of the month a level 1 header and the other parts paragraphs?
Consider using thead and th elements in the table. That way you can also get rid of the duplicate class name head. | {
"domain": "codereview.stackexchange",
"id": 15270,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, jquery, html, datetime",
"url": null
} |
111 112 113 121 122 123. the number of permutations, for a given number (this is classically known as ‘the travelling salesman’ problem):. This number of permutations is huge. Given a string of length n, print all permutation of the given string. Permutation with repetition Calculator - High accuracy calculation Welcome, Guest. Ways to pick officers. For each number, we add it to the results of permutations(i+1). Instructions to install MySQL and MySQL Connector J. Given a string S. An estimation of minimum distance for proposed codes is obtained. We prove a parallel repetition theorem for general games with value tending to 0. I'm stuck with nested for loops that are dependent on the previous loop. Now this is exactly the combinatorial problem of 5 selections from 10 choises with repetition. In the permutation without repetition section, the same dog will show up in many of those 2730 ways to order them, but the same ordered set will not show up twice. Permutation with repetition. | {
"domain": "gattopescatore.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.982287697666963,
"lm_q1q2_score": 0.8534378486979414,
"lm_q2_score": 0.8688267711434708,
"openwebmath_perplexity": 674.6376522032865,
"openwebmath_score": 0.5992879271507263,
"tags": null,
"url": "http://ronk.gattopescatore.it/permutation-with-repetition-algorithm.html"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.