Formulas – Can I use array formulas in Google Sheets to count things in a changing area?

Is it possible to create a single array formula that does the same thing as the following column of formulas:

A1: =COUNTA(B1:B1)
A2: =COUNTA(B1:B2)
A3: =COUNTA(B1:B3)
...
A9: =COUNTA(B1:B9)

My best attempt was =ARRAYFORMULA(COUNTA(INDIRECT("B$1:"&B1:9)) But I am getting a circular dependency error – I suppose because Arrayformula does not know which of the two possible areas I want to extend. I should somehow tell him which array should be output and which not. Maybe there is a notation like "::" for this? Would be cool anyway.

co.combinatorics – Count special metrics on finite fields

Define a Galois coding standard of degree n as a card $ | space | : Bbb F_ {2 ^ n} rightarrow { Bbb Z} $ with the following properties:

(I) $ ( Bbb F_ {2 ^ n}, | space |) $ is a self-dual code ; i.e. $ (x, y) rightarrow | x + y | $ defines a metric $ Bbb F_ {2 ^ n} $ embedded via linear isometry as a self-dual subcode in $ Bbb F_2 ^ n $ in relation to the Hamming standard $ Bbb F_2 ^ n $,

(II) All field automorphisms are isometries,

(III) For normal reasons $ mathcal B_n $ from $ Bbb F_ {2 ^ n} $ and everything $ b in mathcal B_n $ Left multiplication with $ b $ defines an isometry.

  1. Do I and II mean III together? Do (I) and (III) together mean (II)?
  2. Must there be a non-trivial Galois coding standard of the degree? $ n $ for each $ n> 1 $ ? If so, how many satisfy $ | 1 | = n $ ?

An infinite number of metric finite fields are created as a subcode of a binary abelian group code for an odd group. Especially if $ p $ is prime and 2 generates the group squares in $ Bbb F_p ^ * $ Then there is an ideal group ring $ Bbb F_2 ( Bbb F_p ^ +) $ isomorphic too $ Bbb F_ {2 ^ { frac {p-1} {2}} $ whose inherited norm is galois with $ | 1 | = frac {p-1} {2} $,

Numeric Integration – How to count the number of function scores in NIntegrate

Try the option EvaluationMonitor

Block[{k = 0}, {NIntegrate[f[x], {x, -2, 1}, EvaluationMonitor :> k++], k}]

{0.0901049, 121}

Without use EvaluationMonitor you can do that

ClearAll[f, ff]
f[x_] := Tanh[x] Sin[Exp[x]] Exp[-0.55 x^2 Exp[x^2]]

i = 0;
ff[y_?NumberQ] := Block[{x = y}, i++; f[x]]

{NIntegrate[ff[x], {x, -2, 1}], i}

{0.0901049, 121}

dnd 5e – Does the Forgotten Realms setting count as "High Magic"?

Traditionally, the forgotten kingdom is no "high magic".

While magic is something commonplace in the Forgotten Realms, this is actually the basic level of magic in a D & D campaign.

The D & D 3.0 Dungeon Master's Guide, P.164, defined high magic as follows:

Wizards and magical treasures are twice as common as these rules, if not more frequently. Most characters have one or two levels of wizards or magicians. Even a shopkeeper could be at least a first-level wizard. Like any other item, magic items are bought and sold in clearly labeled shops. Spells are used to light houses, keep people warm and communicate. The function they perform is as natural as modern technology in the real world.

This does not match the description of the D & D 3.0 Forgotten Realms campaign setting, p. 92, "Magic in Society":

Bearers of Arcane Magic – also known as Art – are rare in most Heartlands societies. It is likely that no more than one hundredth person possesses an ability as a sorcerer or sorcerer.

The terms "high magic" and "low magic" were not widely used after this point, and even the 3.5-DMG omit their definition. The only reference I know about the "High Magic" campaign style in the 5th issue is in the Startup Equipment Table (DMG p.38).

python count block combinations I: Project Euler 114

Problem Statement (For a more detailed description (including pictures) please visit the link):

A series of seven units in length has red blocks with a minimum
Length of three units placed on it, leaving two red blocks
(which may be different lengths) are separated by at least
a gray square. There are exactly seventeen ways to do this.

In how many ways can a fifty-unit long row be filled?

Code:

from scipy import special
import time
import itertools


def partitionfunc(n,k,l=3):
    '''n is the integer to partition, k is the 
    length of partitions, l is the min partition element size'''
    if k < 1:
        return 0
    if k == 1:
        if n >= l:
            yield (n,)
        return 0
    for i in range(l,n+1):
        for result in partitionfunc(n-i,k-1,i):
            yield (i,)+result


def valid_partitions(p):
    total =  p
    count = 0 #Max. number of tiles that can be placed on a row.
    while True:
        count += 1
        total -=3
        if total <= 3:
            break
        total-=1
    '''Find all the valid partitions with length (1,count) that can be placed on the row with length p'''
    data = ()
    for k in range(1,count+1):
        min_part = k*3 
        for n in range(min_part,p+1):
            Allowed = ()
            LIST = list(partitionfunc(n,k))
            for b in LIST:
                if sum(b) + (len(b)-1) <= p: 
                    Allowed.append(b)
            data+= Allowed
    return data


def count_permutations(array):
    '''Counts how many possible permutations are there for the particular partition'''
    get_unique_elements = set(array)
    total_length = len(array)
    lengths = (array.count(x) for x in get_unique_elements)
    answer = 1
    for b in lengths:
        answer*= special.comb(total_length, b)
        total_length-= b
    return answer

def calculate_ways(m,n):
    return special.comb(n-m+1,n-2*m+1)


def final(w):
    total_variations = 0
    data = valid_partitions(w)
    for q in data:
        m = len(q)
        remain = w - sum(q) - m + 1
        n = 2*m -1 + remain
        total_variations+= calculate_ways(m,n)*count_permutations(q)
    return int(total_variations+1)

if __name__ == '__main__':
    start = time.time()
    print('Answer: {}'.format(final(50)))
    print(time.time()-start)

I explain the reasons for the code with an example from Euler:

Step 1

First, we find the maximum number of tiles that can be placed in the 7-length row. At most 2 tiles can be placed, so the number is 2 (name this number number).

Then we go through (1,number) and find all valid partitions of number seven:

In our case:

1 Tile: (3), (4), (5), (6), (7) (The reason why we omit (1) and (2) is that the minimum length of the red tile is 3).

2 tiles: (3, 3) (Note that while (3,4) is also a partition of 7, in our case it does not work because it states that there must be a partition at least 1 tile gap between two red tiles.

Step 2.

For each partition obtained in step 1, we calculate the number of ways that the partition can be placed in the row.

For example:

(5) Represents 1 tile of length 5. There are 3 ways to place such a tile.

(3,3) Represents 2 tiles, both of length 3. There is a way to place them in the row.

If we add the numbers we get 16. We have to add 1 because (I'm curious why) the line that does not contain any Red tiles are also a valid case. The final answer 17.


I believe that exists a lot of of things that can be improved. I am pleased about suggestions for improvement!

S. The problem I would like to highlight is the variable / function names. I believe there is a way to get it through More descriptive / clear then they are now.

Equipment – Does the mass value of items in my backpack count to my limit?

My Pathfinder 2e character has a maximum of 7. I have purchased an adventurer's backpack that costs 2kg but includes a backpack that can carry up to 4kg.

The description of the backpack (Core Rulebook, p. 287) reads:

A backpack holds up to 4 pieces. If you carry or stow the backpack rather than carrying it on your back, its mass is rather light than negligible.

I am not sure how this interacts with my mass. I can foresee two possibilities:

  1. I can still only carry up to 7 bulk. My backpack can carry 4 bulk by itself, but if I carry or carry the backpack I must also wear the 4 bulk. In this case, there seems to be no real benefit to a backpack unless you justify it As You carry things.
  2. While I carry the backpack, I can carry up to 11 pieces of luggage (7 of my limit, 4 of the backpack). This makes the backpack useful, but I do not see this interpretation supported in the rules.

How does the backpack work? Does the bulk value of the items in my backpack count toward my bulk limit?

SQL Server 2014 – How do I use the COUNT function to count up to the current line for each line?

I had problems formulating the question, but I think the following example will make things clearer.

Context: When you try to create a query for Microsoft Report Builder, you need to do some logic for the data in one of the tables.

I have an SQL table (let's call it AllEvents) in the database with the following format:

UserName   |    Grouping    | EventDate | NumberOfEvents
________________________________________________________
Alice      | Red Grouping   | 1/1/2000  | 1
Alice      | Red Grouping   | 1/2/2000  | 2
Alice      | Red Grouping   | 1/3/2000  | 3
Alice      | Blue Grouping  | 1/4/2000  | 1
Alice      | Blue Grouping  | 1/5/2000  | 2
Anderson   | Red Grouping   | 1/3/2000  | 1
Anderson   | Blue Grouping  | 1/5/2000  | 1
Anderson   | Green Grouping | 1/6/2000  | 1
Anderson   | Green Grouping | 1/7/2000  | 2

And I want to select the results so that I get an output of the following form, which counts the number of events for the username before and up to the EventDate of the line.

UserName    | EventDate   | EventNumber
_______________________________________
Alice       | 1/1/2000    | 1
Alice       | 1/2/2000    | 2
Alice       | 1/3/2000    | 3
Alice       | 1/4/2000    | 4
Alice       | 1/5/2000    | 5
Anderson    | 1/3/2000    | 1
Anderson    | 1/5/2000    | 2
Anderson    | 1/6/2000    | 3
Anderson    | 1/7/2000    | 4

We can ignore the grouping column because we are only interested in the rows with the same username.

I tried to use a subquery like the following:

SELECT

   SUM
   (
      CASE WHEN AE.EventDate> AllEvents.EventDate
         THEN 1
         ELSE 0
      END
   )
   OVER (PARTITION BY UserName, Grouping)

FROM AllEvents AS AF

WHERE
   AE.UserName= AllEvents.PatientId
   AND AE.EventDate= AllEvents.EventDate

In the following query:

SELECT
   UserName,
   EventDate,
   (The subquery above) AS EventNumber

FROM
  AllEvents

However, the subquery returns more than one value, and I am trying to determine the corrective action.

I also played with the COUNT function but could not count it depending on the EventDate value of the current line.

For advice or suggestions, I would be grateful. I tried to be creative, but I do not know if I found the best method.

apache 2.2 – View Count Simple tool

Recently, I considered logging and aggregating Apache data directly into MySQL. However, some members of the forum were against it and advised to use ELK Stack instead. Unfortunately, after some googling, it seems to be much more complex than I need. In short, I'm looking for a simple tool to count views from the Apache protocol (single server) and send the aggregated data to MySQL after a certain threshold (for example, 5/5 minutes or 1/1 KB).

Any recommendation of such a simple tool?

Mysql Laravel filters a field count in a query

Hello, I have a problem. I have to filter my incident table, which I count at 3. The problem is that I have to use the last count twice
I have the responsibility_incidence field, which can be 0 or 1. I have to count how many 0 there are and how many 1 there are, except that the other 2 are counted in a table. I have the following, but I can only do 1 if this is effective for the table to filter it

$ fields = DB :: table (& # 39; Incidents & # 39;)
-> choose (DB :: raw (# count (incid_id) as ticket, company.name, sum (incidences.state) as solved, count (responsibility_incident) as responsible C, count (responsibility_incident) as responsible L & # 39; ))
-> join (& # 39; company & # 39 ;, & # 39; company.id_company & # 39 ;, & # 39; = & # 39; incidences.id_client & # 39;
-> where (& # 39; incidences.responsible_incidence & # 39 ;, & # 39; = & # 39 ;, & # 39; 1 & # 39;
//->where (& # 39; incidencias.responsable_incidencia), & # 39; = & # 39 ;, & # 39; 0 & # 39;

                 ->where('id_cliente', '>', '0' )
                 //->where('incidencias.responsable_incidencia', '=','0' )
                 ->groupBy('empresa.nombre')

                 ->orderBy('ticket', 'DESC')

                 ->get();