text stringlengths 1 1.11k | source dict |
|---|---|
python, beginner, networking
in all circumstances.)
Don't compare to Booleans. (if condition == True to if condition and if condition == False to if not condition)
Use lower_case_with_underscores for variable names (see this)
Boolean values should not be negative and be verbs or verb+noun (is_stopping = True or stopping = True, not dont_stop = False or not_stopping = False, then do if not stopping rather than if not_stopping)
Have an entry point to your program. Right now, your code has no entry point, it is just in the global namespace. Do this:
#!shebang
imports
classes
function definitions
def main():
everything that is not an import, class or function
if __name__ == "__main__": # i.e. The module is not being imported
main() | {
"domain": "codereview.stackexchange",
"id": 12550,
"lm_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, networking",
"url": null
} |
finite-automata, regular-expressions
Title: Regular expression containing lambda What is the meaning of lambda here:
$$(b+c)^*(a+\lambda)(b+c)^*(a+\lambda)(b+c)^*(a+\lambda)(b+c)^*$$.
I know that lambda is used in the context of NFA?
Let's suppose we break down the expression to:$$(b+c)^*(a+\lambda)(b+c)^*$$
and to:$$(b+c)^*(a+\lambda)(b+c)^*(a+\lambda)(b+c)^*$$
How the above would generate an empty string?
Somebody please guide me.
Zulfi. $\lambda$ denotes the empty string, which is written "" in programming languages. The regular expression you give matches the empty string because you can choose each "$a+\lambda$" to match $\lambda$, and each "$(b+c)^*$" to match zero copies of $b+c$. So the expression matches, among other things, $\lambda\lambda\lambda\lambda\lambda\lambda\lambda$, which is just the same thing as $\lambda$. | {
"domain": "cs.stackexchange",
"id": 15076,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "finite-automata, regular-expressions",
"url": null
} |
c#, unit-testing, interview-questions
[TestMethod]
[ExpectedException(typeof(ApplicationException))]
public void TransferringInvalidAmountShouldFail()
{
bank.TransferFunds(1, 2, -594);
}
}
} Coding points
Fields and Properties
In C#, properties should be PascalCased (Owner, Balance, Transaction, in Account).
I would push for no public fields (Name, in Bank), always expose properties rather than fields.
If a property should not be changed outside the class, it should have no public getter. If it should not be changed at all then it should be readonly (or have no setter, if a property)
public abstract class Account
{
public int Owner { get; private set; }
public decimal Balance { get; private set; }
public List<Transaction> Transactions { get; }
public Account(int owner, decimal balance)
{
this.owner = owner;
this.balance = balance;
transactions = new List<Transaction>();
}
//... | {
"domain": "codereview.stackexchange",
"id": 30791,
"lm_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#, unit-testing, interview-questions",
"url": null
} |
special-relativity, string-theory, spacetime, differential-geometry, metric-tensor
Now, although this expression doesn't explicitly refer to a specific metric (as the inner products involved can be performed using any metric) the definition of elemental area used as well as the use of relation $\vec{A} \dot{}{}\vec{B} = AB \cos\theta$ are specific to Euclidean metric and can't be assumed to hold for a generic metric. Still, Zweibach, in A first course in String Theory, has extended the use of the formula
$$A = \int ~\mathrm d\xi^1 \mathrm d\xi^2 \sqrt{\left(\dfrac{\mathrm d \vec x}{\mathrm d\xi^1}\right)^2 \left(\dfrac{\mathrm d \vec x}{\mathrm d\xi^2}\right)^2 -\bigg(\dfrac{\mathrm d \vec x}{\mathrm d\xi^1} \dot{}{} \dfrac{\mathrm d \vec x}{\mathrm d\xi^2}\bigg)^2}$$
(upto a facor of $i$) for a Minkowskian spacetime. | {
"domain": "physics.stackexchange",
"id": 36236,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "special-relativity, string-theory, spacetime, differential-geometry, metric-tensor",
"url": null
} |
# Prove three eigenvectors from three distinct eigenvalues are linearly independent [duplicate]
Here is the formal statement:
Let $\lambda_1, \lambda_2, \lambda_3$ be distinct eigenvalues of $n\times n$ matrix $A$. Let $S=\{v_1, v_2, v_3\}$, where $Av_i = \lambda_i v_i$ for $1\leq i\leq 3$. Prove $S$ is linearly independent.
Many resources online state the general proof or the proof for two eigenvectors. What is the proof for specifically 3? I tried to derive the 3 eigenvector proof from the 2 eigenvector proofs, but failed.
## marked as duplicate by Strants, Kevin Long, Arnaud D., Vladhagen, XamMar 23 '18 at 21:17
• Please show us what you have tried so far. – Vishaal Sudarsan Mar 23 '18 at 5:38 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9859363713038174,
"lm_q1q2_score": 0.8279242688561539,
"lm_q2_score": 0.8397339756938819,
"openwebmath_perplexity": 329.8311393994679,
"openwebmath_score": 0.900636613368988,
"tags": null,
"url": "https://math.stackexchange.com/questions/2704394/prove-three-eigenvectors-from-three-distinct-eigenvalues-are-linearly-independen?noredirect=1"
} |
catkin, ros-kinetic, ubuntu, rosserial-arduino, rosserial
make[3]: *** [hello] Error 2
make[2]: *** [CMakeFiles/helloworld_firmware_hello] Error 2
make[1]: *** [CMakeFiles/helloworld_firmware_hello.dir/all] Error 2
make: *** [all] Error 2
cd /home/mirzam/cmaketut_ws/build/helloworld; catkin build --get-env helloworld | catkin env -si /usr/bin/make --jobserver-fds=6,7 -j; cd - | {
"domain": "robotics.stackexchange",
"id": 32093,
"lm_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, ros-kinetic, ubuntu, rosserial-arduino, rosserial",
"url": null
} |
c#, performance, beginner
result = optimizer(HimmelBlau, 2);
Console.WriteLine("HimmelBlau formula:");
Console.WriteLine("Solution: {0}, {1}", result[0], result[1]);
Console.WriteLine("Number of functiecalls: {0}", num_of_functioncalls);
num_of_functioncalls = 0;
}
}
Because I am new to C#, I am interested in advice/commentary on good form, but I am also interested in the efficiency of this implementation. With advancing insight I have found a few issues with the code.
Check for convergence doesn't work properly
// Check for convergence
if (functionValues[N] - functionValues[0] < 1e-9)
{
break;
} | {
"domain": "codereview.stackexchange",
"id": 27570,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "c#, performance, beginner",
"url": null
} |
ultrasound
I actually went ahead and bought a simple large (for an end-user device) ultra-sound cleaner and filled it with low-viscous oil. I operated it twice in the space of a few weeks. It still works and it does clean. The main challenge is to get the dirt out of the oil in the device's basin. | {
"domain": "engineering.stackexchange",
"id": 4322,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ultrasound",
"url": null
} |
homeostasis, renal-physiology
Both the afferent and efferent arterioles are regulated through hormones (and drugs that inhibit the hormones). Prostaglandins dilate the afferent arterioles, and NSAIDs inhibit this action. Angiotensin II preferentially constricts the efferent arteriole, and this action is restricted by an ACE inhibitor. (Source: First Aid for the USMLE Step 1) | {
"domain": "biology.stackexchange",
"id": 484,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "homeostasis, renal-physiology",
"url": null
} |
And BTW that is a very neat proof!
#### anemone
##### MHB POTW Director
Staff member
Yes: a triangle can have at most one obtuse angle, and the other two (acute) angles must necessarily be adjacent. Without loss of generality (favourite math phrase), take them to be A and B.
Thanks, Opalg.
And I think 'obviously' is also one of the favourite math phrase too!
But unfortunately that is a phrase to which I considered not so true and annoying some (if not most) of the time.
And BTW that is a very neat proof!
Thanks. Seriously, your compliment just made my day. | {
"domain": "mathhelpboards.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9790357549000773,
"lm_q1q2_score": 0.8379088773528197,
"lm_q2_score": 0.8558511506439708,
"openwebmath_perplexity": 695.9239556090874,
"openwebmath_score": 0.9018501043319702,
"tags": null,
"url": "https://mathhelpboards.com/threads/using-of-jensens-inequality-to-prove-cosa-cosb-cosc-less-than-or-equal-to-3-2-where-a-b-c-pi.466/"
} |
c++, c++11
Don't return nonzero from main unless there's an error
The convention in programming in C and C++ is that the returned integer from main() is considered by the operating system to be construed as an error code. For that reason, the non-error condition is signalled by returning a 0. Your code ends with return 1 which will be interpreted by most operating systems as an indication that an error was encountered. Because the compiler will automatically generate the equivalent of a return 0; at the end of main(), I'd advocate simply omitting it. | {
"domain": "codereview.stackexchange",
"id": 26134,
"lm_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",
"url": null
} |
(b) ⌨ Adapt Demo 10.3.2 to operate on the function from part (a), computing only the first derivative. What is the observed order of accuracy?
(c) ✍ Show that for even values of $$n$$, there is only one node at which the error for computing $$f'$$ in part (b) is nonzero.
3. ⌨ To get a fourth-order accurate version of $$\mathbf{D}_x$$, five points per row are needed, including two special rows at each boundary. For a fourth-order $$\mathbf{D}_{xx}$$, five symmetric points per row are needed for interior rows and six points are needed for the rows near a boundary.
(a) Modify Function 10.3.1 to a function diffmat4, which outputs fourth-order accurate differentiation matrices. You may want to use Function 5.4.7.
(b) Repeat the experiment of Demo 10.3.2 using diffmat4 in place of Function 10.3.1, and compare observed errors to fourth-order accuracy.
4. ✍ Explain in detail how lines 23-24 in Function 10.3.3 correctly change the interval from $$[-1,1]$$ to $$[a,b]$$. | {
"domain": "tobydriscoll.net",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9898303419461302,
"lm_q1q2_score": 0.8022366175748555,
"lm_q2_score": 0.8104789109591832,
"openwebmath_perplexity": 1928.5445266069187,
"openwebmath_score": 0.7715263962745667,
"tags": null,
"url": "https://tobydriscoll.net/fnc-julia/bvp/diffmats.html"
} |
general-relativity, black-holes, gravitational-waves
Title: Can gravitational waves orbit each other to form a standing wave? Since gravitational waves are a type of propagation of energy of some sort, they ought to induce their own gravitational field. I'm assuming this extra gravitational force / curvature is independent from the wave itself, so there ought to be an observer that would 'feel' or 'observe' the wave pass, and in addition 'feel' or 'observe' a secondary attractive force towards the 'densest' part of the wave. I'm not sure if it is possible to discern these two effects without experiencing them as a whole but I'm assuming one could somehow. | {
"domain": "physics.stackexchange",
"id": 18632,
"lm_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, black-holes, gravitational-waves",
"url": null
} |
hamiltonian, fermions, many-body, spin-models, spin-chains
However, the answer given in the textbook is:
$$\hat{H}= -\sum_{m=1}^{N}(J_z (\frac{1}{4} - \hat{c}_{m}^{\dagger}\hat{c}_{m} +\hat{c}_{m}^{\dagger}\hat{c}_{m}\hat{c}_{m+1}^{\dagger}\hat{c}_{m+1}) + \frac{J_{\perp}}{2}(\hat{c}_{m}^{\dagger}\hat{c}_{m+1} + \hat{c}_{m+1}^{\dagger}\hat{c}_{m})).$$
Is anyone able to help me make the last step from my answer to the given answer? For the $J_z$ part you're basically there already. Just note that with periodic boundary conditions $c^\dagger_{N+1}=c^\dagger_1$ and you're free to change the summation index, so
$$
\sum_{m=1}^{N} \hat{c}_{m+1}^{\dagger}\hat{c}_{m+1} = \sum_{m=1}^{N} \hat{c}_{m}^{\dagger}\hat{c}_{m}.
$$
For the $J_\perp$ part you've made a sign error for one of the terms. A good way for you to locate the error might be to Jordan-Wigner-transform both $S_{m+1}^+S_m^-$ and $S_m^-S_{m+1}^+$. Obviously these should give the same result, but you may find one more straightforward than the other. | {
"domain": "physics.stackexchange",
"id": 83937,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "hamiltonian, fermions, many-body, spin-models, spin-chains",
"url": null
} |
classification, class-imbalance
Title: How much imbalance in a training set is a problem? In a simple binary classification problem, at what point does majority class to minority class become significant become significant? Intuitively, I would expect a 3:1 ratio to not be an issue, maybe not even a 10:1 ratio. But a 100:1 ratio certainly does require some action. What might be this cutoff?
As a followup, what might be come potential solutions beyond undersampling and oversampling? There is no strict threshold at which a dataset is considered imbalanced. Accordingly, in Foundations of Imbalanced Learning Gary M. Weiss writes: | {
"domain": "datascience.stackexchange",
"id": 9218,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "classification, class-imbalance",
"url": null
} |
# Problem with logarithms
Problem:
Solve:
$$\frac{1}{2^x} = \frac{5}{8^{x+2}}$$
My attempt:
$$\frac{1}{2^x} = \frac{5}{8^{x+2}}$$
$$\Rightarrow 5 \cdot 2^x = 8^{x+2}$$
$$\Rightarrow 2^{\log_2 5+x} = 8^{x+2}$$
$$\Rightarrow (\log_2 5 + x)(\log_a 2) = (x+2)(\log_a 8)$$
And then just keep going like this, but I'm obviously wrong already as the answer is:
$$x = \frac{\ln 5 - 9 \ln 2}{2 \ln 2}$$
What am I doing wrong?
EDIT: If someone could enlarge the latex for me that would be great. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9559813488829418,
"lm_q1q2_score": 0.8339478104214924,
"lm_q2_score": 0.8723473647220786,
"openwebmath_perplexity": 1024.2617492034344,
"openwebmath_score": 0.9654048085212708,
"tags": null,
"url": "http://math.stackexchange.com/questions/685221/problem-with-logarithms"
} |
form silly counterexamples and become a nuisance. To avoid cluttering the text with non-triviality conditions, we shall mostly treat the trivial graphs, and particularly the empty graph, with generous disregard.</p> </blockquote> <p>Only <em>nonempty</em> graphs are defined to be connected. (p.9)</p> | {
"domain": "mathoverflow.net",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9763105321470076,
"lm_q1q2_score": 0.8071274378538288,
"lm_q2_score": 0.8267118004748677,
"openwebmath_perplexity": 797.1546069747388,
"openwebmath_score": 0.8045313358306885,
"tags": null,
"url": "http://mathoverflow.net/feeds/question/120536"
} |
8. Originally Posted by Plato
It is LaTeX.
So am I supposed to memorize the list of symbols and characters in order to use? Wouldn't that be too tedious?
9. Originally Posted by stupidguy
So am I supposed to memorize the list of symbols and characters in order to use? Wouldn't that be too tedious?
It may be tedious, but it is well worth it.
Posters who use LaTeX usually get faster and better help. | {
"domain": "mathhelpforum.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9539661028358094,
"lm_q1q2_score": 0.8030731281901543,
"lm_q2_score": 0.8418256432832333,
"openwebmath_perplexity": 883.0977862034408,
"openwebmath_score": 0.8905158638954163,
"tags": null,
"url": "http://mathhelpforum.com/algebra/155461-why-10-lg-5-5-e-ln5-5-etc.html"
} |
is, the propositions having nothing but 0s i. Question 1. 3 Learn the basic rules of natural deduction, including rules of. The propositional calculus, as it is also known, is a staple of first-year university logic courses. A proposition that is neither a tautology nor a contradiction is From the following truth table may use truth tables or properties of logical equivalences). By Using Truth Table Un 1. The naive, and intuitively correct, axioms of set theory are the Comprehension Schema and Extensionality Principle:. ((PvQ) ^ (~R) = P v (Q^(~R)) Thats not an equal sign btw, but three lines intended instead of two. If there are. • The truth table for a compound proposition: table with entries (rows) for all possible combinations of truth values of elementary propositions. The expression "p or not p" is true under any circumstance, so it is a tautology. Assume x is a particular real number. ¬ ∧¬ → ( ∧¬ )↔ ( → ) b. Now, Number of rows in the truth table will always be equal to the | {
"domain": "chiavette-usb-personalizzate.it",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.970239907775086,
"lm_q1q2_score": 0.8545844878495524,
"lm_q2_score": 0.8807970904940926,
"openwebmath_perplexity": 467.3208727966209,
"openwebmath_score": 0.5699777007102966,
"tags": null,
"url": "http://insd.chiavette-usb-personalizzate.it/contradiction-truth-table.html"
} |
quantum-field-theory, variational-principle
1) the variation of the field on the branes is zero
2) the term multiplying the variation is zero on the branes (let?s call it B)
Now, all authors affirm that, in absence of extra terms on the brane, this two conditions lead to Neumann or Dirichlet conditions for the field on the branes (in the paper above this is said just after equation 10). My question is: why is that?
For scalar fields it can be shown that B equals the derivative of the field, so I can see the Neumann condition there (am I wrong?). But the 1st condition says the variation of the field is zero not the field itself. Clearly I am misunderstanding something here... The answer is well-known from the analysis of open strings in perturbative string theory: at the end points, the coordinates $X(\sigma)$ must also satisfy either Neumann or Dirichlet boundary conditions for the very same reason that you mentioned.
In fact, I think that you have almost answered your own question. | {
"domain": "physics.stackexchange",
"id": 4476,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-field-theory, variational-principle",
"url": null
} |
algorithms, optimization, recursion
For example, let $f$ be addition, i.e, $f(x_1, x_2, \cdots, x_n)=x_1+x_2+\cdots+x_n$. However, only calls to $f$ with one or two arguments are allowed, i.e $f(x)=x$ and $f(x_1,x_2)=x_1+x_2$. In particular, neither subtraction nor negation is allowed. The problem is to compute all sums of $n-2$ numbers among the given $n$ numbers with the least number of additions. There are $n(n-1)/2$ such sums. (1) You can compute $f(x_1,\dots,x_{i-1})$ for all $i$ with $n-2$ calls to $f$. (Simply iterate over $i:=1,\dots,n$.)
(2) Then, using (1), you can compute $f(x_1,\dots,x_{i-1},x_{i+1},\dots,x_{j-1})$ for all $i,j$ with $n(n-1)/2$ more calls to $f$. (For each $i$, iterate over $j:=i+2,\dots,n$.)
(3) You can also compute $f(x_{j+1},\dots,x_n)$ for all $j$ with another $n-2$ calls to $f$. (Iterate over $j:=n,\dots,1$.)
(4) Finally, using (2) and (3), you can compute $f(x_1,\dots,x_{i-1},x_{i+1},\dots,x_{j-1},x_{j+1},\dots,x_n)$ for all $i,j$ with another $n(n-1)/2$ calls to $f$. | {
"domain": "cs.stackexchange",
"id": 20128,
"lm_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, optimization, recursion",
"url": null
} |
thermodynamics, energy, potential-energy
Title: Where is the potential energy due to internal interactions in total energy? In thermodynamics the total energy of a system consists of kinetic energy of motion of the system as a whole, potential energy of the system as a whole due to external force fields, and energy contained within the system known as internal energy,
$$
E = E_{\mathrm{k}} + E_{\mathrm{p}} + U \, . \tag{1}
$$
That is the way it is said in many books, lecture notes and online source. For instance, the first paragraph of Wikipedia article on internal energy says:
In thermodynamics, the internal energy is one of the two cardinal
state functions of the state variables of a thermodynamic system. It
refers to energy contained within the system, and excludes kinetic
energy of motion of the system as a whole, and the potential energy of
the system as a whole due to external force fields. It keeps account
of the gains and losses of energy of the system. | {
"domain": "physics.stackexchange",
"id": 15054,
"lm_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, energy, potential-energy",
"url": null
} |
navigation, odometry, kinect, ros-kinetic, transform
Any ideas on how to get around this problem ?
Comment by chrissunny94 on 2018-03-01:
When i am trying to run gmapping , i get the following error .
Timed out waiting for transform from base_link to map to become available before running costmap, tf error: Could not find a connection between 'map' and 'base_link' because they are not part of the same tree.Tf has two or more unconnec
Comment by Humpelstilzchen on 2018-03-01:
Thats a new question, also look at the mentioned log file.
Your TF tree is not fully connected. You need to publish the transformation between your base_link and camera _link | {
"domain": "robotics.stackexchange",
"id": 30166,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "navigation, odometry, kinect, ros-kinetic, transform",
"url": null
} |
• These notes may be helpful. (But no, I will not transcribe them into answers.) – JeffE Jul 17 '12 at 20:17
## Converting Full History to Limited History
This is a first step in solving recurrences where the value at any integer depends on the values at all smaller integers. Consider, for example, the recurrence $$T(n) = n + \frac{1}{n}\sum_{k=1}^n \big(T(k-1) + T(n-k)\big)$$ which arises in the analysis of randomized quicksort. (Here, $k$ is the rank of the randomly chosen pivot.) For any integer $n$, the value of $T(n)$ depends on all $T(k)$ with $k<n$. Recurrences of this form are called full history recurrences. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9697854103128328,
"lm_q1q2_score": 0.8390816818236664,
"lm_q2_score": 0.865224072151174,
"openwebmath_perplexity": 568.4012933743602,
"openwebmath_score": 0.9995046854019165,
"tags": null,
"url": "https://cs.stackexchange.com/questions/2789/solving-or-approximating-recurrence-relations-for-sequences-of-numbers/24082"
} |
computability, finite-automata, pumping-lemma, decision-problem
Title: Proof that whether a regular language is finite is decidable I have this question for a homework. The question stems from the fact that you can determine whether a regular language is empty by using a Turing machine to count the states n in the given FSM. When you generate all strings from length 0 to n, if the machine accepts any of them then the language is non-empty. We don't have to check words with length > n because of the pumping lemma.
The question claims that you can solve the decision problem for finiteness in a similar way.
I know intuitively that a regular language is finite if its finite, well-formed regular expression does not contain a Kleene star, but I don't know how to convert this notion around. My thought is that we have to know if there are any words in the language whose length is greather than n, but that requires checking all words.
Then I thought: | {
"domain": "cs.stackexchange",
"id": 6461,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "computability, finite-automata, pumping-lemma, decision-problem",
"url": null
} |
c, game, playing-cards, curses
int main(int argc, char *argv[])
{
int cursy, cursx;
int maxy, maxx;
int i, j;
int prev; /* used in +4 Wild challenges */
int lastcol; /* used in +4 Wild challenges */
int plrs; /* total number of players */
int dir; /* direction of gameplay, for use with reverse cards. *
* 1 if "clockwise", -1 if "counterclockwise" */
int color; /* Current color in play */
int key; /* input character
* Needs to be int, to make room for arrow keys */
char turn; /* becomes 0 when player turn ends */
int drawx; /* If a draw X card is played, how screwed next player is */
char gtype; /* Quick or full game */
int won; /* Once player wins full game, will be set to their index */
int round; /* Round (for full games) */
int multdraw; /* player draws until they have a playable card */ | {
"domain": "codereview.stackexchange",
"id": 16566,
"lm_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, playing-cards, curses",
"url": null
} |
temperature, everyday-life, air, convection
In its simplest form, the solar chimney consists of a black-painted chimney. During the day solar energy heats the chimney and the air within it, creating an updraft of air in the chimney. The suction created at the chimney's base can be used to ventilate and cool the building below.1 In most parts of the world it is easier to harness wind power for such ventilation as with a windcatcher, but on hot windless days a Solar chimney can provide ventilation where otherwise there would be none. | {
"domain": "physics.stackexchange",
"id": 8541,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "temperature, everyday-life, air, convection",
"url": null
} |
Is infinity * infinity indeterminate?
Product: ∞ ⋅ ∞ \infty \cdot \infty ∞⋅∞ is not indeterminate; the limit is ∞ \infty ∞.
Is infinity 0 indeterminate?
Another states that infinity/0 is one of the indeterminate forms having a large range of different values. The last reasons that infinity/0 "is" equal to infinity, ie: Suppose you set x=0/0 and then multiply both sides by 0. Then (0 x)=0 is true for most any x-- indeterminant.
How do you solve 1 infinity indeterminate?
These convert the indeterminate form to one that we can solve. The two formulae are the following: If lim x → + ∞ f ( x ) = 1 and lim x → + ∞ g ( x ) = ± ∞ then, lim x → + ∞ f ( x ) g ( x ) = e ( lim x → + ∞ ( f ( x ) − 1 ) ⋅ g ( X ) )
How does an indeterminate sentence work?
indeterminate sentence, in law, term of imprisonment with no definite duration within a prescribed maximum. Eligibility for parole is determined by the parole authority.
How do you solve indeterminate forms in limits? | {
"domain": "hnqdfm.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9653811611608242,
"lm_q1q2_score": 0.8106633585855693,
"lm_q2_score": 0.8397339736884711,
"openwebmath_perplexity": 1243.6986201526993,
"openwebmath_score": 0.9017710089683533,
"tags": null,
"url": "https://hnqdfm.com/articles/what-are-the-7-indeterminate-forms"
} |
c++, c++11, tree
void remove_min() {
check(root);
root = remove_min(root);
}
Ptr<Node> remove_min(Ptr<Node>& t) {
if (t->left == nullptr) {
return std::move(t->right);
}
t->left = remove_min(t->left);
t->n = size(t->left)+size(t->right)+1;
return std::move(t);
}
void remove_max() {
check(root);
root = remove_max(root);
}
Ptr<Node> remove_max(Ptr<Node>& t) {
if (t->right == nullptr) {
return std::move(t->left);
}
t->right = remove_max(t->right);
t->n = size(t->left)+size(t->right)+1;
return std::move(t);
}
void remove(K k) {
root = remove(root, k);
} | {
"domain": "codereview.stackexchange",
"id": 11519,
"lm_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, tree",
"url": null
} |
notation, dimensional-analysis, si-units
Title: Mathematical rules for dimensional analysis In dimensional analysis we treat the units as their own objects, in this case $1m$ is a unit multiplied by a number, and forms a 'quantity' is this explicitly the same object as the unit itself?
Having $1m=m$ implies that perhaps $-1m=-m$, I think it perhaps makes sense to make a distinction between the unit and the quantity, although $m$ could refer to a to a length, perhaps $'1m'$ is the length and we can show that $2m=2*(1m)$?
We would never give a length of $'m'$, the issue with this is then $2(1*m)$ = $2*m$ which seems to be an issue based on the definition of multiplication?
If we can have an object just called $m$ and it is defined under addition (in the case it's defined as $1*m$) then we must have an additive inverse and $-m$ should exist, how do we deal with this issue? $-m$ should make no sense in the context of the unit. | {
"domain": "physics.stackexchange",
"id": 90752,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "notation, dimensional-analysis, si-units",
"url": null
} |
ros, kinect, depth-image, ros-kinetic
}
catch (cv_bridge::Exception& e){
ROS_ERROR("Could not convert from '%s' to '16UC1'.", e.what());
return;
}
cv::imshow("Depth Image",cv_ptr2->image);
cv::waitKey(20);
ROS_INFO("The object is in depth: %d",cv_ptr2->image.at<int>(x,y));
} | {
"domain": "robotics.stackexchange",
"id": 25971,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, kinect, depth-image, ros-kinetic",
"url": null
} |
quantum-mechanics, discrete
behave in quantum manner, but most classical examples involve small particles or molecules. Thus, there is no single answer, the range can vary orders of magnitude if you can prepare carefully the system. The same happens with the time scale. A system behaves in a quantum manner if the measurement is smaller than the decoherence time. As with the case of spatial scale, this length of time varies with the system. | {
"domain": "physics.stackexchange",
"id": 15867,
"lm_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, discrete",
"url": null
} |
c, linked-list, stack
node *push(char *element, node *head);
node *pop(node *head);
void destroy_stack(node *p);
int main(void)
{
// create new stack
node *stack = NULL;
// push 6 "functions" to the stack
char *function[6] = {"first funct", "second funct", "third funct",
"fourth funct", "fifth funct", "sixt funct"};
for (int i = 0; i < 6; i++)
{
printf("function is : %s\n",function[i]);
stack = push(function[i], stack);
if (!stack)
{
fprintf(stderr,"Not enough memory space for new list");
return 1;
}
}
// display the stack
for (node *temp = stack; temp != NULL; temp = temp -> next)
{
printf("Elements of the stack are: %s\n", temp -> string);
}
// pop the elements from the stack
while (stack != NULL)
{
printf("Popped elemet is: %s\n", stack -> string);
stack = pop(stack);
}
destroy_stack(stack);
return 0;
} | {
"domain": "codereview.stackexchange",
"id": 32196,
"lm_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, linked-list, stack",
"url": null
} |
thermodynamics, black-holes, temperature, entropy, hawking-radiation
Title: Why is the temperature of a black hole given by $T=E/2S$? Naively, I would imagine that
$$
T = \frac{E}{S}
$$
However, for a black hole, $E=c^4 R / 2G$ and $S= A k c^3 / 4 G \hbar $, which yields
$$
T = \frac{E}{2S}
$$
Is there a simple explanation for the factor 2?
Is there a simple explanation for the factor 2? | {
"domain": "physics.stackexchange",
"id": 61298,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "thermodynamics, black-holes, temperature, entropy, hawking-radiation",
"url": null
} |
ros, transform, nodelet, tf2
Original comments
Comment by gvdhoorn on 2015-11-30:
Just to avoid an xy-problem: could you tell us what you are trying to achieve? That might also make potential answers more relevant to your issue.
Comment by Javier V. Gómez on 2015-11-30:
I have some nodelets running in my application, and so far tf is used only in nodelets. I am trying to improve performance.
Comment by gvdhoorn on 2015-11-30:
I've not looked into this directly, but nodelets mainly avoid the costly (de)serialisation step in the msg exchange. Seeing as TF msgs are rather small (ie 100s of bytes), I'd expect that overhead to be negligable. Do you have a specific case where middleware perf is a bottleneck?
Comment by Javier V. Gómez on 2015-11-30:
@gvdhoorn Currently tf is not my bottleneck, but if there is an option for that I do not see why not doing it, as it is not difficult to deal with nodelets. And I agree TF message is not that big, but for my application is one of the largest messages. | {
"domain": "robotics.stackexchange",
"id": 23117,
"lm_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, transform, nodelet, tf2",
"url": null
} |
java, performance, android, formatting
public static final class Builder {
private final GUIBase stateDefault;
private final GUIBase statePressed;
private GUIBase stateReleased;
private Vector2f position = new Vector2f(0, 0);
private Vector2f size = new Vector2f(1, 1);
private PressBehavior pressBehavior = PressBehavior.PRESS_MORE_THAN_ONCE;
private ClickBehavior clickBehavior = ClickBehavior.CHANGE;
private ClickReleaseBehavior clickReleaseBehavior = ClickReleaseBehavior.RETURN;
private PassBehavior passBehavior = PassBehavior.NOTHING;
private ReleaseBehavior releaseBehavior = ReleaseBehavior.NOTHING;
private Builder(GUIBase stateDefault, GUIBase statePressed) {
this.stateDefault = stateDefault;
this.statePressed = statePressed;
}
public Builder stateReleased(GUIBase stateReleased) {
this.stateReleased = stateReleased;
return this;
} | {
"domain": "codereview.stackexchange",
"id": 42976,
"lm_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, performance, android, formatting",
"url": null
} |
operators, conformal-field-theory, integration, commutator
P. Di Francesco, P. Mathieu and D. Senechal, CFT, 1997; subsection 6.1.2 and eq. (5.72). | {
"domain": "physics.stackexchange",
"id": 85049,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "operators, conformal-field-theory, integration, commutator",
"url": null
} |
objective-c, ios
NSMutableDictionary* newParams = [NSMutableDictionary dictionaryWithDictionary:parameters];
OrderWS* ws = [[OrderWS alloc] initWithURL:RUN_ORDER_WS_ID Url:RUN_ORDER_WS_ID_WS_URL];
self.placeClassifiedResponseWS = ws;
ws.delegate = self;
[newParams removeObjectForKey:@"OrderResponse"];
[ws fetch:newParams PostDataValuesAndKeys:postData];
[ws release];
break;
}
case GET_LIST_OF_USERS_ID:
{
NSDictionary* postData = [NSDictionary dictionaryWithObject:[parameters objectForKey:@"userList"] forKey:@"userList"];
NSMutableDictionary* newParams = [NSMutableDictionary dictionaryWithDictionary:parameters]; | {
"domain": "codereview.stackexchange",
"id": 4926,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "objective-c, ios",
"url": null
} |
database, entrez, efetch, ncbi
Title: How to set Entrez Direct - ESearch NCBI entrez to pipe or ignore errors? I am using the following one-liner with NCBI entrez to query their databases from the terminal (see Entrez Direct: E-utilities on the Unix Command Line:
esearch -db assembly -query ${species name} |
xtract -pattern ENTREZ_DIRECT -element Count
This works a charm but occasionally it sends an xml error that messes up the output.
Here is an example of the error:
xml
FAILURE ( Fri Jan 27 01:12:44 PM CST 2023 )
nquire -url https://eutils.ncbi.nlm.nih.gov/entrez/eutils/ esearch.fcgi -retmax 0 -usehistory y -db assembly -term "Crepis commutata" -tool edirect -edirect 18.7 -edirect_os Linux -email {}
<ErrorList>
<PhraseNotFound>commutata</PhraseNotFound>
<PhraseNotFound>Crepis commutata[All Fields]</PhraseNotFound>
<ErrorList>
SECOND ATTEMPT | {
"domain": "bioinformatics.stackexchange",
"id": 2397,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "database, entrez, efetch, ncbi",
"url": null
} |
# Finding sum of geometric series $\sum\limits_{k=5}^ \infty \left(\frac{e}{\pi}\right)^{k-1}$
Determine the sum of the following geometric series.
I got confused here because I'm used to starting with $k=1$ and now suddenly it's $k=5$. Is there any difference?
$$\sum_{k=5}^ \infty \left(\frac{e}{\pi}\right)^{k-1}$$
• Just assume that the sum starts at $1$, determine the solution and then subtract the sum from $1$ to $4$ from the result. Du you understand what I mean? – Moritz Sep 12 '16 at 13:49
• determine the solution, yes got it, subtract sum from 1 to 4, didn't get it, could you be more specific – Teeban Sep 12 '16 at 13:51
• $\sum_{k=1}^\infty a_k = \sum_{k=1}^4 a_k + \sum_{k=5}^\infty a_k$ – Nicholas Stull Sep 12 '16 at 13:53
• @Teeban: Look at the hint from Nicholas Stull. – Moritz Sep 12 '16 at 13:54 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9770226327661524,
"lm_q1q2_score": 0.8284836936680101,
"lm_q2_score": 0.8479677602988602,
"openwebmath_perplexity": 441.3805041058908,
"openwebmath_score": 0.8612837195396423,
"tags": null,
"url": "https://math.stackexchange.com/questions/1923889/finding-sum-of-geometric-series-sum-limits-k-5-infty-left-frace-pi-r"
} |
that Free math notes on word problems involving exponential growth and decay. I'm just going to change the letters a little: The is pronounced "P not. In the case of a discrete domain of definition with equal intervals, it is also called geometric growth or geometric decay, the function values forming a geometric progression. One you have the trend you will use this to calculate An example of an exponential decay word problem is the following: 'The value of a new$35,000 car decreases by 20% per year. Q Exponential functions tell the stories of explosive change. Is the pictured graph growth, decay, or linear or none? Exponential Exponential Growth and Decay Word Problems DRAFT. Identify the growth factor and annual percent increase b. Exponential Functions: General Form Type General Graph a-value b-value for word problems: Two Major Types for word problems: For each of the following equations, write whether it is exponential growth or decay and then write the y-intercept. Exponential | {
"domain": "thebuildsuccess.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9790357567351325,
"lm_q1q2_score": 0.8470853127300599,
"lm_q2_score": 0.8652240808393984,
"openwebmath_perplexity": 853.2557488221838,
"openwebmath_score": 0.5186667442321777,
"tags": null,
"url": "http://thebuildsuccess.com/lw8kc/how-to-do-exponential-growth-and-decay-word-problems.html"
} |
inorganic-chemistry, bond, molecules
Comparing the $\sigma$-type overlap
The two AOs that overlap to form the $\sigma$ bond are the two $\mathrm{p}_z$ orbitals. The extent to which the $\sigma$ MO is stabilised depends on an integral, called the overlap, between the two $n\mathrm{p}_z$ orbitals ($n = 2,3$). Formally, this is defined as
$$S^{(\sigma)}_{n\mathrm{p}n\mathrm{p}} = \left\langle n\mathrm{p}_{z,\ce{A}}\middle| n\mathrm{p}_{z,\ce{B}}\right\rangle = \int (\phi_{n\mathrm{p}_{z,\ce{A}}})^*(\phi_{n\mathrm{p}_{z,\ce{B}}})\,\mathrm{d}\tau$$
It turns out that, going down the group, this quantity decreases. This has to do with the $n\mathrm{p}$ orbitals becoming more diffuse down the group, which reduces their overlap.
Therefore, going down the group, the stabilisation of the $\sigma$ MO decreases, and one would expect the $\ce{X-X}$ bond to become weaker. That is indeed observed for the Group 14 elements. However, it certainly doesn't seem to work here. That's because we ignored the other two important orbitals. | {
"domain": "chemistry.stackexchange",
"id": 6441,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "inorganic-chemistry, bond, molecules",
"url": null
} |
Image used by permission from Interactive Mathematics. Click the image to go there and learn all about the normal distribution!
In what other math class would you talk about a function ALL YEAR and never give its rule? The normal distribution is the centerpiece (literally!) of the Statistics curriculum. And yet we never even tell them its equation nor where it comes from. That should be some kind of mathematical crime. We might as well call the normal distribution the “magic curve.”
Furthermore, a kid can go through all of AP Statistics and never think about integration, even though that’s what their doing every single time they look up values in those stat tables in the back of the book.
I agree that statistics is more applicable to the ‘real world’ of most of these kids’ lives, and on that point, I agree with Arthur Benjamin. But I would argue that application is not the most important reason we teach mathematics. The most important thing we teach kids is mathematical thinking. | {
"domain": "mrchasemath.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9930961623374379,
"lm_q1q2_score": 0.8024884578704925,
"lm_q2_score": 0.8080672227971212,
"openwebmath_perplexity": 564.9091484545214,
"openwebmath_score": 0.6946636438369751,
"tags": null,
"url": "https://mrchasemath.com/category/philosophy-of-math/"
} |
So now consider the congruence $a_1x\equiv b_1\pmod{m_1}$. Since $d$ is the greatest common divisor of $a$ and $m$, it follows that the numbers $a_1$ and $m_1$ are relatively prime.
Because $a_1$ and $m_1$ are relatively prime, the congruence $a_1x\equiv b_1\pmod{m_1}$ has a unique solution modulo $m$. For a proof of uniqueness, we can use the fact that $a_1$ has an inverse $c$ modulo $m_1$. Then $ax\equiv b\pmod{m_1}$ if and only if $ca_1x\equiv cb_1\pmod{m_1}$, that is, if and only if $x\equiv cb_1\pmod{m_1}$. (One can also give a direct proof of uniqueness without using the inverse.)
So now we ask: given the unique solution $x$ modulo $m_1$, which numbers are congruent to $x$ modulo $m$? Certainly the numbers $x+\frac{im}{d}$ are, where $i$ ranges from $0$ to $d-1$. For these are the numbers $x+im_1$, and they are all congruent to $x$ modulo $m_1$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9817357227168956,
"lm_q1q2_score": 0.8116124943433275,
"lm_q2_score": 0.826711787666479,
"openwebmath_perplexity": 121.68082277394132,
"openwebmath_score": 0.9497363567352295,
"tags": null,
"url": "http://math.stackexchange.com/questions/392909/number-of-solutions-for-congruency-equations"
} |
cc.complexity-theory, complexity-classes, reductions
Extended knapsack problem. Take $l \in \mathbb{N}$ instances of the 0-1 knapsack problem, so we have $l$ pairs $(V^1, W^1), (V^2, W^2),...,(V^l, W^l)$, where $|V^i|=|W^i|=n$ for all $i$ and $n$ is fixed. Finally, we take each of these instances to have the same solution (using the index convention given above). So that if instance $(V^1, W^1)$ has solution $\{a_1, a_2,..., a_m\}$, then every other instance has the solution $\{a_1, a_2,...,a_m\}$ (again this is a set of indices over the items $\{x_1, x_2,...,x_n\}$ where we take each $x_i$ to have some fixed position in the set so this indexing makes sense). | {
"domain": "cstheory.stackexchange",
"id": 5435,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "cc.complexity-theory, complexity-classes, reductions",
"url": null
} |
### Welcome to our community
#### Casio
##### Member
I have been reading up on Quadratic Equations in my course book, which gives some examples of simple equations and how they are factorised, but can't get my head round this type which is has no examples.
x2 - 3x = 0
OK I know it is a quadratic because the term x2 is included. What I require is a value for the term x.
Is there a method to factorise this I am not sure?
x2 - 3x = x(x - 3)
It does not give me a value for x?
I can assume values like x = 0 and x = 3, both of which will = 0, but that does not show me how I get the method of factorising this equation?
Thanks
Casio
#### Ackbach
##### Indicium Physicus
Staff member
There is a way of factoring quadratics that takes the guesswork out of it. In your example, you just note that $x$ is common to both terms, and factors out leaving you with $x(x-3)=0$. | {
"domain": "mathhelpboards.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9850429156022934,
"lm_q1q2_score": 0.8486521079697523,
"lm_q2_score": 0.8615382076534742,
"openwebmath_perplexity": 356.01625523466294,
"openwebmath_score": 0.7397609949111938,
"tags": null,
"url": "https://mathhelpboards.com/threads/quadratic-equations.1874/"
} |
qiskit, programming, entropy
I get:
<class 'qiskit.quantum_info.states.statevector.Statevector'>
<class 'numpy.ndarray'>
[0.447+0.j 0. +0.j 0.632+0.j 0.632+0.j]
as expected but then I get the error on quantum_info.entropy(outputstate6):
QiskitError: 'Input quantum state is not a valid'
How can I solve this? Short answer
You are getting that error because your example does not use a valid (normalized) statevector. If you remove the decimals=3 kwarg where you call result.get_statevector it will work.
Long Answer
The Von-Neuman entropy function in the qiskit.quantum_info works with either Statevector or DensityMatrix object inputs, or inputs that can be implicitly converted to those objects (ie a list or np.array for a vector or a square matrix). So you can do any of the following for example:
import numpy as np
from qiskit.quantum_info import entropy, Statevector, DensityMatrix
# Pure state entropy (Note this is always 0)
# The following are equivalent: | {
"domain": "quantumcomputing.stackexchange",
"id": 1342,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "qiskit, programming, entropy",
"url": null
} |
# Number of possible combinations of x numbers that sum to y
I want to find out the number of possible combinations of $x$ numbers that sum to $y$. For example, I want to calculate all combination of 5 numbers, which their sum equals to 10.
An asymptotic approixmation is also useful. This question seems to be very close to number partitioning, with the difference that a number can be 0. See:
https://en.wikipedia.org/wiki/Partition_%28number_theory%29#Asymptotics
All possible partitions for sum 10 and 3 positions that can be zero, are 63 possiblities: (numbers shown as 3 digits)
019 028 037 046 055 064 073 082 091 109 118 127 136 145 154 163 172 181 190 208 217 226 235 244 253 262 271 280 307 316 325 334 343 352 361 370 406 415 424 433 442 451 460 505 514 523 532 541 550 604 613 622 631 640 703 712 721 730 802 811 820 901 910 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.987568347500326,
"lm_q1q2_score": 0.8452114956547073,
"lm_q2_score": 0.8558511396138365,
"openwebmath_perplexity": 222.76870217271295,
"openwebmath_score": 0.7871385812759399,
"tags": null,
"url": "https://math.stackexchange.com/questions/1462099/number-of-possible-combinations-of-x-numbers-that-sum-to-y/1462106"
} |
for u = 1:size(B,1)
x.LowerBound(B(u,1),B(u,2),B(u,3)) = 1;
end
Solve the Sudoku puzzle.
sudsoln = solve(sudpuzzle)
Solving problem using intlinprog.
LP: Optimal objective value is 405.000000.
Optimal solution found.
Intlinprog stopped at the root node because the objective value is within a gap
tolerance of the optimal value, options.AbsoluteGapTolerance = 0 (the default
value). The intcon variables are integer within tolerance,
options.IntegerTolerance = 1e-05 (the default value).
sudsoln = struct with fields:
x: [9x9x9 double]
Round the solution to ensure that all entries are integers, and display the solution.
sudsoln.x = round(sudsoln.x);
y = ones(size(sudsoln.x));
for k = 2:9
y(:,:,k) = k; % multiplier for each depth k
end
S = sudsoln.x.*y; % multiply each entry by its depth
S = sum(S,3); % S is 9-by-9 and holds the solved puzzle
drawSudoku(S)
You can easily check that the solution is correct.
### Function to Draw the Sudoku Puzzle | {
"domain": "mathworks.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9865717484165853,
"lm_q1q2_score": 0.8424461958408871,
"lm_q2_score": 0.8539127510928476,
"openwebmath_perplexity": 1335.9852386783166,
"openwebmath_score": 0.8208943605422974,
"tags": null,
"url": "https://in.mathworks.com/help/optim/ug/sudoku-puzzles-problem-based.html"
} |
performance, beginner, c, homework
Data structures
First of all, I'm glad to see that you broke down the work into four helper functions. It would be even better if you passed parameters instead of using global variables. Passing arrays in C is somewhat tricky, though, so I wouldn't fault a beginner for avoiding that hurdle.
Have you learned about structs yet? If so, I would prefer to see an array of four struct student_records than to have the information dispersed into various four-element arrays.
As noted in the compiler warnings, sGrades[n][1] involves out-of-bounds access. You don't need a char[][1] if all you need to store is one byte — just a one-dimensional char[] will do.
You don't need initialize(). You can just use an initializer. In fact, global variables are automatically initialized to zero. (Better to be safe than sorry, though!)
Input / output
scanf() is a tricky function to use correctly. In particular, this line
scanf("%s", sNames[i]); // Scan in the students name | {
"domain": "codereview.stackexchange",
"id": 16709,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "performance, beginner, c, homework",
"url": null
} |
formal-languages, regular-expressions
Title: Implementing regular expression matching using Brzozowski derivatives I have been taking a language theory class, and we learned about Brzozowski derivatives recently. At class it occurred to me that they could be used to implement a simple regular expression matcher. If you take the derivative of a regular expression with respect to a given string and the resulting expression matches the empty string ($\varepsilon$), then the original expression matches the string used in the derivative:
$$
w \text{ matches } e \Leftrightarrow \varepsilon \text{ matches } D_w(e)
$$
I did a web search and, as expected, other people had the same idea before. There is an implementation here and another one here. They are short and simple. | {
"domain": "cs.stackexchange",
"id": 16766,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "formal-languages, regular-expressions",
"url": null
} |
c#, asp.net-core
TWO, when working with dates and times, most of the time you should not worry about localization of times or month names until you are displaying. Maybe you are not thinking of running your application for 2 different cultures, but it takes little effort to do so and its a good practice.
By adhering to TWO, your code would be greatly reduced by having the dictionary be keyed by month's integer value rather than the name.
var months = Enumerable.Range(1, 12).ToDictionary(key => key, value => 0); | {
"domain": "codereview.stackexchange",
"id": 42587,
"lm_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#, asp.net-core",
"url": null
} |
biochemistry, biosynthesis
Title: Determine whether aromatics originate from polyketide or shikimate pathway Is there a way to determine whether an aromatic compound originates from the polyketide or shikimate pathway by looking at its structure? If so, how? Aromatics that stem from the Shikimat Pathway result in a structure like this
Whilst aromatics originating from the Polyketide Pathway have an alternativ structure in the distribution of the OH groups. | {
"domain": "biology.stackexchange",
"id": 5948,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "biochemistry, biosynthesis",
"url": null
} |
python, parsing, python-3.x, api
def iterate(ele):
nonlocal indent
if type(ele) is tsi_elements.TsiAttr:
name = ele.name
if ele.ref:
refs.append(ele)
f.write('{}ref attr {}\n'.format(' ' * indent, name))
else:
value_list = ele.value.split('\n') # multiline values are separated by \n char
line = '{}attr {}'.format(' ' * indent, name)
if len(value_list) == 1: # value is a single line
value = value_list[0]
else: # joining multiline strings
value = '\n'.join([' ' * line.length() + '"' + split + '"' for split in value_list])
f.write('{} "{}"\n'.format(line, value))
else: # type is tsi_elements.TsiNode
if not ele.ref and ele.link is None: | {
"domain": "codereview.stackexchange",
"id": 35480,
"lm_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, parsing, python-3.x, api",
"url": null
} |
gazebo
Title: system plugin to publish /clock from gazebo 1.7.1 standalone to ROS
Hi,
I have not installed simulator_gazebo in ros-groovy and currently working with gazebo standalone 1.7.1. I need to publish /clock as in simulator_gazebo. I figured that it was done by the gazebo_ros_api_plugin. However, gazebo_ros_api_plugin do much more than publishing /clock and I isolated the following parts for my purpose. But, still it seems something is missing as /clock is not advertised. Any help would be appreciated.
Also, how do you run the gzclient with this plugin? I tried with gzclient -g libmy_gazebo_ros_clock.so and it didnt work.
Thank you
#include
namespace gazebo
{
SystemClock::SystemClock()
{
this->world_created_ = false;
} | {
"domain": "robotics.stackexchange",
"id": 3271,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "gazebo",
"url": null
} |
A group of friends rent a beach house and decide to split the cost of the rent and food. Four friends pay $170 each. Five friends pay$162 each. Six friends pay 157. If nine people were to share the expense, how much would each pay? Let’s look at this in a table. n\begin{align*}n\end{align*} (number of friends) t\begin{align*}t\end{align*} (share of expense) 4 170 5 162 6 157 9 ??? As the number of friends gets larger, the cost per person gets smaller. This is an example of inverse variation. An inverse variation function has the form f(x)=kx\begin{align*}f(x)=\frac{k}{x}\end{align*}, where k\begin{align*}k\end{align*} is called the constant of variation and must be a counting number and x0\begin{align*}x \neq 0\end{align*}. To show an inverse variation relationship, use either of the phrases: • Is inversely proportional to • Varies inversely as Example 1: Find the constant of variation of the beach house situation. Solution: Use the inverse variation equation to find | {
"domain": "ck12.org",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9553191284552528,
"lm_q1q2_score": 0.8176109770768397,
"lm_q2_score": 0.8558511524823263,
"openwebmath_perplexity": 2182.7016809325446,
"openwebmath_score": 0.9788904786109924,
"tags": null,
"url": "http://www.ck12.org/book/CK-12-Algebra-Basic/section/12.1/"
} |
ros, ros-melodic, velodyne
Can anyone help me to solve this ?
Thanks in advance!
EDIT
If i catkin_make without velodyne's repo catkin_make works perfectly
Im trying to understand if the error above is the reason that i have the error in the catkin_make or not.
CMake Error at velodyne/velodyne_driver/src/driver/CMakeLists.txt:11 (add_library):
add_library cannot create target "driver_nodelet" because another target
with the same name already exists. The existing target is a shared library
created in source directory
"/home/geo/catkin_ws/src/ros_rslidar/rslidar_driver/src". See
documentation for policy CMP0002 for more details.
CMake Error at velodyne/velodyne_driver/src/driver/CMakeLists.txt:13 (target_link_libraries):
Attempt to add link library "velodyne_input" to target "driver_nodelet"
which is not built in this directory. | {
"domain": "robotics.stackexchange",
"id": 36564,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ros, ros-melodic, velodyne",
"url": null
} |
thermodynamics, equilibrium, free-energy
Title: How to derive the relation between gibbs energy and equilibrium constant? I want to understand the derivation between gibbs energy and equillibrium constant $$\Delta G=\Delta G^o+RT\ln Q?$$
I have seen a similar post on CSE Derivation of relationship between equilibrium constant and Gibbs free energy change which seems to be incomplete and still confusing so I am again asking this question.
The derivation that was written in the post was as follows: | {
"domain": "chemistry.stackexchange",
"id": 17786,
"lm_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, equilibrium, free-energy",
"url": null
} |
electrons, photochemistry, atomic-structure
Title: What happens if we continuously hit an atom with photons My sir told me that Energy required to remove an electron from one orbit to another depends on hf * n. Where n means the no of photons that will strike on a metal surface and hf is energy of one photon.(Means energy of each photon is going to be 2eV)[Like the example below I have written ].
My question is that if I continuously hit many photons on a metal surface.Why doesn’t the electron come out then since the energy also increases or hf’s.
If work function(energy required of an electron ) is 3eV. | {
"domain": "chemistry.stackexchange",
"id": 14841,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "electrons, photochemistry, atomic-structure",
"url": null
} |
general-relativity, cosmology, gravity, spacetime, curvature
I am looking for a connection between the spatial, temporal, and spacetime curvature.
Question: | {
"domain": "physics.stackexchange",
"id": 70262,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "general-relativity, cosmology, gravity, spacetime, curvature",
"url": null
} |
quantum-mechanics, electromagnetism, optics, scattering, quantum-tunneling
Title: Phase Shift of Tunneling Wave What is the phase shift of a wave that tunnels through a barrier, meaning the difference in phase between the incoming (in front of the barrier) and the outgoing (behind the barrier) waves?
For example, in the situations of a wave function tunneling through a classically forbidden region, where the wave is no longer oscillating, but decaying exponentially within the barrier. Or of a beam of light incident at the critical angle of an interface in a frustrated total internal reflection setup. There is no short answer to this question aside from: you must analyse in detail the boundary value problem wherein the tunnelling in question arises and calculate the answer.
For a reasonably simple and not too messy, example, consider the tunnelling of light through a layer of thickness $w$ as in my drawing below: | {
"domain": "physics.stackexchange",
"id": 11665,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, electromagnetism, optics, scattering, quantum-tunneling",
"url": null
} |
planet, solar-system, 9th-planet
Title: Could the 9th planet be virtual? Astronomers recently claim that there is evidence for a 9th planet. As far as I understood it, this is mainly based on coinciding orbital parameters of a few Kuiper belt objects.
Could the 9th planet be a virtual planet? I mean this in the sense that we see the gravitational influence of a multi-body system. Could the 9th planet simply be the barycenter of the Kuiper belt and its apparent orbit some form of precession?
Apart from the question, if this was a possible or likely scenario, how could we distinguish a "real" 9th planet from a virtual one, except by the obvious answer if we can observe it directly? | {
"domain": "astronomy.stackexchange",
"id": 1599,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "planet, solar-system, 9th-planet",
"url": null
} |
experimental-chemistry
Title: How to produce Fe(OH)2? I'm interested in producing Ferrum hydroxide (II), I did some research on the internet and made a plan for myself:
Conduct electrolysis:
Conduct electrolysis producing $\ce{NaOH}$ and chlorine solution.
Produce $\ce{HCl}$:
Produce $\ce{HCl}$ from chlorine solution by exposing it to UV light.
Make iron and hydrochloric acid react:
Adding iron in hydrochloric acid makes this reaction: $\ce{2HCl + Fe -> FeCl2 + H2}$ producing a solution with $\ce{HCl}$ and $\ce{FeCl2}$, then evaporate it and be left with solid $\ce{FeCl2}$ crystals.
Produce $\ce{Fe(OH)2}$:
As we have $\ce{FeCl2}$ and $\ce{NaOH}$, we can make this reaction: $\ce{2NaOH + FeCl2 -> Fe(OH)2 + 2NaCl}$ producing a participate ($\ce{Fe(OH)2}$). | {
"domain": "chemistry.stackexchange",
"id": 17712,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "experimental-chemistry",
"url": null
} |
python, scikit-learn, nlp, pandas, smote
Any help on my Interpretation or Action would be greatly appreciated! If the $x$-axis is actual and the $y$-axis is predicted, then vertical lines means a given input of the class $x$ is not being discriminated sufficiently and as a result is randomly mapped to a number of classes. Whereas a horizontal line signifies that many classes are mapped as belonging to a particular class.
Class imbalance
Many reasons can lead to these lines in your confusion matrix. The most common is class imbalance. If you train your model using data that is not well balanced across the different classes this will result in both horizontal and vertical lines. Consider a model trained to distinguish cats, dogs and foxes with 1000, 1000, and 10 instances each. Evidently, you can see how many future instances of foxes may be classified as dogs or cats. | {
"domain": "datascience.stackexchange",
"id": 3299,
"lm_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, scikit-learn, nlp, pandas, smote",
"url": null
} |
they are stating the same thing. Truth Table Constructor is a powerful application that constructs truth tables for statements in propositional logic. How to Read MIL-Type Logic Symbols Table 1. In compound statements formed with the five truth-functional connectives, one important logical feature remains the same. A truth table is a tabular representation of all the combinations of values for inputs and their corresponding outputs. The truth table of the Master-Slave JK flip-flop is the same as that of the traditional JK flip-flop. So instead of CLK=1 in the JK flip-flop's truth table, you should write 0. Among De Morgan's most important work are two related theorems that have to do with how NOT gates are used in conjunction with AND and OR gates: An AND gate […]. For example, a design might require a warning light to be illuminated whenever sensor A outputs a logic '1', but only if sensor B also outputs a logic '1. A Truth Table defines how a gate will react to all possible input | {
"domain": "cloudscuola.it",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9759464485047916,
"lm_q1q2_score": 0.8132801752066438,
"lm_q2_score": 0.8333245911726382,
"openwebmath_perplexity": 795.8803509624115,
"openwebmath_score": 0.6178021430969238,
"tags": null,
"url": "http://cloudscuola.it/sgxh/truth-table-logic-gates-calculator.html"
} |
seismic
-My question(s) is this: what if reflectivity is somehow predictable? What would that (for lack of a better word/phrase) look like? How would that jeopardize the usefulness of different deconvolution methods...? Thanks in advance to anyone who can help clarify this. The assumption that the earth's reflectivity is random (i.e. has a white spectrum) is only necessary for the statistical extraction of a wavelet from the data itself via the amplitude spectrum of the autocorrelation function. The convolutional model still works regardless of the reflectivity pattern, although getting a wavelet may be more difficult if the "white reflectivity" assumption does not hold. | {
"domain": "earthscience.stackexchange",
"id": 1221,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "seismic",
"url": null
} |
the graph has a sharp corner (or cusp) at the point (a, f (a)). That is, f is not differentiable at x … Example of a function that does not have a continuous derivative: Not all continuous functions have continuous derivatives. We have the following theorem in real analysis. // Last Updated: January 22, 2020 - Watch Video //. Thank you very much for your response. Because when a function is differentiable we can use all the power of calculus when working with it. A couple of questions: Yeah, i think in the beginning of the book they were careful to say a function that is complex diff. Note: Every differentiable function is continuous but every continuous function is not differentiable. The derivative of f(x) exists wherever the above limit exists. If a function is differentiable, then it has a slope at all points of its graph. A Lipschitz function g : R → R is absolutely continuous and therefore is differentiable almost everywhere, that is, differentiable at every point outside a set | {
"domain": "misscarrington.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9808759621310288,
"lm_q1q2_score": 0.8297646021024566,
"lm_q2_score": 0.8459424373085145,
"openwebmath_perplexity": 284.12264156151207,
"openwebmath_score": 0.8485810160636902,
"tags": null,
"url": "https://www.misscarrington.com/28q0pdz3/fec186-differentiable-vs-continuous-derivative"
} |
special-relativity, kinematics, acceleration, propulsion
Title: Ion Drive Propulsion Top Speed I would like to know if there is some formula / graph which would provide / show the efficiency of a certain type of propeller in space. Specifically, I'm interested in the acceleration attainable at certain speeds.
I'm writing a science fiction book and I'm trying to make it as correct as possible, fact wise. The propeller I'm talking about is the ion drive
Now, my book takes place in a world where fusion power is finally ours.
So, please, let us assume that we have unlimited energy so you could power a dozen huge ion drives non stop. OK, there's the question of argon/xenon fuel, let's assume we have 1 year of that.
So... the question is... what speed could you reach?
If a continuous acceleration of $10\frac{\mathrm{m}}{\mathrm{s}}$ is applied (I put that number because it would also constitute an advantage for my crew - living in Earth's gravity), that would mean that a ship would reach the speed of light in just 347 DAYS | {
"domain": "physics.stackexchange",
"id": 13729,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "special-relativity, kinematics, acceleration, propulsion",
"url": null
} |
javascript, game, revealing-module-pattern
doc.getElementById('Rock').addEventListener("click" , () => newGame( model.ROCK ));
Arrow functions could be of use here for shorter syntax. | {
"domain": "codereview.stackexchange",
"id": 20962,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "javascript, game, revealing-module-pattern",
"url": null
} |
quantum-gate, quantum-circuit, matrix-representation
How to do this process efficiently? A short-cut
For your case, you will need a $16 \times 16$ matrix. Each column from left to right corresponds to the basis states $0,1,\cdots 15$ in binary. Just replace the appropriate column to the resultant state under your $\text{CNOT}_{A \to D}$ operation—no need to perform 16 outer products and then do the addition.
Example- $|1001\rangle$ should go to $|1000\rangle$. So place the $9^{\text{th}}$ coloumn$^1$ in your matrix $\big( (1001)_2 = (9)_{10 } \big)\,,$ with state vector for the resultant state $|1000\rangle\,.$
This should save a lot of computation, whenever your initial states are computational basis states.
$^1$: Here, I am labeling coloumns of $16 \times 16$ matrix from $0$ to $15$. | {
"domain": "quantumcomputing.stackexchange",
"id": 5354,
"lm_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-gate, quantum-circuit, matrix-representation",
"url": null
} |
performance, vba, excel
If dict Is Nothing Then Set dict = CreateObject("scripting.dictionary")
If Not dict.exists(name) Then 'not already looked for this name
Set f = ActiveWorkbook.Sheets("pasted").Range("A:A").Find(what:=name, _
LookIn:=xlValues, lookat:=xlWhole)
If Not f Is Nothing Then
dict.Add name, f.Offset(0, 1).Value
Else
dict.Add name, -999 'not found
End If
End If
getSalary = CDbl(dict(name)) 'return the stored value
End Function
Once a name has been looked up, the result is stored in the dictionary, keyed on the name: retrieving that value is very fast compared to looking it up on the worksheet.
Use:
getSalary("reset")
to clear the stored values at the top of your code. | {
"domain": "codereview.stackexchange",
"id": 20563,
"lm_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, vba, excel",
"url": null
} |
First, the joint PDF $f(x,y)$ is obvious, just plug in your parameters. Bivariate Normal. Then you can find the marginal density for $X$, which gives you the conditional density of $Y$ given $X=x$: $$f_{Y|X}(y|x)=\frac{f(x,y)}{f_X(x)}.$$ Now use the conditional density you can evaluate both conditional expectation and conditional variance : $$\mathbb{E} (Y|X=x)=\int_{-\infty}^\infty y f_{Y|X}(y|x)dy,$$ and $$\text{Var} (Y|X=x)=\int_{-\infty}^\infty (y-h(x))^2 f_{Y|X}(y|x)dy=\frac14,$$ where $h(x)=\mathbb{E} (Y|X=x)=-\frac{\sqrt 3}4(x-2)-1$.
And with the joint PDF, $P(X>\mu_x, Y > \mu_y)$ is just an integration: $$P(X>\mu_x, Y > \mu_y)=\int_{\mu_x}^\infty\int_{\mu_y}^\infty f(x,y)dydx=\frac1{12},$$ though I guess there's an easier way to compute. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.972414716174355,
"lm_q1q2_score": 0.8060722919104042,
"lm_q2_score": 0.8289388040954684,
"openwebmath_perplexity": 305.4486933752125,
"openwebmath_score": 0.8635045886039734,
"tags": null,
"url": "https://math.stackexchange.com/questions/33993/bivariate-normal-conditional-variance"
} |
The same thing happens when $$x \ge y$$, so that doesn't need to be considered separately.
So we see that when $$x$$ and $$y$$ are positive, we want either $$z$$ to be positive as well, or we want $$x+y+z$$ to be negative.
By symmetry, this covers all the possibilities. The equation holds when:
• All three of $$x,y,z$$ are positive;
• Two of $$x,y,z$$ are positive, but $$x+y+z$$ is negative;
• Two of $$x,y,z$$ are negative, but $$x+y+z$$ is positive;
• All three of $$x,y,z$$ are negative.
The regions inside $$[-1,1]^3$$ where these hold have volume respectively:
• $$1$$ (it's a cube of side length $$1$$);
• $$\frac12$$ (it's three pyramids that form a corner of a cube with $$\frac16$$ the volume);
• $$\frac12$$;
• $$1$$.
So total volume $$3$$ (out of $$8$$), so the equation holds with probability $$\frac38$$. | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.964321452198369,
"lm_q1q2_score": 0.8343541387607512,
"lm_q2_score": 0.8652240773641087,
"openwebmath_perplexity": 619.813429516139,
"openwebmath_score": 0.9379236698150635,
"tags": null,
"url": "https://math.stackexchange.com/questions/3115883/probability-that-displaystyle-vert-x-vert-vert-y-vert-vert-z-vert-vert"
} |
graphs, graph-traversal, connected-components, disjoint-sets
Output
2 3
+-+-+-+
|.....|
+.+-+-+
|.|...|
+-+-+-+
As you can see two walls are deleted, the vertical wall having the coordinate $(1, 2) $ and the horizontal wall with the coordinates $(2, 1)$.
This problem seems like a perfect application of Disjoint Set Union, but I am not convinced that this is any right approach to this problem. Any help is much appreciated! You can use a graph traversal algorithm such as BFS/DFS to detect the connected components, and to construct a graph in which the vertices are connected components and the edges are walls adjacent to two connected components. A spanning tree in this graph corresponds to the walls that need to be removed. | {
"domain": "cs.stackexchange",
"id": 19782,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "graphs, graph-traversal, connected-components, disjoint-sets",
"url": null
} |
Intern
Status: pursuing a dream
Joined: 02 Jun 2011
Posts: 39
Schools: MIT Sloan (LGO)
Re: For every integer k from 1 to 10, inclusive the "kth term of a certain [#permalink]
### Show Tags
13 Aug 2011, 12:42
31
3
Hello!
I was just doing this problem and though I would add some "graphic" approach in case it is useful for someone as it has been for me.
You can easily draw a graph of the first points on any series to see if they follow a regular pattern. This one specifically is extremely easy to catch as you draw 3+ points, something like this:
Attachments
GP.jpg [ 18.77 KiB | Viewed 110498 times ]
Manager
Status: On...
Joined: 16 Jan 2011
Posts: 154
Re: For every integer k from 1 to 10, inclusive the "kth term of a certain [#permalink]
### Show Tags
19 Aug 2011, 16:31
5
I liked Graphical approach is a good one.
BUT - felt there is no need of any calculations
T =
+(1/2 + 1/2^3 + 1/2^5 + 1/2^7 +1/2^9)
-(1/2^2 + 1/2^4 + 1/2^6 + 1/2^8 + 1/2^10) | {
"domain": "gmatclub.com",
"id": null,
"lm_label": "1. Yes\n2. Yes",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9626731169394881,
"lm_q1q2_score": 0.8220388550573391,
"lm_q2_score": 0.8539127566694178,
"openwebmath_perplexity": 901.0038358520754,
"openwebmath_score": 0.8301273584365845,
"tags": null,
"url": "https://gmatclub.com/forum/for-every-integer-k-from-1-to-10-inclusive-the-kth-term-of-a-certain-88874.html"
} |
math, getting-started
Title: Is it ok to struggle with mathematics while learning AI as a beginner? I have a decent background in Mathematics and Computer Science .I started learning AI from Andrew Ng's course from one month back. I understand logic and intuition behind everything taught but if someone asks me to write or derive mathematical formulas related to back propagation I will fail to do so.
I need to complete object recognition project within 4 months.
Am I on right path? I think the key part of your question is "as a beginner". For all intents and purposes you can create a state of the art (SoTA) model in various fields with no knowledge of the mathematics what so ever. | {
"domain": "ai.stackexchange",
"id": 1322,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "math, getting-started",
"url": null
} |
optimization, c, programming-challenge, combinatorics, time-limit-exceeded
Title: Optimizing Diwali Lights problem in C I was trying to solve the Diwali Lights challenge on HackerRank.
Problem Statement
On the eve of Diwali, Hari is decorating his house with a serial light
bulb set. The serial light bulb set has N bulbs placed sequentially on
a string which is programmed to change patterns every second. If
atleast one bulb in the set is on at any given instant of time, how
many different patterns of light can the serial light bulb set
produce?
Note: Lighting two bulbs *-* is different from **-
Input Format
The first line contains the number of test cases T, T
lines follow. Each line contains an integer N, the number of bulbs in
the serial light bulb set.
Output Format
Print the total number of patterns modulo 105
Constraints
1 <= T <= 1000
0 < N < 104
Sample Input
2
1
2
Sample Output
1
3
The Code I had written is
#include<stdio.h>
# define MAX 10000 // assuming we need first 100 rows
unsigned long long triangle[MAX + 1][MAX + 1]; | {
"domain": "codereview.stackexchange",
"id": 12275,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "optimization, c, programming-challenge, combinatorics, time-limit-exceeded",
"url": null
} |
python, image, file-system
def next(self):
try:
root, dd, ff = self['dir_steps'].next()
except (StopIteration):
self.throw(GeneratorExit)
root_dir_basename = os.path.basename(root)
if root_dir_basename == '.': # ignore parent
pass
if scrubbed_dirname(root) in self['ignored_dirs']:
pass
if not os.path.dirname(root) == '.' and not scrubbed_dirname(root) in self['ignored_dirs']:
notice(msg = "Searching sub-directory {subdir} of the directory {directory}",
verbosity = self['verbosity'],
subdir = oot_dir_basename,
directory = scrubbed_dirname(root))
self.create_named_group(
layer_set = root_dir_basename,
under = self['new_doc'].LayerSets(scrubbed_dirname(root)))
## ... do more stuff before returning `self`
return self
## ... other class stuff | {
"domain": "codereview.stackexchange",
"id": 34313,
"lm_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, image, file-system",
"url": null
} |
solid-state-physics
My question is: why only these electrons are excited? Pauli exclusion principle. Before heating (at 0K), all electron energy levels are full below the fermi energy. When heated, only electrons within kT can be excited since they're the only ones that have a free state that is within kT of their current state | {
"domain": "physics.stackexchange",
"id": 67540,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "solid-state-physics",
"url": null
} |
• Maybe the easiest case to consider would be $T^2 = I$. Make it easy and let $T$ be 2x2. You'll find that $T$ doesn't have to be a multiple of $I$. – Mr. Chip Aug 4 '16 at 12:59
• @jjepsuomi Actually what matters is that constants $\,cI\,$ commute with $\,T.\,$ See my answer where I explain this from a general perspective, which shows why polynomial factorizations, the Binomial Theorem, etc persist to be true when "evaluated" at $\,x = T.\$ – Bill Dubuque Aug 4 '16 at 15:56 | {
"domain": "stackexchange.com",
"id": null,
"lm_label": "1. YES\n2. YES",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9811668717616667,
"lm_q1q2_score": 0.8319978784968901,
"lm_q2_score": 0.847967764140929,
"openwebmath_perplexity": 301.5266675768205,
"openwebmath_score": 0.8987184166908264,
"tags": null,
"url": "https://math.stackexchange.com/questions/1882069/why-does-polynomial-factorization-generalize-to-matrices"
} |
java, performance, programming-challenge
Strategy
Your solve() compares each password with every previously seen password, which makes it O(N2). It's not surprising that the solution is slow, considering that N is large (up to 105).
Consider a different strategy: when you encounter a password, also note all possible variants of it. For example, if the password 31415 appears, then also register the variants 20304, 20306, 20324, 20326, etc.
How many variants would we be talking about? Given an original password, such as 31415, there would be… | {
"domain": "codereview.stackexchange",
"id": 19110,
"lm_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, performance, programming-challenge",
"url": null
} |
quantum-mechanics, angular-momentum, wavefunction, representation-theory, lie-algebra
If you are given three operators called $L_1, L_2$, and $L_3$ and told only that they obey the commutation relations $[L_i,L_j]=(i\hbar) \epsilon_{ijk} L_k$, one might ask what (if anything) they can conclude about the operators or the states on which they act. It is a priori possible that you can't conclude anything about the operators without providing a concrete implementation of them on some Hilbert space, but of course this is not true; this information is sufficient to establish the existence of the Casimir operator $L^2$, as well as to derive all possible eigenvalues of $L^2$ and $L_3$ which would be consistent with the commutators. | {
"domain": "physics.stackexchange",
"id": 62569,
"lm_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, angular-momentum, wavefunction, representation-theory, lie-algebra",
"url": null
} |
machine-learning, deep-learning, neural-network, computer-vision, convolutional-neural-network
Convnet Notes (all yield same poor results):
Batch normalization
Max pooling
50% drop-out probability
Various stride sizes
Various depths of layers: I've tried 2-5 convent layers, multiple 2-4 fully connected layers. I've had as few as 3 layers and as many as 9. Convnet layers have between 32 and 64 neurons, fully connected layers have between 32 and 512 neurons.
3D convolution (took too much memory and caused my GPU to crash)
1x1 convolutions
The one thing I haven't tried is transfer learning, and I hope to only use that as a last resort since the simple net works fine
Code:
Simple neural net
Deep Convnet In your convnet code, you compute the cross entropy manually:
cross_entropy = tf.reduce_mean(-tf.reduce_sum(y_ * tf.log(y_conv), reduction_indices=[1]))
train_step = tf.train.AdamOptimizer(1e-5).minimize(cross_entropy)
If you do that, you may run into numerical stability issues. Instead, you should use
tf.nn.softmax_cross_entropy_with_logits() | {
"domain": "datascience.stackexchange",
"id": 1788,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "machine-learning, deep-learning, neural-network, computer-vision, convolutional-neural-network",
"url": null
} |
vba, excel
Title: Function to get constants of range The following small function receives a range and returns it with only the cells that contain constants or Nothing if there's none.
Private Function GetConstants(ByVal Cells As Range) As Range
On Error GoTo ErrHandler
Set GetConstants = Intersect(Arg1:=Cells.SpecialCells(Type:=xlCellTypeConstants), Arg2:=Cells)
Exit Function
ErrHandler: If Err.Number <> 1004 Then Err.Raise Number:=Err.Number, Source:=Err.Source, Description:=Err.Description, HelpFile:=Err.HelpFile, HelpContext:=Err.HelpContext
End Function
If there's no constants in the range Cells, the Range.SpecialCells method throws the error:
Run-time error '1004':
Application-defined or object-defined error
The error handler ignores it and returns the default value Nothing.
The use of the Intersect method fixes the issue that occurs when the range is only one cell. It otherwise treats it as the whole sheet. | {
"domain": "codereview.stackexchange",
"id": 31764,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "vba, excel",
"url": null
} |
ruby
An array of regular expressions sill also work:
Counter.new("That was magnificent, Trevor.",
filter: [/That/, /was/])
Also, since Enumerable responds to #to_a, the possibilities are endless. This makes the API flexible enough that the caller can do anything needed, but still rational enough to understand and reason about. Best of all, it's done pretty simply.
Catch incorrect filter types
If the caller passes in a filter type that the code does not understand, it acts as though there is no filter. Consider raising an exception instead:
def filter_proc(filter)
if ...
...
else
raise ArgumentError, "Incorrect filter type"
end
end
Use require_relative for spec_helper
In the spec, consider using require_relative to load the spec_helper:
require_relative '../spec_helper' | {
"domain": "codereview.stackexchange",
"id": 7499,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ruby",
"url": null
} |
organic-chemistry, resonance, hybridization
Look at a flat ring; maybe there is more conjugation in cyclopentadiene: "The microwave spectra of the three monosubstituted 13C species of cyclopentadiene have been investigated. The effective rotational constants of these species together with those of the main isotopic species give the structural parameters for the ring. Labeling the methylene carbon as C1 and numbering the other carbons sequentially we obtain: r(C1C2)=1.509 Å, r(C2C3)=1.342 Å, r(C3C4)=1.469 Å, ∠C1C2C3=109.3°, ∠C2C3C4=109.4°, ∠C2C1C5=102.8°." https://aip.scitation.org/doi/10.1063/1.1697207 The C-C single bond between the two double bonds is r(C3C4)=1.469 Å, actually a little longer than in butadiene (1.454 Å)! Steric restrictions in the ring may account for the difference, but it's small, so may be insignificant. | {
"domain": "chemistry.stackexchange",
"id": 12735,
"lm_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, resonance, hybridization",
"url": null
} |
computational-chemistry, biochemistry, statistical-mechanics
no guarantee that we will actually include configurations that do have large contributions to the probability! Thus unless we have many more than 10 points along each axis most likely our result will be utterly, utterly wrong. | {
"domain": "chemistry.stackexchange",
"id": 16060,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "computational-chemistry, biochemistry, statistical-mechanics",
"url": null
} |
ubuntu, ur5
Originally posted by gvdhoorn with karma: 86574 on 2020-07-28
This answer was ACCEPTED on the original site
Post score: 1
Original comments
Comment by lrk on 2020-07-28:
Okay thanks. So I have the option to keep Ubuntu Xenial and install ROS Kinetic, or I can upgrade to Ubuntu Focal Fossa (20.04) and install ROS Noetic. Would u suggest the last option?
Comment by gvdhoorn on 2020-07-28:\
So I have the option to keep Ubuntu Xenial and install ROS Kinetic, or I can upgrade to Ubuntu Focal Fossa (20.04) and install ROS Noetic | {
"domain": "robotics.stackexchange",
"id": 35325,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "ubuntu, ur5",
"url": null
} |
planetary-formation
Title: Mountains and solids on other planets Are there planets that lack mountains or have constrained availablilty of solids. For example a planet that has clay but not more solid stones like normal stones. The direct reason why I wonder is because I started to wonder if there existed planets where one would have to build less solid houses then at the earth due to the solids available if a person would build a house on that planet hypothetically spoken. It would be really nice with a detailed answer of what solids another planet would lack and how it constraints the housings that could be built on that planet in terms of solidness. A planet has been theorized that forms in a primordial disk of high carbon content. See https://en.wikipedia.org/wiki/Carbon_planet. This planet's crust would have a high hydrocarbon content and thus not be very "solid". However, such a planet might theoretically have volcanoes that erupt diamonds, so an alien could build there home out of diamond! | {
"domain": "earthscience.stackexchange",
"id": 1165,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "planetary-formation",
"url": null
} |
python, google-app-engine
Put spaces around operators, for example:
Instead of: str(self.key)[8:10]+self.email
Write like this: str(self.key)[8:10] + self.email
Some lines are way too long
For example this is a bit excessive, don't you think?
mail.send_mail("email@example.com",user.email,"Account Registration Email Confirmation",'You have succesfully registered for an account, please confirm you email address using the link bellow to get started </br> <a href="http://localhost:9080/user/confirmregistration?code=' + user.getverificationcode() + '&email='+user.email+'"></a>')
Use snake_case instead manywordsstucktogether for function and variable names
Overall, this code looks very messy.
For an API, especially security related,
it's really better to make the code as clear and readable as possible,
and following the PEP8 rules will help with that.
Duplicated logic
This kind of call appears at multiple places in the code:
((str(self.key)[8:10]+self.email+str(self.verificationcoderequested)) | {
"domain": "codereview.stackexchange",
"id": 11245,
"lm_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, google-app-engine",
"url": null
} |
organic-chemistry, reaction-mechanism, carbonyl-compounds, nucleophilicity
An elimination reaction mechanism featuring carbanion formation followed in the next step by expulsion of a leaving group on a $\beta$-carbon, with subsequent formation of a $\pi$-bond. Leaving group expulsion is the rate-determining step (source).
Keep in mind that the leaving group of the most of $\mathrm{E1_{cb}}$ elimination reactions is a poor leaving groups such as $\ce{OH-}$ ion. Yet, the driving force for the elimination is to give the thermodynamically more stable product such as the $\alpha, \beta$-unsaturated ketone in aldol condensation. Following is the dehydration of a $\beta$-hydroxyketone via the $\mathrm{E1_{cb}}$ mechanism: | {
"domain": "chemistry.stackexchange",
"id": 15872,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "organic-chemistry, reaction-mechanism, carbonyl-compounds, nucleophilicity",
"url": null
} |
to avoid! The endpoint values are listed between brackets or parentheses. Ask Question Asked 7 years, 8 months ago. Solution: Let P be the set of all members in the math R denotes the set of all real numbers, consisting of all rational numbers and irrational numbers such as . = {2, 4, 6}, S2-| 7, 2, 6}, S,-(4, 2, 6}, And S4 = {2, 4), Which Of The (d) 3 4 S2 () SA CR (c)SrS Following Statements Are True? Range of the functions is the set of all real numbers greater than or equal to 1 or less than or equal to -1. Start with all Real Numbers, then limit them between 2 and 6 inclusive. to his/her profile. Set the argument in equal to to find where the expression is undefined., ... Set-Builder Notation:, for any integer. a < x ⦠A set is a well-defined collection of distinct objects. Beyond that, set notation uses descriptions: the interval (-3,5] is written in set notation as read as " the set of all real numbers x such that ." C denotes the set of all complex numbers. Figure 19 For the | {
"domain": "letters-numbers.com",
"id": null,
"lm_label": "1. YES\n2. YES\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9504109812297142,
"lm_q1q2_score": 0.8078219336557803,
"lm_q2_score": 0.8499711699569786,
"openwebmath_perplexity": 614.5666957950139,
"openwebmath_score": 0.6746774315834045,
"tags": null,
"url": "http://letters-numbers.com/promare-full-zgnhh/all-real-numbers-set-notation-82cd18"
} |
turtlebot
Comment by Daniel Stonier on 2013-05-14:
Follow the bug report on github.
Comment by CarolineQ on 2013-05-14:
I will follow the bug report. Thanks !
We fixed it and released just now. New version should be available soon on shadow-fix repo. Thanks for your inputs! | {
"domain": "robotics.stackexchange",
"id": 14151,
"lm_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",
"url": null
} |
turing-machines, undecidability
Title: Is $L = \{ \langle \langle \ M\ \rangle \rangle \ | \ M \ \text{does not accept}\ 010 \} $ Turing recognizeable? I'm working on the following problem:
Is the following language Turing recognizable (recursively enumerable)
?
$$L = \{ \langle \langle \ M\ \rangle \rangle \ | \ M \ \text{does not
> accept}\ 010 \} $$ | {
"domain": "cs.stackexchange",
"id": 13964,
"lm_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, undecidability",
"url": null
} |
c++, computational-geometry
The size is already stored as part of the the other member m;
Const Correctness
None of these functions
double sum();
double mean();
double dot();
modify the state of your vector. So you should mark them as const members.
double sum() const;
double mean() const;
double dot() const;
This allows you pass your vect to a function as a const reference and still call these non mutating functions.
Efficiency
You may want to cache the sum in a mutable member. Invalidate it if the vector is mutated. There is no point re-computing this value if the vector has not changed.
double sum(){
// computes the sum of the vectors elements
double sum = 0;
size_t l = 0;
while (l<s) {
sum+=m[l];
l++;
}
return sum;
}
Also prefer to use some of the algorithms that are built for you when you can.
sum = std::accumulate(m.begin(), m.end()); | {
"domain": "codereview.stackexchange",
"id": 9911,
"lm_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++, computational-geometry",
"url": null
} |
quantum-mechanics, quantum-field-theory, particle-physics, waves, wave-particle-duality
The "wave-particle duality" is, in any case, a somewhat vague notion that has no real formal counterpart in modern quantum mechanics. Quantum objects are just that, quantum objects. They have aspects of waves (e.g. they can "interfere", they can obey wave-like equations, they "spread") and they have aspects of particles (e.g. they can (but not must be) localized at "points", they have mass) but they are neither. And I'm sure you can find quantum behaviour that you'll not be able to attribute to either a wavy or a particle nature, such as Bell experiments about entanglement (which cannot be explained classically, and hence any attempt to explain them with a particle or wave picture must necessarily fail). | {
"domain": "physics.stackexchange",
"id": 74537,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "quantum-mechanics, quantum-field-theory, particle-physics, waves, wave-particle-duality",
"url": null
} |
newtonian-mechanics, gravity, forces
Title: The physics equation for a perpetual seesaw I am trying to create a game that envovles two or more people jumping on a seesaw and propelling each other in the air. I need help with the physics equations
Assume no friction no air resistance for now. Ideally when you hit the sweet spot of the seesaw at the very end person B should go a little bit higher than person A who just came down. And if you hit close to the piviot, then the reverse should happen. (I don't know if that is really physics but that is what I am going for)
I know the classic example of two forces on each side and t =r x F so if you had a mass heavier on one side that heavier mass would have to be closer to the piviot
What I am not grasping is if
F=ma. And assuming that the masses are all equal then F=a. Now gravity is 9.8/m/s/s on both objects. Is this true even if one of them is at rest on the ground so the seesaw is tilted up? | {
"domain": "physics.stackexchange",
"id": 11147,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "newtonian-mechanics, gravity, forces",
"url": null
} |
python, performance, excel
#for team in teams.items():
# print()
#for key in employees:
# Employee.showData(employees[key])
# print("\n")
if __name__ == "__main__":
main() | {
"domain": "codereview.stackexchange",
"id": 43364,
"lm_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, excel",
"url": null
} |
channelcoding, viterbi-algorithm
I would appreciate if you could share any knowledge. Convolutional codes are linear in the Galois{2} (i.e. binary) field. We know this because the convolution operation is linear. The fact that Viterbi codes are linear has a few implications. First, if you input all 0's you will get all 0's out. Second, if you add two inputs together the output will be the sum of their individual outputs.
The last piece of information that we need for a very informal "proof" is that when you input all 1's the output is all 1's (EDIT: this is not always true- see the edit at the bottom of the answer). We see that this must be so because the encoder state is constant (you are, after all, inputting all 1's) so the output must be constant. The output cannot be 0's because that would match the all 0's case which would make the code non-linear (other than in the trivial case where the encoder always outputs 0 no matter what the input is). | {
"domain": "dsp.stackexchange",
"id": 755,
"lm_label": null,
"lm_name": null,
"lm_q1_score": null,
"lm_q1q2_score": null,
"lm_q2_score": null,
"openwebmath_perplexity": null,
"openwebmath_score": null,
"tags": "channelcoding, viterbi-algorithm",
"url": null
} |
Statement One Alone:
If Sammy had thrown away 2 additional flavors of candy, he could have made exactly 3,003 different 10-flavor bags.
This statement tells us that (x - y b- 2)C10 = 3003. The important thing to remember when approaching questions like this is that we don’t actually need to find the answer; we simply need to determine whether we have enough information to answer the question. In this case, since there is a unique value for (x - y - 2) that satisfies (x - y - 2)C10 = (x - y - 2)!/((x - y - 12)! * 10!), we can determine (x - y - 2), and thus we can determine x - y. After x - y is determined, it is easy to calculate (x - y)C10.
Statement one alone provides enough information to answer the question.
Statement Two Alone:
x = y + 17
We have x - y = 17; thus, 17C10 = 17!/(7! * 10!) can be calculated.
Statement two alone provides enough information to answer the question.
_________________
Scott Woodbury-Stewart
Founder and CEO | {
"domain": "gmatclub.com",
"id": null,
"lm_label": "1. Yes\n2. Yes\n\n",
"lm_name": "Qwen/Qwen-72B",
"lm_q1_score": 0.9412234441519332,
"lm_q1q2_score": 0.8243112547252708,
"lm_q2_score": 0.8757869981319862,
"openwebmath_perplexity": 3206.310807046011,
"openwebmath_score": 0.7131536602973938,
"tags": null,
"url": "https://gmatclub.com/forum/sammy-has-flavors-of-candies-with-which-to-make-goody-bags-137413.html"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.