## Is this a computable function? Is the reduction correct?

Let $$A$$ be a set, $$K=\{x:\phi_x(x)\downarrow\}$$. Let c to be a total computable function such that $$\phi_{c(x,y,n)}(z)=\begin{cases}\phi_n(z) & \text{if }\phi_x(y)\downarrow\\uparrow &\text{otherwise}\end{cases}$$

Suppose $$\forall x,y\exists a.\phi_x(y)\downarrow \Leftrightarrow c(x, y,a)\in A$$.

The question is if the function: $$f(x)=a$$ such that $$x\in K \Leftrightarrow c(x, x, a)\in A$$ is total computable.

Hence, can I prove $$K\leq _m A$$ with $$c(x,x, f(x))$$ as reduction function?

## How many times in this pseudocode is the function F called?

For this question, I thought function F called twice but it called three times. Are those three functions were called? F(N), F(K) and f(N-1)?

How many times in this pseudocode is the function F called?

Main     Declare K as Integer     K = 3     Set Result = F(K)     Write Result End Program  Function F(N) as Integer         If N == 1 Then Set F = 1     Else         Set F = N * F(N - 1)         Set N = N - 1     End If End Function 

## Maximizing a nonnegative linear function over adjacency matrices with node degree constraints

Suppose $$A$$ is an $$n$$-by-$$n$$ symmetric matrix whose entries are all nonnegative. $$A_{ii} = 0$$ for all $$i$$. We want to find an $$n$$-by-$$n$$ binary ($$0/1$$ valued) matrix $$X$$ that maximizes

$$\sum_{ij} A_{ij} X_{ij}$$

under the constraints that

1. $$X$$ is symmetric ($$X^\top = X$$);
2. Each row of $$X$$ can have at most $$k$$ ones (the rest being zero);
3. The total number of $$1$$ in $$X$$ is at most $$m$$.

Here $$k \le n$$ and $$m \le n^2$$. I can think of a dynamic programming solution if 2 and 3 are the only conditions. But the symmetry in condition 1 makes it much harder. Does there exist a polynomial algorithm which can achieve multiplicatively constant approximation bound (under conditions 1, 2, 3)? Ideally the constant is universal, not dependent on $$n$$, $$k$$, or $$m$$.

If not, is there any hope for the combination of conditions 1 and 2? The combination of 1 and 3 is trivial to handle.

Thank you.

## I use a SendMessage function for my melee attack, but it doesn’t work

I have a melee attack script that work like a charm for the other enemy. But for this one enemy, it doesn’t work. This is the script for the melee attack which utilises the SendMessage function. You can see that there is a Debug.Log statement whenever my player hits something. For the enemy that doesn’t work, when in game, the message is sent, but the effect doesn’t happen.Weirdly enough, the particles instantiate, but the enemy health doesn’t work. This is the melee attack script (only the SendMessage function)

    private void CheckAttackHitBox()     {         Collider2D[] detectedObjects = Physics2D.OverlapCircleAll(attackHitBoxPos.position, attack1Radius, whatIsDamageable);          attackDetails[0] = attack1Damage;         attackDetails[1] = transform.position.x;          foreach (Collider2D collider in detectedObjects)         {             collider.transform.parent.SendMessage("Damage", attackDetails);             Debug.Log("MessageSent");         }     } 

This is my enemy script that receives the message:

private void Damage(float[] attackDetails)     {         currentHealth -= attackDetails[0];          Instantiate(hitParticle, transform.position, Quaternion.Euler(0.0f, 0.0f, Random.Range(0.0f, 360.0f)));          //the x position of the player is greater than the x position of the enemy         if (attackDetails[1] > transform.position.x)         {             damageDirection = -1;         }         else         {             damageDirection = 1;         }          if (currentHealth <= 0.0f)         {             Die();         }     } $$$$ 

## FactorSquareFree::lrgexp: Exponent is out of bounds for function FactorSquareFree. Error

I’m trying to make a two-dimensional contour plot of the temperature of a plate. This is my initial function:

T[x_, y_] :=   (20/Pi) Sum[((-1)^(n + 1)/     n) Exp[(-n Pi y)/10] Sin[(n Pi x)/10], {n, 1, i}] 

The function has been acting how I expect it to, so I believe everything is correct with that.

When I tried to plot it, I used:

ContourPlot[T[x, y] /. i -> 1, {x, 0, 10}, {y, 0, 10}] 

I keep getting the error FactorSquareFree::lrgexp: Exponent is out of bounds for function FactorSquareFree. This will display three times before the systems suppresses the error and then runs without output until I quit the kernel.

I tried to look at the FactorSquareFree function itself to see if I could figure out where it was going out of bounds. Doing that, I got:

FactorSquareFree[T[x, y] /. i -> 1] -(1/Pi)  10 I E^(-(1/5) I Pi (x + I y) -     1/5 Pi (I x + y)) (E^((2 I Pi x)/5 +       1/10 I Pi (x + I y)) - E^(     1/5 I Pi (x + I y) + 1/10 Pi (I x + y)) +      E^(1/5 I Pi (x + I y) + 1/5 Pi (I x + y))       Log[1 + E^(-(1/10) I Pi (x - I y))] -      E^(1/5 I Pi (x + I y) + 1/5 Pi (I x + y))       Log[E^(-(1/10) I Pi (x - I y)) (1 + E^(          1/10 I Pi (x - I y)))] -      E^((2 I Pi x)/5) Log[1 + E^(1/10 I Pi (x + I y))] +      E^(1/5 I Pi (x + I y) + 1/5 Pi (I x + y))       Log[1 + E^(1/10 I Pi (x + I y))]) 

Looking through that, I don’t see anywhere where the exponent should get very large running from {x,0,10} and {y,0,10}.

Everything I have looked up related to this problem has been too complicated for me to understand what solution people were giving. Especially since the issue is with an internal function for ContourPlot, I’m at a loss of what to change or try.

## NMinimize doesn’t work with Defined function and data set

I have a data set

data={{-35., 0.315382}, {-30., 0.510487}, {-25., 0.808823}, {-20.,    1.25604}, {-15., 1.91404}, {-10., 2.86533}, {-5., 4.21811}, {0.,    6.11213}, {5., 8.7253}, {10., 12.2811}, {15., 17.0568}, {20.,    23.3919}, {25., 31.6982}, {30., 42.4692}, {35., 56.2906}, {40.,    73.8511}, {45., 95.9534}, {50., 123.525}, {55., 157.628}, {60.,    199.474}, {65., 250.427}, {70., 312.022}, {75., 385.967}, {80.,    474.158}, {85., 578.681}, {90., 701.827}, {95., 846.09}, {100.,    1014.18}, {105., 1209.02}, {110., 1433.77}, {115., 1691.8}, {120.,    1986.71}} 

and a function

f[t_, a_, b_, c_] := Exp[a + b/(c + t)]; 

Now I do the NMinimize to find parameters a, b, c by using command:

NMinimize[  Total[((f[data[[All, 1]], a, b, c] - data[[All, 2]])/      data[[All, 2]])^2], {a, b, c}] 

The output parameters are wrong. Please let me know what is the problem? Why NMinimize give wrong results.

Thank you

## How to define following function in Mathematica?

How to define the following function in Mathematica?

## Derivative with prime for vector-valued function

Consider first the following vector-valued function of a real variable:

   s[t_] := {Sin[t], Cos[t]} 

Then this works as expected:

   s'[t] (* {Cos[t], -Sin[t]} *) 

Why does the following use of prime to take derivative not also work?

   soln[t] := {x[t], y[t]} /.    First@ DSolve[{Derivative[1][x][t] == y[t],       Derivative[1][y][t] == -x[t], x[0] == 0, y[0] == 1}, {x[t],       y[t]}, t]     soln[t] (* {Sin[t], Cos[t]} *)     soln'[t] (* soln'[t] *) 

Note that the following does work:

   D[soln[t], t] (* {Cos[t], -Sin[t]} *) 

## Can I use PBKDF2 derivation function to generate a MAC in PKCS12 file?

It seems that the default password based key derivation function that is used by PKCS12 to generate a MAC is this one. It is unique to the standard and probably not used anywhere else. Is it possible to use PBKDF2 instead to generate a MAC? Surely I can use PBES2 scheme with PBKDF2 to protect key bags, but how do I encode this information for the whole file’s MAC? Is it possible in principle? So far my attempts to use it resulted in files that are not recognized both by OpenSSL and Windows tools.

## Why can’t the output of the DiscretizeRegion function display completely?

mr = DiscretizeRegion[Region[Rectangle[{0, 0}, {Pi, Pi}]],    AccuracyGoal -> 4]   r6 = TransformedRegion[mr,     Function[{t,       p}, {2 Sin[p]^2 Sin[t]^2 + 5 Cos[p]^2 Sin[t]^2 -        Cos[t]^2, (4 Sin[p]^2 Sin[t]^2 +         25 Cos[p]^2 Sin[t]^2 - (2 Sin[p]^2 Sin[t]^2 +           5 Cos[p]^2 Sin[t]^2 - Cos[t]^2)^2 + Cos[t]^2)^0.5}]]; Region[r6, PlotRange -> {{-1, 5}, {0, 3}}]  DiscretizeRegion[r6, PlotRange -> {{-1, 5}, {0, 3}}] 

Why can’t the output of the DiscretizeRegion function of the above code be displayed completely?

In addition, I don’t know how to change the display size of the uploaded image.