## maximum eigenvalue across subsamples

I have an $$N$$-dimensional vector of data, say $$X_{t}$$, with $$1 \leq t \leq T$$.

Of this vector $$X_{t}$$, I want to consider sub-vectors, say $$X_{t}^{b}$$, which are $$m$$-dimensional combinations of elements of the original vector $$X_{t}$$. In total, I have $${N}\choose{m}$$ of such combinations.

Note that $$N$$ can be a large number; I need to allow for $$N \rightarrow \infty$$. Also, I will choose $$m$$ in such a way that $$m$$ is “smaller” than $$N$$, e.g. $$m=O(N^{1/2})$$.

I want to compute the $$k$$-th eigenvalue ($$k$$ is user-defined) of the second moment matrix of each of these $$X_{t}^{b}$$s, i.e.

$$\lambda_{k}^{b} \left( \frac{1}{T} \sum_{t=1}^{T} X_{t}^{b} (X_{t}^{b})’ \right).$$

Then, finally, I want to compute

$$\max_{1 \leq b \leq B} \lambda_{k}^{b}$$,

where $$B$$ is defined as $${N}\choose{m}$$. In principle, I may need to compute also other measures such as the average of $$\lambda_{k}^{b}$$.

I have two questions:

1. Is this problem NP-hard? Is there a reference to back up either statement (i.e. “it is” or “it is not”)?
2. Is there some heuristic to make the problem less computationally burdensome? Is there any way to prove, for a given heuristic, that the solution found by the heuristic is “very close” to $$\max_{1 \leq b \leq B} \lambda_{k}^{b}$$ – e.g. by showing that the solution found by the heuristic and $$\max_{1 \leq b \leq B} \lambda_{k}^{b}$$ are equal almost surely, or something similar?

Many many thanks for your help.

## What is the maximum number of bardic music uses a single-classed lvl 15 bard can have?

I am working on a (somewhat) functional version of the classic Bard/Barbarian hybrid. The lynchpin is using Rage Casting(Dragon #310), which requires casting to be a free action, citing Quicken Spell(PHB) as a potential option. To do this I’m using Metamagic Song(RoS) to power a quickened spell and using Rapid Metamagic(CM) to make this acceptable for spontaneous spellcasting, and other means of reducing metamagic cost in order make it cost less. Consequently, I need to have as many uses of Bardic Music per day..

How many bardic music uses is it possible for a 15th level bard have? Ideally I would like it to be at least 60-70.

## Removing maximum number of elements from a set

The problem is this, say you have a set $$E$$ of elements $$e$$, and you have a list of elements you want to remove from this set. But for a point to be removed, one of its dependencies must stay in the set. The list of elements to remove is as follows:

$$i_1$$ : $$a, b, c, d$$
$$i_2$$ : $$e, f, g, h$$

So in order to remove $$i$$, one of the points “$$a$$, $$b$$, $$c$$, $$d$$….” must remain.
The question is how to remove the maximum number of elements while keeping one of its dependencies.

Note that all elements are in the same set, so a dependency of one element can be in the list of elements to remove.
Also if it helps, there is an upper bound on the number of dependencies for an element.

## If the same attack that causes a druid to revert from Wild Shape also reduces their maximum HP, what happens?

I am aware of Jeremy Crawford’s ruling that maximum HP reduction applied to a Wild Shape form does not apply to the druid’s true form when Wild Shape reverts. However, this doesn’t answer the question of what happens when the attack that causes the maximum HP reduction is also the attack that causes the druid to revert.

This is certainly a related question to the appropriate order of damage and HP reduction effects, with the added wrinkle of resolving when the druid reverts. Assuming someone can cite the answer to the linked question (which was made more by reductio ad absurdem than a cited source), I can see four likely scenarios:

1. The wild shape takes damage, reverts, then the full max HP reduction is applied to the druid. (This is, to me, most logical scenario, and results from the order damage-revert-max HP reduction.)

2. The wild shape takes damage and absorbs as much of the max HP reduction as possible, applying the remaining damage and max HP reduction to the druid. (This is hard to sell, as the max HP reduction is applied at a time when no rule says it should be, but based on Crawford’s tweet above seems to be the rule as intended.)

3. The wild shape takes damage and max HP reduction is applied, then the form reverts and additional damage is applied to the druid. The druid’s max HP is not affected. (This is the most lenient case, but seems more correct than case 2 if the correct order of application is damage-max HP reduction-revert.)

4. The druid dies before it reverts, because its wild shape form was reduced to 0 maximum hit points. (This is the harshest case and results from the same order, damage-max HP reduction-revert. This seems more likely again than the previous two, as “The target dies if this effect reduces its hit point maximum to 0,” is not like Disintegrate’s check after the spell’s damage has been dealt.)

When the same attack that causes the druid to revert from Wild Shape also reduces their max HP, what happens?

## How can I solve error “Exceeded maximum execution time” in Google Sheets?

I found a script which I really need (link):

function getTotalSum(cell) {     var sheets = SpreadsheetApp.getActiveSpreadsheet().getSheets();     var sum = 0;     for (var i = 0; i < sheets.length ; i++ ) {         var sheet = sheets[i];         var val = sheet.getRange(cell).getValue();          if (typeof(val) == 'number') {             sum += val;            }            }      return sum; }

but it gives an error (Exceeded maximum execution time) generally.

How can I solve this error?

## Maximum contiguous sum in an array

The following code is my solution for the following Daily Coding Challenge

Given an array of numbers, find the maximum sum of any contiguous subarray of the array.

For example, given the array [34, -50, 42, 14, -5, 86], the maximum sum would be 137, since we would take elements 42, 14, -5, and 86.

Given the array [-5, -1, -8, -9], the maximum sum would be 0, since we would not take any elements.

Do this in O(N) time.

I think this is done in O(N) time and is the best solution. If someone can think of a better way, I would be interested.

array = [4, -2, 7, -9] running_sum = 0 for i in range(1,len(array)):     if array[i-1] > 0:         array[i] = array[i] + array[i-1]     else:          array[i-1] = 0 print(max(array))

## Given price and number of pages of each book, What is the maximum number of pages you can buy?

You are in a book shop which sells n different books. You know the price and number of pages of each book.

You have decided that the total price of your purchases will be at most x. What is the maximum number of pages you can buy? You can buy each book at most once.

Example:

In: 4 10 4 8 5 3  //price 5 12 8 1 //pages Out: 13 Explaination: You can buy books 1 and 3. Their price is 4+5=9 and the number of pages is 5+8=13

This is my recursive approach :

f(i,j) is max pages, when you can afford i units of money and j is the index in vector uptill the jth book. ie 0 to jth books are considered.

f(x, 0)=max( f(x-price[indx], indx+1) + pages[indx], f(x,indx+1) );

I am having difficulty making the base case, what should be the base case?

Thank you.

## Measurable selection for maximum process

Suppose that $$\Phi(t,x)$$ is the solution for the Stratonovich SDE, say on $$\mathbb{T}^2$$,

$$\Phi(t,x) = \Phi(0,x) + \int_0^t u(\Phi(s,x))ds + \int_0^t \sigma(\Phi(s,x))\circ dW(s), \tag{1}$$

where $$u$$ and $$\sigma$$ are respectively log-Lipschitz and smooth vector fields on $$\mathbb{T}^2$$ and $$W$$ is Brownian motion. Now suppose that $$c(t)$$ is a H\”{o}lder continuous stochastic process with state space $$\mathbb{T}^2$$, and consider the stochastic process

$$R(t) := \sup_{x\in \bar{B}(0,r)} |\Phi(t,x)-c(t)|^2. \tag{2}$$

Since $$\Phi$$ is spatially continuous (in fact, it has some H\”{o}lder regularity due to $$u$$ being log-Lipschitz) and $$\bar{B}(0,r)$$ is compact, we know that for each $$(t,\omega)$$ fixed, there exists $$x(t,\omega)\in \bar{B}(0,r)$$ such that

$$R(t,\omega) = |\Phi(t,x(t,\omega),\omega)-c(t,\omega)|^2. \tag{3}$$

Evidently, there may be more than one point $$x(t,\omega)$$ satisfying (3); so we have the multi-valued function

$$(t,\omega) \mapsto \{x\in \bar{B}(0;r) : |\Phi(t,x,\omega)-c(t,\omega)|^2 – R(t,\omega)=0\}, \tag{4}$$

where the values of this function are compact.

My question is the following.

Question. Is there a find a selection $$x(t,\omega)$$ in (3) so that the stochastic process $$t \mapsto \Phi(t,x(t),\omega)$$ is measurable and adapted?

## Maximum weighted matching for directed (non-bipartite) graphs

This post concerns mainly non-bipartite graphs.

Edmonds (1961) have proposed the Blossom algorithm to solve the maximum matching problem for undirected graphs. The best implementation of it is due to Micali and Vazirani (1980): $$\mathcal O(|E|\sqrt{|V|})$$ time. There is a version of the Blossom algorithm for weighted graphs (Kolmogorov, 2009), but still it concerns only undirected graphs.

Are you aware of any implementation of the Blossom algorithm for weighted directed graphs? I could not find one.

## Maximum Flow in a Network

Let N = (V, E) be a network in which the capacity of each edge is either 12 or 18. Prove or disprove: The value of a maximum flow for N can’t be 56.

I’m trying to figure out how to definitely prove this. I think that this is not possible because of no combination of 12X + 18Y (where X and Y are integers) will ever = 56. Is there a better way of saying this? Am I right to say that and (X,Y) integer solution to 12X + 18Y = 56 is what the Fold-Fulkerson algorithm implies?