## How can you modify a SUBSET-SUM instance so evaluating a set outputs either 0 or 1?

An SUBSET-SUM instance is a list of $$n$$ integers $$\{ a_1, a_2,… a_n\}$$ and a target $$W$$. To evaluate a set is to find the sum of a selection of numbers in the set. However, I want to know, is it possible to modify the instance, or SUBSET-SUM in general, where evaluating a set outputs $$0$$ if the sum equals $$W$$, and $$1$$ otherwise?

Bonus: Give a list of other NP-complete problems (other than 3SAT, where you evaluate a formula that either outputs $$0$$ or $$1$$ depending on the set of binary variables being passed into it), where evaluating an analogous instance outputs $$0$$ if it satisfies some objective related to the problem and $$1$$ otherwise.

## If-expression not evaluating

Disclaimer:
First time poster here. I hope the question is fine, but please notify me in the comments or edit if sth is wrong with my question

The problem I’m facing is that my if-statement isn’t evaluating, regardless of both the condition and both values evaluating correctly in Mathematica 9.0:

if[CoefficientList[Det[A - IdentityMatrix[3]x], x] == CoefficientList[x^3,x], 2, 3, 3] 

Where A is a square-matrix. The basic idea is to get a value based on a whether A is nilpotent. The output I get is

if[False, 2, 3, 3] 

Thanks captain obvious. Why don’t I get 3, as expected?

## Deriving the Time Complexity of Ryser’s Algorithm for Evaluating the Permanent of a Matrix

Ryser has shown that the permanent of an $$n \times n$$ matrix $$A=(a_{ij})$$ can be expressed as

\begin{align} Perm(A) = (-1)^n \sum_{s \subset [n]} (-1)^{|s|} \prod_{i=1}^n \sum_{j \in s} a_{ij}, \end{align}

where $$[n]=\{1,2,\dots,n\}$$. This algorithm runs in $$\mathcal{O}(2^{n-1}n^2)$$ time. I’ve been trying to derive this, but can’t quite get the result. Here’s my work so far.

The outer sum is over all non-empty subsets of $$[n]$$, of which there are $$2^n-1$$. We recall that the number of subsets of size $$r$$ is $${n \choose r}=\frac{n!}{r!(n-r)!}$$.

For each set $$s$$ in the outer sum we compute $$\sum_{j \in s} a_{ij}$$, which uses $$|s|-1$$ additions. Next, this sum sees the product $$\prod_{i=1}^n$$, which takes $$n-1$$ multiplications. This happens for each non-empty subset of $$[n]$$, so there are the following number of total additions:

\begin{align} \sum_{s \subset [n]} \left(|s|-1\right) &= \sum_{k=1}^n (k-1) {n \choose k} \ &= \sum_{k=1}^n k {n \choose k} – \sum_{k=1}^n {n \choose k} \ &= n \sum_{k=1}^n {n-1 \choose k-1} – \left(2^n – 1\right) \ &= n \left( 2^{n-1}-1 \right) – \left(2^n – 1\right) \ &=n2^{n-1} – 2^n -n +1. \end{align}

The total number of multiplications is $$(n-1)(2^n-1)$$.

There is also the $$(-1)^{|s|}$$, which takes another $$2^n-1$$ operations in total.

This gives us a grand total of $$n2^n + n 2^{n-1} – 2^n -2n+1$$, which is not correct. It looks like I’m off by a factor of $$n$$ on the second term here. Where am I going wrong?

## Evaluating security controls of smaller vendors

In the IT Security team where I work, we currently use the Standarized Information Gathering or SIG tool to evaluate IT security posture of prospective 3rd party vendors. What I like about the SIG is the questions are standarized and depending on responses, only relevant follow up questions are asked.

At very small vendors though that may not have a dedicated IT or IT security function, a lot of the SIG questions may not apply. Currently, we are evaluating a smaller vendor providing a niche service and we are not comfortable with giving due diligence sign off due to the very limited responses provided on SIG questionnaire completed by such vendor. A lot of the controls and best practices on the SIG simply are not applicable due to vendor size. Furthermore, vendor will have remote access to our company infrastructure.

Question: what alternative approaches are viable for risk assessment of very small vendors in which market size is also small and competitors are of approximately same size, so switching vendors is not feasible?

## Evaluating predicate on binary strings

Consider two unknown binary strings $$X = x_{1} x_{2} \dots x_{n^{2}}, \quad Y = y_{1} y_{2} \dots y_{n^{2}}, \quad x_{i}, y_{i} \in \{0, 1\} .$$ We may request a string $$Z = z_{1} z_{2} \dots z_{n^{2}}$$, where $$z_{i} = x_{i}$$ or $$z_{i} = y_{i}$$, no more than $$n + 1$$ times. So, for every request we set required $$z_{i}$$ (that is, $$x_{i}$$ or $$y_{i}$$) for every $$i$$.

Moreover, we have $$n$$ bits of unwritable memory, namely, every bit of that memory is set once and then does not change. This memory is avaliable all the time, but requested $$Z$$ strings drop out before the next request, so, we don’t have complete list of all requested $$Z$$ strings.

The problem is to check if $$X = Y$$ with given $$n$$ bits and $$n + 1$$ times for $$Z$$ string request.

There is an extra question: is it possible to use $$\mathcal{O}(\log^{2}(n))$$ bits of memory and $$\mathcal{O}(\log(r))$$ requests.

I don’t really understand area of CS that is closely related to the problem, could anyone give a hint?

## What causes Autonumbering to stop working after “Evaluating” Notebook in 12.0

I’m using “Section” autonumbering in a notebook that contains text and calculations. Normally my “Section” style numbering looks like:

1)  2)  3) 

After evaluating the notebook the “Section” style numbering looks like:

0) 0) 0) 

Nothing I have tried corrects the problem. I have tried stopping and restarting the kernel. I have tried unloading and reloading the style sheet. When I execute:

CurrentValue[{"CounterValue", "Section"}] 

the command returns zero even though prior to executing the command I initiated 3 “Section” command. I get the same type of failure if I use the default stylesheet and the “ItemNumbered” style.

If I exit Mathematica and reopen it all the sections are numbered correctly. Also if I open another notebook it autonumbers correctly. The problem is localized to any notebook that has been evaluated with the notebook evaluation command.

This problem doesn’t happen with 11.3, only 12.0. Anyone know how to correct the problem in the evaluated notebook?

## evaluating time complexity of a code

I’m trying to evaluate the time complexity of the following :

foo (n)     if n ≤ 1         return 1     if n is odd         for i=1 to n             print i         return foo(n-1) + 1     if n is even         i=n         while i>2             j=1             while j<i                 j=j*2             i=i/3         return 2 * foo(n-1) 

my attempt was to produce a recurrence relation broken into cases:

if $$n \leq 1$$ then :

$$T(n)=\theta(1)$$

if $$n$$ is odd then the for loop is executed $$n$$ times and we return a problem of size $$n-1$$ so :

$$T(n)= T(n-1) + \theta(n)$$

if $$n$$ is even then the inner while loop is executed $$\theta(log_6(n))$$ times and the outer while loop is executed $$O(log_3(n))$$ times so totally that would be $$O(log_3(n))= O(log(n))$$ , and we return a problem of size $$n-1$$ twice so:

$$T(n) = 2T(n-1) + O(log(n))$$

ultimately :

$$T(n) = T(n-1)+n$$ if $$n$$ is odd

$$T(n) = 2T(n-1)+log(n)$$ if $$n$$ is even

$$T(n) = 1$$ if $$n = 1$$

since whenever $$n$$ is odd , $$n-1$$ is even , $$n-2$$ is odd and so on.. that had me confused. Any ideas of how to solve this?

## Help evaluating this homebrew Warlock Pact DND5e

Please excuse any faux pas, this is my first time posting here so I’ll try to be as clear as possible.

I’m hoping to get some feedback on this warlock subclass; The Murderous Celestial

# Context

I’m the DM of a 5e DND game. One of my players is a Neutral-Good warlock who is going to soon run into their patron. In the likely event that these players will not want to go along with the patrons’ plans and instead choose to stop them, I’m planning on the player losing their warlock abilities (The player and I discussed this possibility at the beginning of the campaign). He currently has an Archfey Pact and I had a recent conversation about why he chose it and he said he has no real attachment to his pact type, rather he quite likes the story potential of an Archfey.

At this particular junction in the story, the god of murder Bhaal is quite invested in stopping the patrons’ plans. With this in mind and seeing a potential pawn to help him in his goal to defeat the patron, Bhaal will offer a pact with the player – Help thwart the patron and receive powers from Bhaal. In anticipation of this, I’ve build the above homebrew subclass.

# Theme Behind The Subclass

The theme this subclass is invoking is one of subterfuge, assassination and sowing fear.

I picture a lot of the abilities within this subclass are designed to get the character past whatever defences their target may have before trapping their quarry and completing the assassination.

### Expanded Spell List

The expanded spell list continues the above theme, with spells such as Disguise Self / Mislead and Locate Creature enabling the assassin to find their target. Spells such as Silence, Phantasmal Killer and Bestow Curse allow the assassin to control their target when actually engaging. Finally, the spells Hallow, Misllead and Disguise Self come into play when trying to escape capture.

### Impelling Shroud

Dodgy name but this allows the user to spend a number of D4 out of a total pool to ignore damage. The pool is regenerated after each long rest.

I chose this ability as I believe pushing themselves to ignore the pain in order to complete their kill is quite thematic to Bhaal. I’m a little concerned about the ability for this to negate a lot of small arm damage.

### Sacrificial Virtue

This is my favourite feature.

Knowing my players, I believe actually completing a ritualistic sacrifice is going to be a tough ask but should Bhaal requires sacrifices. Should the players complete the sacrifice they’ll gain a pretty great boon. The additional D6 could get out of hand as it is tied to class level but I’m hoping to make this something worth crossing the moral boundary for.

(Note: My players aren’t typical murder hobos)

### Dark One’s Own Luck

Unchanged from the fiend pact

### Embalming Presence

I like the idea of the pact sowing fear and evil to the players’ allies, even against their will. Embalming Presence is simply to allow the player to have a bit of agency each time they rest and to be reminded that their patron is an evil bad guy.

### Deaths Inevitable Embrace

Potentially quite powerful but very specific in its’ use.

I’m assuming Bhaal is a huge fan of when killing is done in his name. This is my attempt at creating a thematic extension of that. Note that the this can still be triggered and the creature wont die due to resistances / or any immunity.

For example, if a creature who has 30 hit points has resistance to cold and was dealt 20 cold damage. That creature would go down to 20 hit points and would trigger Deaths Inevitable Embrace. However, the creature would still be alive at 10 hit points.

This has a very powerful and thematic synergy with the dice made available via Sacrificial Virtue.

# Final Thoughts

This spells from this class are mostly utility and support with the real damage coming from Deaths Inevitable Embrace and Sacrificial Virtue.

I would like to know however if this is enough, or perhaps too much? How does this stack with other pacts?

Many thanks.

## why Permuted MNIST is good for evaluating continual learning model?

while I was reading papers about continual learning, I found that many researchers use permutated MNIST to evaluate their approach.

It is not clear to me. why?

What I understand is that they were trying to introduce noise(by applying random permutation to the image) but the permutated images are very noisy which cannot be recognised even by a human.

PS. an example of the paper I mentioned; https://arxiv.org/abs/1904.07734

# Solution

Notice that $$f(x):=\ln^n(x)$$ and $$g(x):=\dfrac{1}{1+x^2}$$ is continuous over $$[0,1]$$, and $$g(x)>0$$. As per the first integral mean value theorem, on can have

$$0\leq \int_0^1 \frac{\ln^n (1+x)}{1+x^2}dx=\ln^n(1+\xi)\int_0^1 \frac{dx}{1+x^2}=\frac{\pi}{4}\ln^n(1+\xi)\leq \frac{\pi}{4}\ln^n(1+1)\to 0,$$ which implies $$\lim\limits_{n \to \infty} \int_0^1 \frac{\ln^n (1+x)}{1+x^2}dx=0.$$