Number of elements in the set of invertible lower triangular matrices over a finite field


Problem:

Let $ F_q$ be a finite field with $ q$ elements.

$ T_n(F_q) := \{ A = (a_{ij}) \in F^{n \times n}$ | $ a_{ij} = 0$ for $ i < j,$ and $ a_{ij} \neq 0$ $ \forall i \}$ .

Determine the number of elements in $ T_n(F_q)$ .

My solution is as follows:

Starting with the last row going upwards, there are:

$ q-1$ possibilities for the last row;

$ (q-1)q$ possibilities for the row before the last;

.

.

.

$ (q-1)q^{n-1}$ possibilities for the first row.

Therefore, in total there are $ (q-1)^nq^{\sum_{i=1}^{n-1} i} = (q-1)^nq^{\frac{n(n-1)}{2}}$ elements.

Could you, please, check my solution?

Possible to theme the form’s elements with own twig?

I was thinking to get twig outputs so I could use these twig variables on a form.html.twig such as below:

    <div class="row">         <div class="col-md-6">             {{ form.name }}             {{ form.mail }}             {{ form.subject }}         </div>         <div class="col-md-6">             {{ form.body }}         </div>     </div>     <div class="row">         <div class="col-md-12">             {{ form.submit }}         </div>     </div> 

Any idea how to get the similar variables via hooks on MYTHEME.theme?

Hide elements that aren’t needed or used by 99% of users until they are applicable?

I’d like to hide some elements of a frequently used page to declutter the UI for over 99% of users:

In an online product I’m working on, there is a feature that is used 0.003% (49 times out of 123,900 sessions) of the time: a search bar for added notes. Most people just quickly scan with their eyes since there are usually very few notes.

By default we display 10 notes. You can change this to 25, 50, or 100. We also display a previous/next button for page jumping.

Would it be wise to hide these 3 features (search bar, previous/ next button, notes per page selector) until there are more than 10 notes? Currently, almost no one ever uses the search field for notes (0.003%), and the previous/next buttons are only applicable if there are more than 10 notes. There are rarely more than 10 notes, so these buttons just sit there disabled or unused.

Equivalence classes of elements in $X$ vs. equivalence class of $X \times X$

To quote Halmos:

If $ R$ is an equivalence relation in $ X$ , and if $ x$ is in $ X$ , the equivalence class of $ x$ with respect to $ R$ is the set of all elements $ y$ in $ X$ for which $ x R y$ . Examples: if $ R$ is equality in $ X$ , then each equivalence class is a singleton; if $ R = X \times X$ , then the set $ X$ itself is the only equivalence class.

~P. R. Halmos, Naive Set Theory (p. 28)

The first one, I think I understand. Each equivalence class is a singleton because each element $ x$ in $ X$ is only equal to itself.

The second is confusing me further the more I think about it, perhaps because of the wording. If $ R = X \times X$ , do I still consider it to be ‘in’ $ X$ or is it ‘in’ the result of $ X \times X$ ? If it’s the former, how is that any difference than ‘equality in $ X$ ,’ which should yield singletons? If it’s the latter, then surely we’re now dealing with a series of ordered pairs that did not exist in the set $ X$ beforehand, precluding it from being the equivalence class.

Or, is it that it’s neither of these, and the set $ X$ used here is being treated like the $ x$ we are seeking equivalence classes for in his initial definition? This latter definition seems to be the only way I can get my head around how $ X$ itself ends up being the equivalence class, but also seems like I’m missing something vital in making that assumption.

All elements of a list in a condition

I am going to help Mathematica to satisfy the condition:

If All elements of a matrix's eigenvalues are different from zero, then print "ok"

For matrix={{1, 0}, {2, 0}};  If[Eigenvalues[matrix] != 0, Print@"OK"]  it must print OK 

and For matrix={{1, 0}, {2, 0}} its result is nothing.

How can show All elements of a list in a condition?

What is the proper way to style references to D&D game elements?

(Preface: I’m not looking to establish an official formatting style we, on this stack, must adhere to. This is for my own personal writing consistency when writing on the topic of 5e.)

I’ve been doing some writing on the topic of 5th edition in my spare time, and have run into a few instances where I’m not sure how certain game terms should be formatted. I know some common elements, such as italicizing spells like eldritch blast, and that you don’t automatically capitalize spell or race names (unless they’re a proper name, like if it has Melf in the spell name or the like).

In particular, I’m unsure about the following cases:

  • Class feature names (e.g., Cunning Action)
    • Particularly, are these supposed to be capitalized?
    • Are feats formatted the same way?
    • Are class feature subchoices, like particular Eldritch Invocation names (e.g., Armor of Shadows), or fighting styles (e.g., Archery) formatted the same way?
  • Class and subclass/archetype names (e.g., rogue, thief)
    • Particularly, are these supposed to be capitalized?
  • Abbreviations (e.g., Dex for Dexterity)
    • I’ve seen Dex and DEX used interchangeably, but I’ve also seen DEX used to specifically refer to the dexterity modifier. Also, I’ve always seen Dex capitalized when used as such, and I’m unsure if that’s correct.
  • Spells
    • Is my above understanding correct, that they’re lower case and italicized?
    • Would it be Melf’s Acid Arrow or Melf’s acid arrow for ones with a proper name?

Is there a common specific style guide to answer questions like these? Preferably, it’d be either what the D&D team themselves uses when writing about the game, an official guide released by them, or an analysis of how they refer to these elements when discussing the game in an official written capacity (the official books, the official D&D website’s articles, etc.), as I’m not sure what else would count as an official style guide.

Modify jObject elements that are decimal and have no ‘.’ to int, recursively until jObject exist

I wrote code sample below that is finding decimal values in jObject without ‘.’ char, and convert them to long type. The issue is, that it looks really ugly, and it works for max jObject that contains two child jObjects. Any ideas?

public JObject ModifyDoubleIntegers(JObject objectToModify) {     JObject resultObjectModified = new JObject();     foreach (var item in objectToModify)     {         if (item.Value.Type == JTokenType.Object)         {             var itemObject = (JObject)item.Value;             var itemValues = new JObject();             foreach (var childItem in itemObject)             {                 if (childItem.Value.Type == JTokenType.Object)                 {                     var grandChild = (JObject)childItem.Value;                     var grandChildValues = new JObject();                     foreach (var grandChildItem in grandChild)                     {                         if (grandChildItem.Value.Type == JTokenType.Float && !grandChildItem.Value.ToString().Contains('.'))                         {                             grandChildValues.Add(new JProperty(grandChildItem.Key, grandChildItem.Value.ToObject<long>()));                         }                         else                         {                             grandChildValues.Add(new JProperty(grandChildItem.Key, grandChildItem.Value));                         }                     }                     itemValues.Add(childItem.Key, grandChildValues);                 }                 else                 {                     if (childItem.Value.Type == JTokenType.Float &&                         !childItem.Value.ToString().Contains('.'))                     {                         itemValues.Add(new JProperty(childItem.Key, childItem.Value.ToObject<long>()));                     }                     else                     {                         itemValues.Add(new JProperty(childItem.Key, childItem.Value));                     }                 }             }             resultObjectModified.Add(item.Key, itemValues);         }         else         {             if (item.Value.Type == JTokenType.Float && !item.Value.ToString().Contains('.'))             {                 resultObjectModified.Add(new JProperty(item.Key, item.Value.ToObject<long>()));             }             else             {                 resultObjectModified.Add(new JProperty(item.Key, item.Value));             }         }     }     return resultObjectModified; } 

Algorithm for factoring elements of permutation groups?

You can solve a Rubik’s cube by factoring its permutation into a sequence of “elementary” permutations (a subset of permutations that is sufficient to construct every other permutation in the group). There are several algorithms for solving Rubik’s cubes. Are there any algorithms for the general problem of factoring permutations?

How to find sum of maximum K elements in range in array

Recently, I came up to the following problem:

Given array $ A$ of size $ n$ and integer $ k$ , We should answer $ Q$ questions of the type: for given range $ [l, r]$ we should find sum of the $ k$ maximum elements over all $ A_i$ such that $ l \leq i \leq r$ .

Trivial solution would be to sort all values in the range and iterate over the k biggest elements, however this has complexity $ O(QN\log N)$ . After some searching on the internet, I found out that this can be solved by segment trees, however I couldn’t think of proper use of segment trees for this problem.

Is it possible to solve this problem in complexity better than $ O(QN\log N)$

How to map “Spacebar + 1” to “⌃1” on Karabiner Elements?

I’m looking for a way to remap Spacebar as a modifier for only the number row. For example, Spacebar + 0 = ⌃0, but for anything else Spacebar is just Spacebar.

I found this post which does what I I want through the example of M + N. Unfortunately, it’s for an older version of Karabiner, and I don’t understand how this code translates to the current way the program works.