## Calculate the total on events with two time conditions

I have a table in BigQuery that looks something like this:

``    schema = [         bigquery.SchemaField('timestamp', 'TIMESTAMP', mode='REQUIRED', description='Data point timestamp'),         bigquery.SchemaField('event_id', 'STRING', description='EventID'),         [...]     ] ``

The table has a fairly large dataset, and I’m trying to find write an efficient query that returns the number of events that happened in the last 24 hours but also within the last N days. That is, two different records with different conditions but the same `event_id`. I don’t care so much about the actual `event_id`, but rather the distribution.

Ideally, the query would return something like this:

``7_days: 20 30_days: 15 60_days: 7 ``

If it’s impossible to do this in pure SQL, I also have Pandas available at my disposal.

## Do we have to calculate time for declaring statement in RAM model?

Do we have to calculate time for declaring statement, in my case `int num3` statement. The following question was asked by professor as a post-lecture quiz. I selected `t(n)=3`, but the correct answer was `t(n)=4`.

``What is the time taken by following algorithm on RAM model ? ``

``t(n)=3 t(n)=4 t(n)=5 None of the above ``

## How to calculate movement within an area

Related: How does the UA Tunnel Fighter fighting style's reaction attack interact with the Sentinel feat's speed-reduction effect?

The Tunnel Fighter feat from UA has the following wording:

As a bonus action, you can enter a defensive stance that lasts until the start of your next turn. While in your defensive stance, you can make opportunity attacks without using your reaction, and you can use your reaction to make a melee attack against a creature that moves more than 5 feet while within your reach.

What exactly is meant by moving "more" than 5 feet?

Would either of the two following paths be considered moving "more than 5 feet", assuming the player was holding a weapon with reach?

• Path 1: Enter range, move 5 feet, exit range
• Path 2: Enter range, move another 5 feet within range
• Path 3: Enter range, immediately exit range
``┌───┬───┬───┰───┬───┐ │MAX-RANGE->┃   │   │ ├───┼───┼───╂───┼───┤ │   │   │ .------P_1│ ├───┼───┼─|─╂───┼───┤ │ME │   │ `-->F │   │ ├───┼───┼───╂───┼───┤ │   │ F <--------P_2│ ├───┼───┼───╂───┼───┤ │   │   │ .------P_3│ ┝━━━┿━━━┿━|━╃───┼───┤ │   │   │ F │   │   │ └───┴───┴───┴───┴───┘ ``

PURELY looking at the diagram and adding up the lengths of the lines, you could calculate the sum of lines WITHIN my range as being:

• Path 1: `2.5 + 5 + 2.5 = 10`
• Path 2: `2.5 + 5 = 7.5`
• Path 3: `2.5 + 2.5 = 5`

But I don’t know if this is strictly correct. I suspect that partial values may only be calculated before, or after, movement.

If movement is calculated before the step is taken, then stepping into my reach won’t count as movement within my reach, but stepping out will count as 5 feet. This makes Path 2 safe to travel.

If movement is calculated after the step is taken, then stepping into my reach will count as moving 5 feet within my reach, but stepping out won’t count as any. This makes Path 2 dangerous.

If movement is only calculated when it is entirely (start+finish) within reach, then all paths are safe.

There’s a lot of different ways to spin this. Is there any official ruling on how to calculate movement within an area?

## Calculate combined standard deviation

If I have a data that I fit with `NonlinearModelfit` that fits a data based on two fitting parameters, `c1` and `c2`.

When I used `nlm["ParameterTable"] // Quiet` I get the following table:

If I have an equation such as:

`eq = (2.303*((70 + 273.15)^2)*(c1/c2))/1000`

Is there any code (as opposed to doing it manually) I can use to calculate the value of `eq` with the combined standard deviation based on the standard deviations of `c1` and `c2` from the table?

Thank you!

## How do I calculate my skill modifier?

I’m trying to fill out the skills section on my first character, but when I look at the character sheets in the Starter Set as examples of how to make a character, the skills that are circled have higher modifiers than their Dexterity or Strength or whatever should make them.

I’ve filled out all skills but those. What do I add to the ability modifier to get those numbers?

• My abilities are Strength 13, Dexterity 14, Constitution 11, Intelligence 15, Wisdom 8, and Charisma 8.

• Proficiencies are Arcana, Athletics, History, Investigation and Stealth.

• My saving throws are Strength and Dexterity.

I just started D&D and have the Player’s Handbook, DM’s Guide, Monster Manual, and the Starter Set.

## Augmenting AVL tree to calculate sum of subtree

Suggest a way to augment an AVL tree to support a $$O(\log n)$$ implementation of the function `calculateSum(key)`, which receives a key of a node and returns the sum of its subtree.

I implemented it this way:

``sumSubtree(node):     if node != null:         return sumSubtree(node.left) + sumSubtree(node.right) + node.key     return 0      calculateSum(key):     node = Search(key) // assuming I have a search function     return sumSubtree(node) ``

which solves it in $$O(\log n)$$.

But I read it is possible to maintain the sum during insertion and deletion. And augment an AVL tree this way.

Which solution would be better? Mine, or the other method? Does it matter?

## How to calculate the closeness between two curves

In engineering practice, it is often necessary to evaluate how close a curve is to the standard curve to evaluate the roughness parameter corresponding to the object.

I want to know which built-in functions can fulfill such requirements.

## How do I use Any Dice to calculate Mutant Year Zero d66 odds?

In Mutant Year Zero, Alien RPG and Forbidden Lands, the designers include a lot of d66 tables, in which a d6 is rolled for the tens and one for the units, giving 36 possible results (11, 12, 13, 14, 15, 16, 21, 22, etc). How would I be able to simulate this in Any Dice?

## Damage reduction and damage resistance: how to calculate?

Assume a character has both damage reduction and damage resistance vs an incoming attack.

One example of damage reduction is the Heavy Armor Master feat:

While you are wearing heavy armor, bludgeoning, piercing, and slashing damage that you take from non magical weapons is reduced by 3.

One example of damage resistance is the blade ward cantrip:

You extend your hand and trace a sigil of warding in the air. Until the end of your next turn, you have resistance against bludgeoning, piercing, and slashing damage dealt by weapon attacks.

Let’s assume a character with both effects above is hit by a nonmagical weapon attack dealing slashing damage. The attack deals 10 damage. What happens:

1. Damage reduction applies reducing damage to 7, then damage resistance (rounds down). Character takes 3 damage.
2. Damage resistance applies, halving to 5, then damage reduction takes it to 2 damage.

## VC Dimension. How to calculate this

I was intrested in calculating this VC Dimension of the hypothesis class in the picture below. I cannot really provide a proof of how to show its VC dim. It would be really helpful if someone can provide insights in the solution of the problem.