What is the correct name for a “product function” on a monoid?
What is the correct name for a "product function" on a monoid?
Determining "level" of an NPC ally for purpose of budgeting encounter XP Note that this is not the same as:   Mistagged questions should be retaggable immediately. Why don't we consider centrifugal force on a mass placed on earth? Let us say a block of mass is placed on the surface of earth. Then while drawing the forces on that body, we say:   Force $F = mg$ acting towards the center of Earth. Normal reaction $N$ offered by the surface of Earth.   If no other forces are acting, we say $F=N$. But what about the centrifugal force $m\omega^2R$ . Why don't we ever bring that into picture? What am I missing? The number of different ways to choose $k$ out of $n$ unique items The number of different ways to choose $k$ out of $n$ unique items:   Without repetition and without order-significance: $\binom{n}{k}=\frac{n!}{k!(n-k)!}$ Without repetition and with order-significance: $\binom{n}{k}\times k!=\frac{n!}{(n-k)!}$ With repetition and with order-significance: $n^k$ With repetition and without order-significance: $?$   Thank you! I'm teaching my self topology with the aid of a book. I'm trying to prove the following is a topology:     Let X be an infinite set. Show that $\mathscr{T}_2=\{U \subseteq X : U = \emptyset $ or $ X\setminus U $ is countable$ \} $ is a topology.   My book calls this set the ""  Please let me know if my proof is valid.     corollary [A]: The union of countable sets are countable.    proof: I'm going to take as a given that that the union of finite set are finite, and just prove the case of . A set is countable infinite if there is a bijection between the set and the natural numbers. Let $A$ and $B$ be a countable infinite sets. Now let $f$ be the bijection between $A$ and $\mathbb{N}$ and $g$ be $B$'s bijection.  $f:\mathbb{N}  \rightarrow  A$  $g:  \mathbb{N}  \rightarrow B$  There can always exist a bijection $h$ that maps $A \cup B $ to $\mathbb{N}$. To account for non disjoint sets, let $B' = B \setminus A$; (note: $A \cup B = A \cup B'$)  $h:  \mathbb{N}   \rightarrow  A \cup B'$  $ h(x) = \left\{         \begin{array}{ll}             f(\frac{1}{2}x); &amp; \quad x \in 2\mathbb{N} \\             g(\frac{x+1}{2}); &amp; \quad x \in 2\mathbb{N}+1         \end{array}     \right. $   $h^{-1}(x)$ would map $A$ to the even numbers, and $B'$ to the odd numbers.  Therefore, The union of countable sets are countable. (QED)  Now to verify the definition.     (i) X and Ø are elements of $\mathscr{T}$.   Ø is given in the definition of $\mathscr{T}_2$. Also, the empty set is considered finite, with cardinality zero. Thus $X$ is in $\mathscr{T}_1$ because its complement is finite, and finite numbers are countable.      (ii) $\mathscr{T}$ is closed under finite intersections.   Let:$V_k \subseteq X$ be any countable set. (ie: $V_1, V_2...$ are all countable sets)  So Then, $U_k = X \setminus V_k$, would be the subsets of $\mathscr{T}_2$.  $U_k \cap U_j = X \setminus (V_k \cup V_j) $, due to De Morgan's law.   Thus, $U_k \cap U_j \in  \mathscr{T}_2$, since the Union of two countable sets is also countable[A]. And This reasoning can be extended to any finite amount of intersections.       (iii) $\mathscr{T}$ is closed under arbitrary unions.   Let $A=\bigcup_{i \in I} U_i$ be an arbitrary union of sets whose complements are are countable.Then by De Morgan's law, $A=X \setminus (\bigcap_{i \in I}V_i)$, for some countable sets $V_i$. By the definition of intersection, $\bigcap_{i \in I}V_i \subseteq V_i$ for all $i \in I$. Since $V_i$ is countable so is any of its subsets.  Hence the complement of $A$ is countable. I have the following element element(by.css(&quot;span[aria-label='Picker ID, TESTUSER']&quot;)  I want to assure the text on this filed is TESTUSER, so I tried:  expect(element(by.css(&quot;span[aria-label='Picker ID, TESTUSER']&quot;)).getAttribute('value')).toEqual('TESTUSER');  then I got the error: Expected null to equal 'TESTUSER' So I tried: element(by.css(&quot;span[aria-label='Picker ID, TESTUSER']&quot;)).getText().then(function (value) {         console.log(value);       })  And I got this error: Expected '' to be 'TESTUSER'.  How to get the value of this field and expect it is TESTUSER? Apache doesn't log remoteIP when RemoteIPHeader X-Forwarded-For is present Linked account +100 rep bonus also applied to account with 200 How can I list the contents of a .zip folder in c#? Suppose the proper length of a train is longer than that of a bridge, and the bridge can't bear the total weight of the train but can bear it partially. As the train goes very fast, it becomes shorter than the bridge and it can be entirely on the bridge. As a result, the bridge will collapse. However, in the train's frame, the train is even longer than the bridge, and it is only partially on the bridge; so the bridge will not collapse. What is the solution to this paradox? When logging in C#, how can I learn the name of the method that called the current method? I know all about System.Reflection.MethodBase.GetCurrentMethod(), but I want to go one step beneath this in the stack trace. I've considered parsing the stack trace, but I am hoping to find a cleaner more explicit way, something like Assembly.GetCallingAssembly() but for methods. Custom script "invoked too many times" error Credit:   function getDirection(city1, city2, unit) {   var directions = Maps.newDirectionFinder()     .setOrigin(city1).setDestination(city2)     .setMode(Maps.DirectionFinder.Mode.DRIVING)     .getDirections();   var d = directions.routes[0].legs[0].distance.text;    var distance, value = d.split(" ")[0].replace(",", ""), text = d.split(" ")[1];   if(text == unit) {     distance = value;   } else if(text == "km" &amp;&amp; unit == "mi") {     distance = value / 1.6;   } else {     distance = value * 1.6;   }   return Math.round(distance); }   I have used this code snippet in one of my sheets. I am working on a dataset with roughly 6000 entries and I am getting some errors because of the large volume.      Script invoked too many times per second for this Google user account. (line 0).      Service invoked too many times for one day: route. (line 4).   I considered purchasing a Google Apps business account to increase my quota, but that might not even help. Do you maybe have any advice for me in this regard? Direct Link to a Comment How to find the reduced density matrix of a four-qubit system? I have the state vector $|p\rangle$ made up of 4 qubits. Say system A is made up of the first and second qubits while system B is made up of qubits 3 and 4. I want to find the reduced density matrix of system A.   I know I could separately extract qubits 1,2 and 3,4 into their own state vectors then find their density matrices and compute the reduced density matrix for system A.  I want to figure out how to do this without having to extract and separate the systems. First I would find the density matrix of $|p\rangle$ and then do a partial trace with respect to system B. I am not sure how to do the partial trace of system B since the system contains 2 qubits.  Can anyone help me figure this out? I am using Python and NumPy for reference. Ability to update profile from the Stack Exchange Android App It would be nice to update the profile page from within the app.  Perhaps not many people update their profiles more frequently, but when required to do so, I would prefer to do it from the app instead of the mobile browser. What does each part of the `ls -la` output mean? What do the following numbers represent? Why do shadows from the sun join each other when near enough? Limit of $\frac{\log(n!)}{n\log(n)}$ as $n\to\infty$. What is the opposite category of $\operatorname{Top}$? My question is rather imprecise and open to modification. I am not entirely sure what I am looking for but the question seemed interesting enough to ask:   The opposite category of rings is the category of affine schemes. This is usually thought of as the category of spaces. Can we run the construction backwards for categories usually thought of as containing spaces?  For instance, does $\operatorname{Top}^{\operatorname{op}}$ have a nice description as some "algebraic" category?  Note that it does not seem easy to describe the opposite category of all schemes. Therefore, the above question might be asking too much. Perhaps the following is a more tractable (or not) question:  Can we find an "algebraic" category $C$ such that we can embed $C^{\operatorname{op}}$ in $\operatorname{Top}$ such that every topological space can be covered by objects in $C^{\operatorname{op}}$? Perhaps one would like to replace this criterion of being covered by objects by a more robust notion in general.  One can repeat the question for other categories of spaces like:   Category of manifolds (perhaps closer to schemes than general topological spaces) Compactly generated spaces Simplicial Sets   and so on. A perhaps interesting example is the category of finite sets, it's opposite category is the category of finite Boolean algebras. The canonical way to return multiple values in languages that support it is often . Option: Using a tuple Consider this trivial example: def f(x):   y0 = x + 1   y1 = x * 3   y2 = y0 ** y3   return (y0, y1, y2)  However, this quickly gets problematic as the number of values returned increases. What if you want to return four or five values? Sure, you could keep tupling them, but it gets easy to forget which value is where. It's also rather ugly to unpack them wherever you want to receive them. Option: Using a dictionary The next logical step seems to be to introduce some sort of 'record notation'. In Python, the obvious way to do this is by means of a dict. Consider the following: def g(x):   y0 = x + 1   y1 = x * 3   y2 = y0 ** y3   return {'y0': y0, 'y1': y1 ,'y2': y2}  (Just to be clear, y0, y1, and y2 are just meant as abstract identifiers. As pointed out, in practice you'd use meaningful identifiers.) Now, we have a mechanism whereby we can project out a particular member of the returned object. For example, result['y0']  Option: Using a class However, there is another option. We could instead return a specialized structure. I've framed this in the context of Python, but I'm sure it applies to other languages as well. Indeed, if you were working in C this might very well be your only option. Here goes: class ReturnValue:   def __init__(self, y0, y1, y2):      self.y0 = y0      self.y1 = y1      self.y2 = y2  def g(x):   y0 = x + 1   y1 = x * 3   y2 = y0 ** y3   return ReturnValue(y0, y1, y2)  In Python the previous two are perhaps very similar in terms of plumbing - after all { y0, y1, y2 } just end up being entries in the internal __dict__ of the ReturnValue. There is one additional feature provided by Python though for tiny objects, the __slots__ attribute. The class could be expressed as: class ReturnValue(object):   __slots__ = [&quot;y0&quot;, &quot;y1&quot;, &quot;y2&quot;]   def __init__(self, y0, y1, y2):      self.y0 = y0      self.y1 = y1      self.y2 = y2  From the :  The __slots__ declaration takes a sequence of instance variables and reserves just enough space in each instance to hold a value for each variable. Space is saved because __dict__ is not created for each instance.  Option: Using a  (Python 3.7+) Using Python 3.7's new dataclasses, return a class with automatically added special methods, typing and other useful tools: @dataclass class Returnvalue:     y0: int     y1: float     y3: int  def total_cost(x):     y0 = x + 1     y1 = x * 3     y2 = y0 ** y3     return ReturnValue(y0, y1, y2)  Option: Using a list Another suggestion which I'd overlooked comes from Bill the Lizard: def h(x):   result = [x + 1]   result.append(x * 3)   result.append(y0 ** y3)   return result  This is my least favorite method though. I suppose I'm tainted by exposure to Haskell, but the idea of mixed-type lists has always felt uncomfortable to me. In this particular example the list is -not- mixed type, but it conceivably could be. A list used in this way really doesn't gain anything with respect to the tuple as far as I can tell. The only real difference between lists and tuples in Python is that lists are , whereas tuples are not. I personally tend to carry over the conventions from functional programming: use lists for any number of elements of the same type, and tuples for a fixed number of elements of predetermined types. Question After the lengthy preamble, comes the inevitable question. Which method (do you think) is best?